#NEWLINE# def test_redis_listing_handler_used_from_view_when_requested( self ) : #NEWLINE# #INDENT# ct_id = self . publishables [ 0 ] . content_type_id #NEWLINE# ( t1 , t2 ) = ( ( time . time ( ) - 90 ) , ( time . time ( ) - 100 ) ) #NEWLINE# redis . client . zadd ( 'listing:d:2' , ( '%d:1' % ct_id ) , repr ( t1 ) ) #NEWLINE# redis . client . zadd ( 'listing:d:2' , ( '%d:3' % ct_id ) , repr ( t2 ) ) #NEWLINE# ( dt1 , dt2 ) = ( from_timestamp ( t1 ) , from_timestamp ( t2 ) ) #NEWLINE# rf = RequestFactory ( ) #NEWLINE# request = rf . get ( self . category_nested . get_absolute_url ( ) , { #NEWLINE# #INDENT# 'using' : 'redis' , #NEWLINE# #UNINDENT# } ) #NEWLINE# lct = ListContentType ( ) #NEWLINE# context = lct . get_context ( request , self . category_nested ) #NEWLINE# tools . assert_equals ( 2 , len ( context [ 'listings' ] ) ) #NEWLINE# ( l1 , l2 ) = context [ 'listings' ] #NEWLINE# tools . assert_equals ( l1 . publishable , self . publishables [ 0 ] ) #NEWLINE# tools . assert_equals ( l2 . publishable , self . publishables [ 2 ] ) #NEWLINE# tools . assert_equals ( l1 . publish_from , dt1 ) #NEWLINE# tools . assert_equals ( l2 . publish_from , dt2 )