#NEWLINE# @ patch ( 'tracking.middleware.TRACK_PAGEVIEWS' , True ) #NEWLINE# def test_admin( self ) : #NEWLINE# #INDENT# visitor = Visitor . objects . create ( ) #NEWLINE# admin = VisitorAdmin ( Visitor , self . site ) #NEWLINE# self . assertFalse ( admin . session_over ( visitor ) ) #NEWLINE# visitor . expiry_time = ( now ( ) - timedelta ( seconds = 10 ) ) #NEWLINE# self . assertTrue ( admin . session_over ( visitor ) ) #NEWLINE# visitor . expiry_time = None #NEWLINE# visitor . end_time = now ( ) #NEWLINE# self . assertTrue ( admin . session_over ( visitor ) ) #NEWLINE# time_on_site = None #NEWLINE# self . assertEqual ( admin . pretty_time_on_site ( visitor ) , visitor ) #NEWLINE# visitor . time_on_site = 30 #NEWLINE# time_on_site = timedelta ( seconds = 30 ) #NEWLINE# self . assertEqual ( admin . pretty_time_on_site ( visitor ) , time_on_site )