#NEWLINE# def test_sink_iread_should_return_RedisTimeStamped_models( self ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# keys = [ 'service1' , 'service2' , 'service3' , 'service4' , 'service5' , 'service6' ] #NEWLINE# self . my_sink . connection . scan_iter . return_value = ( i for i in keys ) #NEWLINE# for i in range ( 1 , 7 ) : #NEWLINE# #INDENT# service_name = ( 'service%s' % i ) #NEWLINE# data [ service_name ] = RedisTimeStamped ( { #NEWLINE# #INDENT# 'ttl' : 120 , #NEWLINE# #UNINDENT# } , TimeSeriesTuple ( service_name , 60 , 1.0 ) ) #NEWLINE# #UNINDENT# data [ 'service4' ] = None #NEWLINE# def stub_get( key ) : #NEWLINE# #INDENT# item = data . get ( key ) #NEWLINE# if item : #NEWLINE# #INDENT# return pickle . dumps ( item ) #NEWLINE# #UNINDENT# #UNINDENT# count = 0 #NEWLINE# self . my_sink . connection . get = keys #NEWLINE# for item in self . my_sink . iread ( None ) : #NEWLINE# #INDENT# expect ( item ) . to . be . a ( RedisTimeStamped ) #NEWLINE# count += 1 #NEWLINE# #UNINDENT# expect ( count ) . to . equal ( 5 )