#NEWLINE# def test_list( self ) : #NEWLINE# #INDENT# sess = mock . Mock ( ) #NEWLINE# resp = mock . Mock ( ) #NEWLINE# resp . json = mock . Mock ( return_value = [ SAMPLE , OLD_SAMPLE ] ) #NEWLINE# sess . get = mock . Mock ( return_value = resp ) #NEWLINE# path_args = { #NEWLINE# #INDENT# 'counter_name' : 'name_of_meter' , #NEWLINE# #UNINDENT# } #NEWLINE# found = sample . Sample . list ( sess , path_args = path_args ) #NEWLINE# first = next ( found ) #NEWLINE# self . assertEqual ( SAMPLE [ 'sample_id' ] , first . id ) #NEWLINE# self . assertEqual ( SAMPLE [ 'metadata' ] , first . metadata ) #NEWLINE# self . assertEqual ( SAMPLE [ 'counter_name' ] , first . counter_name ) #NEWLINE# self . assertEqual ( SAMPLE [ 'project_id' ] , found . project_id ) #NEWLINE# dt = datetime . datetime ( 2015 , 3 , 9 , 12 , 15 , 57 , 233772 ) . replace ( tzinfo = None ) #NEWLINE# self . assertEqual ( dt , first . recorded_at . replace ( tzinfo = None ) ) #NEWLINE# self . assertEqual ( SAMPLE [ 'resource_id' ] , first . resource_id ) #NEWLINE# self . assertEqual ( SAMPLE [ 'source' ] , first . source ) #NEWLINE# dt = datetime . datetime ( 2015 , 3 , 9 , 12 , 15 , 57 , 233772 ) . replace ( tzinfo = None ) #NEWLINE# self . assertEqual ( dt , first . generated_at . replace ( tzinfo = None ) ) #NEWLINE# self . assertEqual ( SAMPLE [ 'type' ] , first . type ) #NEWLINE# self . assertEqual ( SAMPLE [ 'unit' ] , first . unit ) #NEWLINE# self . assertEqual ( SAMPLE [ 'user_id' ] , first . user_id ) #NEWLINE# self . assertEqual ( SAMPLE [ 'volume' ] , first . volume ) #NEWLINE# second = next ( found ) #NEWLINE# self . assertEqual ( OLD_SAMPLE [ 'counter_name' ] , second . counter_name )