#NEWLINE# @ patch . object ( occ . cloud_config . CloudConfig , 'get_api_version' ) #NEWLINE# @ patch . object ( OperatorCloud , 'keystone_client' ) #NEWLINE# def test_revoke_bad_domain_exception( 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 . domains . get . side_effect = Exception ( 'test' ) #NEWLINE# with testtools . ExpectedException ( OpenStackCloudException , 'Failed to get domain baddomain \\(Inner Exception: test\\)' ) : #NEWLINE# #INDENT# self . cloud . revoke_role ( mock_keystone . fake_role [ 'name' ] , user = self . fake_user [ 'name' ] , domain = 'baddomain' )