<s> from django . test . client import Client <EOL> from django . test import TestCase <EOL> from django . contrib . auth . models import User <EOL> from django . conf import settings <EOL> from django . core . urlresolvers import reverse <EOL> class MockAdminTestCase ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . user = User ( <EOL> username = '<STR_LIT:test>' , email = '<STR_LIT>' , is_active = True , <EOL> is_staff = True , is_superuser = True , <EOL> ) <EOL> self . user . set_password ( '<STR_LIT:test>' ) <EOL> self . user . save ( ) <EOL> self . client . login ( username = '<STR_LIT:test>' , password = '<STR_LIT:test>' ) <EOL> def test_admin_not_broken ( self ) : <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertContains ( response , '<STR_LIT>' ) <EOL> self . assertNotContains ( response , "<STR_LIT>" ) <EOL> def test_admin_auth_not_broken ( self ) : <EOL> response = self . client . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> , response ) <EOL> def test_admin_auth_user_not_broken ( self ) : <EOL> url = reverse ( '<STR_LIT>' ) <EOL> self . assertEqual ( url , '<STR_LIT>' ) <EOL> response = self . client . get ( url ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> , response ) <EOL> def test_admin_1_root ( self ) : <EOL> url = reverse ( '<STR_LIT>' ) <EOL> self . assertEqual ( url , '<STR_LIT>' ) <EOL> self . assertRedirects ( self . client . get ( url . rstrip ( '<STR_LIT:/>' ) ) , url , <NUM_LIT> ) <EOL> response = self . client . get ( url ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> , response ) <EOL> self . assertEqual ( response . content , b"<STR_LIT:root>" , response ) <EOL> def test_admin_1_level1 ( self ) : <EOL> url = reverse ( '<STR_LIT>' ) <EOL> self . assertEqual ( url , '<STR_LIT>' ) <EOL> self . assertRedirects ( self . client . get ( url . rstrip ( '<STR_LIT:/>' ) ) , url , <NUM_LIT> ) <EOL> response = self . client . get ( url ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> , response ) <EOL> self . assertEqual ( response . content , b"<STR_LIT>" , response ) <EOL> def test_admin_1_level1_level2 ( self ) : <EOL> url = reverse ( '<STR_LIT>' ) <EOL> self . assertEqual ( url , '<STR_LIT>' ) <EOL> self . assertRedirects ( self . client . get ( url . rstrip ( '<STR_LIT:/>' ) ) , url , <NUM_LIT> ) <EOL> response = self . client . get ( url ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> , response ) <EOL> self . assertEqual ( response . content , b"<STR_LIT>" , response ) <EOL> def test_admin_2_root ( self ) : <EOL> url = reverse ( '<STR_LIT>' ) <EOL> self . assertEqual ( url , '<STR_LIT>' ) <EOL> self . assertRedirects ( self . client . get ( url . rstrip ( '<STR_LIT:/>' ) ) , url , <NUM_LIT> ) <EOL> response = self . client . get ( url ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> , response ) <EOL> self . assertEqual ( response . content , b"<STR_LIT:root>" , response ) <EOL> def test_runtime_error ( self ) : <EOL> from . admin import make_admin_class , patterns , url <EOL> from admin_utils . mock import InvalidAdmin <EOL> self . assertRaises ( <EOL> InvalidAdmin , <EOL> make_admin_class , "<STR_LIT>" , patterns ( "<STR_LIT>" , <EOL> url ( r'<STR_LIT>' , '<STR_LIT:root>' , name = '<STR_LIT>' ) , <EOL> ) , "<STR_LIT>" <EOL> ) </s>
