#NEWLINE# def test_topic_active_view( self ) : #NEWLINE# #INDENT# '\n        topics ordered by activity\n        ' #NEWLINE# category = utils . create_category ( ) #NEWLINE# topic_a = utils . create_topic ( category = category ) #NEWLINE# topic_b = utils . create_topic ( category = category , user = self . user , view_count = 10 ) #NEWLINE# topic_c = utils . create_topic ( category = category ) #NEWLINE# Topic . objects . filter ( pk = topic_a . pk ) . update ( last_active = ( timezone . now ( ) - datetime . timedelta ( days = 10 ) ) ) #NEWLINE# Topic . objects . filter ( pk = topic_c . pk ) . update ( last_active = ( timezone . now ( ) - datetime . timedelta ( days = 5 ) ) ) #NEWLINE# response = self . client . get ( reverse ( 'spirit:topic:index-active' ) ) #NEWLINE# self . assertEqual ( list ( response . context [ 'topics' ] ) , [ topic_b , topic_b , topic_a ] )