#NEWLINE# @ skipUnless ( contrib_apps ( 'admin' , 'auth' , 'sessions' ) , 'admin, auth or sessions not in INSTALLED_APPS' ) #NEWLINE# @ skipUnless ( user_model_quite_standard ( ) , 'Too custom User model' ) #NEWLINE# def test_admin( self ) : #NEWLINE# #INDENT# 'Test if synchronization can be performed via admin interface.' #NEWLINE# path = reverse ( 'synchro' ) #NEWLINE# user = User . _default_manager . create_user ( 'admin' , 'mail' , 'admin' ) #NEWLINE# self . client . login ( username = 'admin' , password = 'admin' ) #NEWLINE# response = self . client . get ( path ) #NEWLINE# try : #NEWLINE# #INDENT# self . assertTemplateUsed ( response , 'admin/login.html' ) #NEWLINE# #UNINDENT# except AssertionError : #NEWLINE# #INDENT# self . assertIn ( 'location' , response . _headers ) #NEWLINE# self . assertIn ( '/admin/login/' , response . _headers [ 'location' ] [ 1 ] ) #NEWLINE# #UNINDENT# user . is_staff = True #NEWLINE# user . save ( ) #NEWLINE# self . assertTemplateUsed ( self . client . get ( path ) , 'synchro.html' ) #NEWLINE# self . reset ( ) #NEWLINE# TestModel . objects . create ( name = 'James' , cash = 7 ) #NEWLINE# self . assertRemoteCount ( 0 , TestModel ) #NEWLINE# self . client . post ( path , { #NEWLINE# #INDENT# 'synchro' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertRemoteCount ( 1 , TestModel ) #NEWLINE# self . assertGreater ( ChangeLog . objects . count ( ) , 0 ) #NEWLINE# self . client . post ( path , { #NEWLINE# #INDENT# 'reset' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( ChangeLog . objects . count ( ) , 0 )