#NEWLINE# @ patch . object ( occ . cloud_config . CloudConfig , 'get_api_version' ) #NEWLINE# @ patch . object ( OperatorCloud , 'keystone_client' ) #NEWLINE# def test_revoke_no_project_or_domain( self , mock_keystone , mock_api_version ) : #NEWLINE# #INDENT# mock_api_version . return_value = '3' #NEWLINE# mock_keystone . roles . list . return_value = [ self . fake_role ] #NEWLINE# mock_keystone . users . list . return_value = [ mock_api_version . fake_user ] #NEWLINE# mock_keystone . projects . list . return_value = [ ] #NEWLINE# mock_keystone . domains . get . return_value = None #NEWLINE# mock_keystone . role_assignments . list . return_value = [ self . user_project_assignment ] #NEWLINE# with testtools . ExpectedException ( OpenStackCloudException , 'Must specify either a domain or project' ) : #NEWLINE# #INDENT# self . cloud . revoke_role ( self . fake_role [ 'name' ] , user = self . fake_user [ 'name' ] )