<s> from __future__ import absolute_import , print_function <EOL> from django . core . urlresolvers import reverse <EOL> from exam import fixture <EOL> from sentry . models import ProjectKey <EOL> from sentry . testutils import TestCase <EOL> class NewProjectKeyTest ( TestCase ) : <EOL> @ fixture <EOL> def path ( self ) : <EOL> return reverse ( '<STR_LIT>' , args = [ self . organization . slug , self . project . slug ] ) <EOL> def test_requires_authentication ( self ) : <EOL> self . assertRequiresAuthentication ( self . path ) <EOL> def test_generates_new_key_and_redirects ( self ) : <EOL> keycount = ProjectKey . objects . filter ( project = self . project ) . count ( ) <EOL> self . login_as ( self . user ) <EOL> resp = self . client . post ( self . path ) <EOL> assert resp . status_code == <NUM_LIT> <EOL> newkeycount = ProjectKey . objects . filter ( project = self . project ) . count ( ) <EOL> assert newkeycount == keycount + <NUM_LIT:1> </s>
