#NEWLINE# @ patch ( 'explorer.models.get_s3_connection' ) #NEWLINE# def test_get_snapshots_sorts_snaps( self , mocked_conn ) : #NEWLINE# #INDENT# conn = Mock ( ) #NEWLINE# conn . list = Mock ( ) #NEWLINE# conn . list . return_value = [ { #NEWLINE# #INDENT# 'key' : 'foo' , #NEWLINE# 'last_modified' : 'b' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'key' : 'bar' , #NEWLINE# 'last_modified' : 'a' , #NEWLINE# #UNINDENT# } ] #NEWLINE# mocked_conn . return_value = conn #NEWLINE# q = SimpleQueryFactory ( ) #NEWLINE# snaps = q . snapshots #NEWLINE# self . assertEqual ( conn . list . call_count , 1 ) #NEWLINE# self . assertEqual ( snaps [ 0 ] [ 'key' ] , 'bar' ) #NEWLINE# conn . list . assert_called_once_with ( ( 'query-%s.snap-' % q . id ) )