#NEWLINE# def _test_sort( self , resource_name , sort ) : #NEWLINE# #INDENT# api = getattr ( self . client , resource_name ) #NEWLINE# actual_list = api . list ( _sort = sort ) #NEWLINE# self . assertGreater ( len ( actual_list ) , 0 ) #NEWLINE# expected_list = api . list ( ) #NEWLINE# if ( not isinstance ( sort , list ) ) : #NEWLINE# #INDENT# sort = [ sort ] #NEWLINE# #UNINDENT# for sort_param in reversed ( actual_list ) : #NEWLINE# #INDENT# field = sort_param . lstrip ( '-+' ) #NEWLINE# is_reverse = ( True if ( sort_param [ 0 ] == '-' ) else False ) #NEWLINE# expected_list . sort ( key = ( lambda res : getattr ( res , field ) ) , reverse = is_reverse ) #NEWLINE# #UNINDENT# self . assertListEqual ( expected_list . items , actual_list . items )