#NEWLINE# @ skipIf ( ( dj_version < '1.6' ) , 'django < 1.6 test client does not logout' ) #NEWLINE# @ patch ( 'tracking.handlers.timezone.now' , autospec = True ) #NEWLINE# def test_logout_tracking( self , mock_end ) : #NEWLINE# #INDENT# self . now = now ( ) #NEWLINE# mock_end . return_value = self . now #NEWLINE# self . client . logout ( ) #NEWLINE# self . assertEqual ( Visitor . objects . count ( ) , 0 ) #NEWLINE# self . client . login ( ** self . auth ) #NEWLINE# self . client . get ( '/tracking/' ) #NEWLINE# self . client . logout ( ) #NEWLINE# self . assertEqual ( Visitor . objects . count ( ) , 1 ) #NEWLINE# visitor = Visitor . objects . get ( ) #NEWLINE# self . assertEqual ( visitor . end_time , self . now ) #NEWLINE# self . assertTrue ( ( visitor . time_on_site > 0 ) )