#NEWLINE# @ mock . patch . object ( keystone . api , 'keystone' ) #NEWLINE# def test_user_get_list_with_filters( self , kc ) : #NEWLINE# #INDENT# filters = { #NEWLINE# #INDENT# 'enabled' : True , #NEWLINE# #UNINDENT# } #NEWLINE# request = self . mock_rest_request ( ** { #NEWLINE# #INDENT# 'session.get' : mock . Mock ( return_value = 'the_domain' ) , #NEWLINE# 'GET' : dict ( ** filters ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# kc . user_list . return_value = [ mock . Mock ( ** { #NEWLINE# #INDENT# 'to_dict.return_value' : { #NEWLINE# #INDENT# 'name' : 'Ni!' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) , mock . Mock ( ** { #NEWLINE# #INDENT# 'to_dict.return_value' : { #NEWLINE# #INDENT# 'name' : 'Ptang!' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) ] #NEWLINE# response = keystone . Users ( ) . get ( request ) #NEWLINE# self . assertStatusCode ( response , 200 ) #NEWLINE# self . assertEqual ( response . json , { #NEWLINE# #INDENT# 'items' : [ { #NEWLINE# #INDENT# 'name' : 'Ni!' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'name' : 'Ptang!' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# kc . user_list . assert_called_once_with ( filters , project = None , domain = 'the_domain' , group = None , filters = filters )