<s> from __future__ import absolute_import , unicode_literals <EOL> import logging <EOL> from django . core . urlresolvers import reverse <EOL> from django . test import TestCase <EOL> from django . test . client import Client <EOL> from django . contrib . auth . models import User , Group <EOL> from . . models import AccountUser , Role , Team <EOL> from . import factory <EOL> LOG = logging . getLogger ( __name__ ) <EOL> class AdminCreateDatabaseTestCase ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> USERNAME = "<STR_LIT>" <EOL> PASSWORD = "<STR_LIT>" <EOL> def setUp ( self ) : <EOL> self . role = Role . objects . get_or_create ( name = "<STR_LIT>" ) [ <NUM_LIT:0> ] <EOL> self . team = Team . objects . get_or_create ( <EOL> name = "<STR_LIT>" , role = self . role ) [ <NUM_LIT:0> ] <EOL> self . superuser = User . objects . create_superuser ( <EOL> self . USERNAME , email = "<STR_LIT>" % self . USERNAME , password = self . PASSWORD ) <EOL> self . team . users . add ( self . superuser ) <EOL> self . client . login ( username = self . USERNAME , password = self . PASSWORD ) <EOL> def tearDown ( self ) : <EOL> self . client . logout ( ) <EOL> def test_user_is_authenticated ( self ) : <EOL> """<STR_LIT>""" <EOL> url = reverse ( '<STR_LIT>' ) <EOL> response = self . client . get ( url ) <EOL> self . assertContains ( <EOL> response , "<STR_LIT>" , status_code = <NUM_LIT:200> ) <EOL> def test_user_login_invalid ( self ) : <EOL> """<STR_LIT>""" <EOL> client = Client ( ) <EOL> data = { '<STR_LIT:username>' : '<STR_LIT>' , '<STR_LIT:password>' : '<STR_LIT>' } <EOL> response = client . post ( '<STR_LIT>' , data ) <EOL> self . assertContains ( <EOL> response , "<STR_LIT>" , status_code = <NUM_LIT:200> ) <EOL> def test_can_load_audit_page ( self ) : <EOL> """<STR_LIT>""" <EOL> url = reverse ( '<STR_LIT>' ) <EOL> response = self . client . get ( url ) <EOL> self . assertContains ( <EOL> response , "<STR_LIT>" , status_code = <NUM_LIT:200> ) <EOL> def test_can_load_user_add_page ( self ) : <EOL> """<STR_LIT>""" <EOL> url = reverse ( '<STR_LIT>' ) <EOL> response = self . client . get ( url ) <EOL> self . assertContains ( response , "<STR_LIT>" , status_code = <NUM_LIT:200> ) <EOL> def test_can_load_user_edit_page ( self ) : <EOL> """<STR_LIT>""" <EOL> url = reverse ( <EOL> '<STR_LIT>' , args = ( self . superuser . id , ) ) <EOL> response = self . client . get ( url ) <EOL> self . assertContains ( response , "<STR_LIT>" , status_code = <NUM_LIT:200> ) </s>
