Use call to repleace call2

Because all call have been migrated to call2.
This patch uses call to replace call2.

Change-Id: Ia53e647027d4a0bdb7b77117a055656a8d5ce9f9
This commit is contained in:
jonnary 2016-12-29 22:02:00 +08:00
parent 6d9624fbfc
commit f8765f517f
32 changed files with 316 additions and 316 deletions

View File

@ -35,7 +35,7 @@ class TrustMiddleware(wsgi.Middleware):
ctx = req.context
params = {'user': ctx.user, 'project': ctx.project}
obj = util.parse_request('CredentialGetRequest', req, params)
res = rpcc.call2(ctx, 'credential_get', obj)
res = rpcc.call(ctx, 'credential_get', obj)
if res:
trust_id = res.get('trust', None)
if trust_id:
@ -65,7 +65,7 @@ class TrustMiddleware(wsgi.Middleware):
cred = {'openstack': {'trust': trust.id}}
params = {'cred': cred}
obj = util.parse_request('CredentialCreateRequest', req, params)
rpcc.call2(ctx, 'credential_create', obj)
rpcc.call(ctx, 'credential_create', obj)
return trust.id

View File

@ -58,7 +58,7 @@ class WebhookMiddleware(wsgi.Middleware):
raise exc.HTTPBadRequest(six.text_type(ex))
except jsonschema.exceptions.ValidationError as ex:
raise exc.HTTPBadRequest(six.text_type(ex.message))
receiver = rpcc.call2(dbctx, 'receiver_get', obj)
receiver = rpcc.call(dbctx, 'receiver_get', obj)
svc_ctx = context.get_service_context()
kwargs = {

View File

@ -76,7 +76,7 @@ class ActionController(wsgi.Controller):
params['project_safe'] = project_safe
obj = util.parse_request('ActionListRequest', req, params)
actions = self.rpc_client.call2(req.context, "action_list", obj)
actions = self.rpc_client.call(req.context, "action_list", obj)
return {'actions': actions}
@ -95,6 +95,6 @@ class ActionController(wsgi.Controller):
def get(self, req, action_id):
params = {'identity': action_id}
obj = util.parse_request('ActionGetRequest', req, params)
action = self.rpc_client.call2(req.context, 'action_get', obj)
action = self.rpc_client.call(req.context, 'action_get', obj)
return {'action': action}

View File

@ -31,8 +31,8 @@ class BuildInfoController(wsgi.Controller):
@util.policy_enforce
def build_info(self, req):
obj = util.parse_request('GetRevisionRequest', req, {})
engine_revision = self.rpc_client.call2(req.context, 'get_revision',
obj)
engine_revision = self.rpc_client.call(req.context, 'get_revision',
obj)
build_info = {
'api': {'revision': cfg.CONF.revision['senlin_api_revision']},
'engine': {'revision': engine_revision}

View File

@ -47,8 +47,8 @@ class ClusterPolicyController(wsgi.Controller):
params['identity'] = cluster_id
obj = util.parse_request('ClusterPolicyListRequest', req, params)
policies = self.rpc_client.call2(req.context, 'cluster_policy_list',
obj)
policies = self.rpc_client.call(req.context, 'cluster_policy_list',
obj)
return {'cluster_policies': policies}
@ -57,6 +57,6 @@ class ClusterPolicyController(wsgi.Controller):
params = {'identity': cluster_id, 'policy_id': policy_id}
obj = util.parse_request('ClusterPolicyGetRequest', req, params)
cluster_policy = self.rpc_client.call2(req.context,
'cluster_policy_get', obj)
cluster_policy = self.rpc_client.call(req.context,
'cluster_policy_get', obj)
return {'cluster_policy': cluster_policy}

View File

@ -60,15 +60,15 @@ class ClusterController(wsgi.Controller):
unsafe = util.parse_bool_param(consts.PARAM_GLOBAL_PROJECT, is_global)
params['project_safe'] = not unsafe
req_obj = util.parse_request('ClusterListRequest', req, params)
clusters = self.rpc_client.call2(req.context, 'cluster_list', req_obj)
clusters = self.rpc_client.call(req.context, 'cluster_list', req_obj)
return {'clusters': clusters}
@util.policy_enforce
def create(self, req, body):
"""Create a new cluster."""
obj = util.parse_request('ClusterCreateRequest', req, body, 'cluster')
cluster = self.rpc_client.call2(req.context, 'cluster_create',
obj.cluster)
cluster = self.rpc_client.call(req.context, 'cluster_create',
obj.cluster)
action_id = cluster.pop('action')
result = {
'cluster': cluster,
@ -81,7 +81,7 @@ class ClusterController(wsgi.Controller):
"""Gets detailed information for a cluster."""
body = {'identity': cluster_id}
obj = util.parse_request('ClusterGetRequest', req, body)
cluster = self.rpc_client.call2(req.context, 'cluster_get', obj)
cluster = self.rpc_client.call(req.context, 'cluster_get', obj)
return {'cluster': cluster}
@ -96,7 +96,7 @@ class ClusterController(wsgi.Controller):
params['identity'] = cluster_id
obj = util.parse_request('ClusterUpdateRequest', req, params)
cluster = self.rpc_client.call2(req.context, 'cluster_update', obj)
cluster = self.rpc_client.call(req.context, 'cluster_update', obj)
action_id = cluster.pop('action')
result = {
@ -108,12 +108,12 @@ class ClusterController(wsgi.Controller):
def _add_nodes(self, req, cid, nodes):
params = {'identity': cid, 'nodes': nodes}
obj = util.parse_request('ClusterAddNodesRequest', req, params)
return self.rpc_client.call2(req.context, 'cluster_add_nodes', obj)
return self.rpc_client.call(req.context, 'cluster_add_nodes', obj)
def _del_nodes(self, req, cid, nodes):
params = {'identity': cid, 'nodes': nodes}
obj = util.parse_request('ClusterDelNodesRequest', req, params)
return self.rpc_client.call2(req.context, 'cluster_del_nodes', obj)
return self.rpc_client.call(req.context, 'cluster_del_nodes', obj)
@wsgi.Controller.api_version('1.3')
def _replace_nodes(self, req, cluster_id, nodes):
@ -123,8 +123,8 @@ class ClusterController(wsgi.Controller):
params = {'identity': cluster_id, 'nodes': nodes}
obj = util.parse_request('ClusterReplaceNodesRequest', req, params)
return self.rpc_client.call2(req.context, 'cluster_replace_nodes',
obj)
return self.rpc_client.call(req.context, 'cluster_replace_nodes',
obj)
def _do_resize(self, req, cluster_id, data):
params = {'identity': cluster_id}
@ -161,21 +161,21 @@ class ClusterController(wsgi.Controller):
) % {'m': obj.max_size, 'n': obj.min_size}
raise exc.HTTPBadRequest(msg)
return self.rpc_client.call2(req.context, 'cluster_resize', obj)
return self.rpc_client.call(req.context, 'cluster_resize', obj)
def _do_scale_out(self, req, cid, count):
params = {'identity': cid}
if count is not None:
params['count'] = count
obj = util.parse_request('ClusterScaleOutRequest', req, params)
return self.rpc_client.call2(req.context, 'cluster_scale_out', obj)
return self.rpc_client.call(req.context, 'cluster_scale_out', obj)
def _do_scale_in(self, req, cid, count):
params = {'identity': cid}
if count is not None:
params['count'] = count
obj = util.parse_request('ClusterScaleInRequest', req, params)
return self.rpc_client.call2(req.context, 'cluster_scale_in', obj)
return self.rpc_client.call(req.context, 'cluster_scale_in', obj)
def _do_policy_attach(self, req, cid, data):
if not isinstance(data, dict):
@ -184,8 +184,8 @@ class ClusterController(wsgi.Controller):
params = {'identity': cid}
params.update(data)
obj = util.parse_request('ClusterAttachPolicyRequest', req, params)
return self.rpc_client.call2(req.context,
'cluster_policy_attach', obj)
return self.rpc_client.call(req.context,
'cluster_policy_attach', obj)
def _do_policy_detach(self, req, cid, data):
if not isinstance(data, dict):
@ -195,8 +195,8 @@ class ClusterController(wsgi.Controller):
params.update(data)
obj = util.parse_request('ClusterDetachPolicyRequest', req, params)
return self.rpc_client.call2(req.context,
'cluster_policy_detach', obj)
return self.rpc_client.call(req.context,
'cluster_policy_detach', obj)
def _do_policy_update(self, req, cid, data):
if not isinstance(data, dict):
@ -206,18 +206,18 @@ class ClusterController(wsgi.Controller):
params.update(data)
obj = util.parse_request('ClusterUpdatePolicyRequest', req, params)
return self.rpc_client.call2(req.context,
'cluster_policy_update', obj)
return self.rpc_client.call(req.context,
'cluster_policy_update', obj)
def _do_check(self, req, cid, data):
params = {'identity': cid, 'params': data}
obj = util.parse_request('ClusterCheckRequest', req, params)
return self.rpc_client.call2(req.context, 'cluster_check', obj)
return self.rpc_client.call(req.context, 'cluster_check', obj)
def _do_recover(self, req, cid, data):
params = {'identity': cid, 'params': data}
obj = util.parse_request('ClusterRecoverRequest', req, params)
return self.rpc_client.call2(req.context, 'cluster_recover', obj)
return self.rpc_client.call(req.context, 'cluster_recover', obj)
@util.policy_enforce
def action(self, req, cluster_id, body=None):
@ -285,7 +285,7 @@ class ClusterController(wsgi.Controller):
'path': stripped_path,
}
obj = util.parse_request('ClusterCollectRequest', req, params)
return self.rpc_client.call2(req.context, 'cluster_collect', obj)
return self.rpc_client.call(req.context, 'cluster_collect', obj)
@wsgi.Controller.api_version('1.4')
@util.policy_enforce
@ -307,7 +307,7 @@ class ClusterController(wsgi.Controller):
}
obj = util.parse_request('ClusterOperationRequest', req, params)
res = self.rpc_client.call2(req.context, 'cluster_op', obj)
res = self.rpc_client.call(req.context, 'cluster_op', obj)
location = {'location': '/actions/%s' % res['action']}
res.update(location)
@ -317,7 +317,7 @@ class ClusterController(wsgi.Controller):
def delete(self, req, cluster_id):
params = {'identity': cluster_id}
obj = util.parse_request('ClusterDeleteRequest', req, params)
res = self.rpc_client.call2(req.context, 'cluster_delete', obj)
res = self.rpc_client.call(req.context, 'cluster_delete', obj)
action_id = res.pop('action')
result = {'location': '/actions/%s' % action_id}

View File

@ -54,7 +54,7 @@ class EventController(wsgi.Controller):
params['project_safe'] = project_safe
obj = util.parse_request('EventListRequest', req, params)
events = self.rpc_client.call2(req.context, "event_list", obj)
events = self.rpc_client.call(req.context, "event_list", obj)
return {'events': events}
@ -63,6 +63,6 @@ class EventController(wsgi.Controller):
obj = util.parse_request('EventGetRequest', req,
{'identity': event_id})
event = self.rpc_client.call2(req.context, 'event_get', obj)
event = self.rpc_client.call(req.context, 'event_get', obj)
return {'event': event}

View File

@ -54,15 +54,15 @@ class NodeController(wsgi.Controller):
params['project_safe'] = project_safe
obj = util.parse_request('NodeListRequest', req, params)
nodes = self.rpc_client.call2(req.context, 'node_list', obj)
nodes = self.rpc_client.call(req.context, 'node_list', obj)
return {'nodes': nodes}
@util.policy_enforce
def create(self, req, body):
"""Create a new node."""
obj = util.parse_request('NodeCreateRequest', req, body, 'node')
node = self.rpc_client.call2(req.context, 'node_create',
obj.node)
node = self.rpc_client.call(req.context, 'node_create',
obj.node)
action_id = node.pop('action')
result = {
'node': node,
@ -79,7 +79,7 @@ class NodeController(wsgi.Controller):
key, req.params[key])
obj = util.parse_request('NodeGetRequest', req, params)
node = self.rpc_client.call2(req.context, 'node_get', obj)
node = self.rpc_client.call(req.context, 'node_get', obj)
return {'node': node}
@util.policy_enforce
@ -92,7 +92,7 @@ class NodeController(wsgi.Controller):
params['identity'] = node_id
obj = util.parse_request('NodeUpdateRequest', req, params)
node = self.rpc_client.call2(req.context, 'node_update', obj)
node = self.rpc_client.call(req.context, 'node_update', obj)
action_id = node.pop('action')
result = {
@ -106,7 +106,7 @@ class NodeController(wsgi.Controller):
params = {'identity': node_id}
obj = util.parse_request('NodeDeleteRequest', req, params)
res = self.rpc_client.call2(req.context, 'node_delete', obj)
res = self.rpc_client.call(req.context, 'node_delete', obj)
action_id = res.pop('action')
result = {'location': '/actions/%s' % action_id}
return result
@ -148,7 +148,7 @@ class NodeController(wsgi.Controller):
}
obj = util.parse_request('NodeCheckRequest', req, kwargs)
res = self.rpc_client.call2(req.context, 'node_check', obj)
res = self.rpc_client.call(req.context, 'node_check', obj)
return res
@ -163,7 +163,7 @@ class NodeController(wsgi.Controller):
}
obj = util.parse_request('NodeRecoverRequest', req, kwargs)
res = self.rpc_client.call2(req.context, 'node_recover', obj)
res = self.rpc_client.call(req.context, 'node_recover', obj)
return res
@ -187,7 +187,7 @@ class NodeController(wsgi.Controller):
}
obj = util.parse_request('NodeOperationRequest', req, params)
node = self.rpc_client.call2(req.context, 'node_op', obj)
node = self.rpc_client.call(req.context, 'node_op', obj)
action_id = node.pop('action')
result = {

View File

@ -49,14 +49,14 @@ class PolicyController(wsgi.Controller):
unsafe = util.parse_bool_param(consts.PARAM_GLOBAL_PROJECT, is_global)
params['project_safe'] = not unsafe
obj = util.parse_request('PolicyListRequest', req, params)
policies = self.rpc_client.call2(req.context, 'policy_list', obj)
policies = self.rpc_client.call(req.context, 'policy_list', obj)
return {'policies': policies}
@util.policy_enforce
def create(self, req, body):
obj = util.parse_request('PolicyCreateRequest', req, body, 'policy')
result = self.rpc_client.call2(req.context, 'policy_create',
obj.policy)
result = self.rpc_client.call(req.context, 'policy_create',
obj.policy)
return {'policy': result}
@ -65,7 +65,7 @@ class PolicyController(wsgi.Controller):
"""Gets detailed information for a policy"""
body = {'identity': policy_id}
obj = util.parse_request('PolicyGetRequest', req, body)
policy = self.rpc_client.call2(req.context, 'policy_get', obj)
policy = self.rpc_client.call(req.context, 'policy_get', obj)
return {'policy': policy}
@ -80,7 +80,7 @@ class PolicyController(wsgi.Controller):
obj = util.parse_request('PolicyUpdateRequest', req,
{'identity': policy_id,
'policy': body_req})
policy = self.rpc_client.call2(req.context, 'policy_update', obj)
policy = self.rpc_client.call(req.context, 'policy_update', obj)
return {'policy': policy}
@ -88,7 +88,7 @@ class PolicyController(wsgi.Controller):
def delete(self, req, policy_id):
body = {'identity': policy_id}
obj = util.parse_request('PolicyDeleteRequest', req, body)
self.rpc_client.call2(req.context, 'policy_delete', obj)
self.rpc_client.call(req.context, 'policy_delete', obj)
raise exc.HTTPNoContent()
@wsgi.Controller.api_version('1.2')
@ -97,7 +97,7 @@ class PolicyController(wsgi.Controller):
"""Validate the policy spec user specified."""
obj = util.parse_request('PolicyValidateRequest', req, body,
'policy')
result = self.rpc_client.call2(req.context, 'policy_validate',
obj.policy)
result = self.rpc_client.call(req.context, 'policy_validate',
obj.policy)
return {'policy': result}

View File

@ -29,7 +29,7 @@ class PolicyTypeController(wsgi.Controller):
"""Gets the supported policy types"""
obj = util.parse_request('PolicyTypeListRequest', req, {})
types = self.rpc_client.call2(req.context, 'policy_type_list', obj)
types = self.rpc_client.call(req.context, 'policy_type_list', obj)
return {'policy_types': types}
@util.policy_enforce
@ -38,5 +38,5 @@ class PolicyTypeController(wsgi.Controller):
obj = util.parse_request(
'PolicyTypeGetRequest', req, {'type_name': type_name})
content = self.rpc_client.call2(req.context, 'policy_type_get', obj)
content = self.rpc_client.call(req.context, 'policy_type_get', obj)
return {'policy_type': content}

View File

@ -28,7 +28,7 @@ class ProfileTypeController(wsgi.Controller):
def index(self, req):
obj = util.parse_request('ProfileTypeListRequest', req, {})
types = self.rpc_client.call2(req.context, 'profile_type_list', obj)
types = self.rpc_client.call(req.context, 'profile_type_list', obj)
return {'profile_types': types}
@util.policy_enforce
@ -37,7 +37,7 @@ class ProfileTypeController(wsgi.Controller):
obj = util.parse_request(
'ProfileTypeGetRequest', req, {'type_name': type_name})
content = self.rpc_client.call2(req.context, 'profile_type_get', obj)
content = self.rpc_client.call(req.context, 'profile_type_get', obj)
return {'profile_type': content}
@wsgi.Controller.api_version('1.4')
@ -47,4 +47,4 @@ class ProfileTypeController(wsgi.Controller):
obj = util.parse_request(
'ProfileTypeOpListRequest', req, {'type_name': type_name})
return self.rpc_client.call2(req.context, 'profile_type_ops', obj)
return self.rpc_client.call(req.context, 'profile_type_ops', obj)

View File

@ -51,14 +51,14 @@ class ProfileController(wsgi.Controller):
params['project_safe'] = project_safe
obj = util.parse_request('ProfileListRequest', req, params)
profiles = self.rpc_client.call2(req.context, 'profile_list', obj)
profiles = self.rpc_client.call(req.context, 'profile_list', obj)
return {'profiles': profiles}
@util.policy_enforce
def create(self, req, body):
obj = util.parse_request('ProfileCreateRequest', req, body, 'profile')
result = self.rpc_client.call2(req.context, 'profile_create', obj)
result = self.rpc_client.call(req.context, 'profile_create', obj)
return {'profile': result}
@wsgi.Controller.api_version('1.2')
@ -67,7 +67,7 @@ class ProfileController(wsgi.Controller):
obj = util.parse_request(
'ProfileValidateRequest', req, body, 'profile')
result = self.rpc_client.call2(req.context, 'profile_validate', obj)
result = self.rpc_client.call(req.context, 'profile_validate', obj)
return {'profile': result}
@util.policy_enforce
@ -75,7 +75,7 @@ class ProfileController(wsgi.Controller):
params = {'identity': profile_id}
obj = util.parse_request('ProfileGetRequest', req, params)
profile = self.rpc_client.call2(req.context, 'profile_get', obj)
profile = self.rpc_client.call(req.context, 'profile_get', obj)
return {'profile': profile}
@util.policy_enforce
@ -91,7 +91,7 @@ class ProfileController(wsgi.Controller):
'ProfileUpdateRequest', req, {'identity': profile_id,
'profile': body_req})
profile = self.rpc_client.call2(req.context, 'profile_update', obj)
profile = self.rpc_client.call(req.context, 'profile_update', obj)
return {'profile': profile}
@util.policy_enforce
@ -99,5 +99,5 @@ class ProfileController(wsgi.Controller):
obj = util.parse_request(
'ProfileDeleteRequest', req, {'identity': profile_id})
self.rpc_client.call2(req.context, 'profile_delete', obj)
self.rpc_client.call(req.context, 'profile_delete', obj)
raise exc.HTTPNoContent()

View File

@ -51,7 +51,7 @@ class ReceiverController(wsgi.Controller):
params['project_safe'] = project_safe
obj = util.parse_request('ReceiverListRequest', req, params)
receivers = self.rpc_client.call2(req.context, 'receiver_list', obj)
receivers = self.rpc_client.call(req.context, 'receiver_list', obj)
return {'receivers': receivers}
@ -60,8 +60,8 @@ class ReceiverController(wsgi.Controller):
obj = util.parse_request(
'ReceiverCreateRequest', req, body, 'receiver')
result = self.rpc_client.call2(req.context, 'receiver_create',
obj.receiver)
result = self.rpc_client.call(req.context, 'receiver_create',
obj.receiver)
return {'receiver': result}
@ -69,7 +69,7 @@ class ReceiverController(wsgi.Controller):
def get(self, req, receiver_id):
obj = util.parse_request(
'ReceiverGetRequest', req, {'identity': receiver_id})
receiver = self.rpc_client.call2(req.context, 'receiver_get', obj)
receiver = self.rpc_client.call(req.context, 'receiver_get', obj)
return {'receiver': receiver}
@util.policy_enforce
@ -77,7 +77,7 @@ class ReceiverController(wsgi.Controller):
obj = util.parse_request(
'ReceiverDeleteRequest', req, {'identity': receiver_id})
self.rpc_client.call2(req.context, 'receiver_delete', obj)
self.rpc_client.call(req.context, 'receiver_delete', obj)
raise exc.HTTPNoContent()
@util.policy_enforce
@ -85,5 +85,5 @@ class ReceiverController(wsgi.Controller):
obj = util.parse_request(
'ReceiverNotifyRequest', req, {'identity': receiver_id})
self.rpc_client.call2(req.context, 'receiver_notify', obj)
self.rpc_client.call(req.context, 'receiver_notify', obj)
raise exc.HTTPNoContent()

View File

@ -35,7 +35,7 @@ class WebhookController(wsgi.Controller):
'WebhookTriggerRequest', req, {'identity': webhook_id,
'body': body})
res = self.rpc_client.call2(req.context, 'webhook_trigger', obj)
res = self.rpc_client.call(req.context, 'webhook_trigger', obj)
location = {'location': '/actions/%s' % res['action']}
res.update(location)
return res

View File

@ -132,7 +132,7 @@ class HealthManager(service.Service):
:returns: Nothing.
"""
req = vorc.ClusterCheckRequest(identity=cluster_id)
self.rpc_client.call2(self.ctx, 'cluster_check', req)
self.rpc_client.call(self.ctx, 'cluster_check', req)
def _add_listener(self, cluster_id):
"""Routine to be executed for adding cluster listener.

View File

@ -43,7 +43,7 @@ class EngineClient(object):
def make_msg(method, **kwargs):
return method, kwargs
def call2(self, ctxt, method, req, version=None):
def call(self, ctxt, method, req, version=None):
"""The main entry for invoking engine service.
:param ctxt: The request context object.

View File

@ -34,16 +34,16 @@ class TestTrustMiddleware(base.SenlinTestCase):
def test__get_trust_already_exists(self, mock_rpc):
x_cred = {'trust': 'FAKE_TRUST_ID'}
x_rpc = mock.Mock()
x_rpc.call2.return_value = x_cred
x_rpc.call.return_value = x_cred
mock_rpc.return_value = x_rpc
result = self.middleware._get_trust(self.req)
self.assertEqual('FAKE_TRUST_ID', result)
mock_rpc.assert_called_once_with()
x_rpc.call2.assert_called_once_with(self.context, 'credential_get',
mock.ANY)
request = x_rpc.call2.call_args[0][2]
x_rpc.call.assert_called_once_with(self.context, 'credential_get',
mock.ANY)
request = x_rpc.call.call_args[0][2]
self.assertIsInstance(request, vorc.CredentialGetRequest)
self.assertEqual(self.context.user, request.user)
self.assertEqual(self.context.project, request.project)
@ -54,7 +54,7 @@ class TestTrustMiddleware(base.SenlinTestCase):
def test__get_trust_bad(self, mock_rpc, mock_driver, mock_context):
x_cred = {'foo': 'bar'}
x_rpc = mock.Mock()
x_rpc.call2.return_value = x_cred
x_rpc.call.return_value = x_cred
mock_rpc.return_value = x_rpc
x_svc_cred = {'uid': 'FAKE_ID', 'passwd': 'FAKE_PASS'}
@ -72,12 +72,12 @@ class TestTrustMiddleware(base.SenlinTestCase):
self.assertEqual('FAKE_TRUST_ID', result)
mock_calls = [mock.call(self.context, 'credential_get', mock.ANY),
mock.call(self.context, 'credential_create', mock.ANY)]
x_rpc.call2.assert_has_calls(mock_calls)
request = x_rpc.call2.call_args_list[0][0][2]
x_rpc.call.assert_has_calls(mock_calls)
request = x_rpc.call.call_args_list[0][0][2]
self.assertIsInstance(request, vorc.CredentialGetRequest)
self.assertEqual(self.context.user, request.user)
self.assertEqual(self.context.project, request.project)
request = x_rpc.call2.call_args_list[1][0][2]
request = x_rpc.call.call_args_list[1][0][2]
self.assertIsInstance(request, vorc.CredentialCreateRequest)
expected_cred = {
'openstack': {'trust': 'FAKE_TRUST_ID'}
@ -101,7 +101,7 @@ class TestTrustMiddleware(base.SenlinTestCase):
@mock.patch("senlin.rpc.client.EngineClient")
def test__get_trust_not_found(self, mock_rpc, mock_driver, mock_context):
x_rpc = mock.Mock()
x_rpc.call2.return_value = None
x_rpc.call.return_value = None
mock_rpc.return_value = x_rpc
x_svc_cred = {'uid': 'FAKE_ID', 'passwd': 'FAKE_PASS'}
@ -119,7 +119,7 @@ class TestTrustMiddleware(base.SenlinTestCase):
self.assertEqual('FAKE_TRUST_ID', result)
mock_calls = [mock.call(self.context, 'credential_get', mock.ANY),
mock.call(self.context, 'credential_create', mock.ANY)]
x_rpc.call2.assert_has_calls(mock_calls)
x_rpc.call.assert_has_calls(mock_calls)
mock_rpc.assert_called_once_with()
mock_driver.assert_called_once_with()
x_driver.identity.assert_called_once_with({
@ -139,7 +139,7 @@ class TestTrustMiddleware(base.SenlinTestCase):
@mock.patch("senlin.rpc.client.EngineClient")
def test__get_trust_do_create(self, mock_rpc, mock_driver, mock_context):
x_rpc = mock.Mock()
x_rpc.call2.return_value = None
x_rpc.call.return_value = None
mock_rpc.return_value = x_rpc
x_svc_cred = {'uid': 'FAKE_ID', 'passwd': 'FAKE_PASS'}
@ -159,7 +159,7 @@ class TestTrustMiddleware(base.SenlinTestCase):
self.assertEqual('FAKE_TRUST_ID', result)
mock_calls = [mock.call(self.context, 'credential_get', mock.ANY),
mock.call(self.context, 'credential_create', mock.ANY)]
x_rpc.call2.assert_has_calls(mock_calls)
x_rpc.call.assert_has_calls(mock_calls)
mock_driver.assert_called_once_with()
x_driver.identity.assert_called_once_with({
'auth_url': self.context.auth_url,
@ -181,7 +181,7 @@ class TestTrustMiddleware(base.SenlinTestCase):
@mock.patch("senlin.rpc.client.EngineClient")
def test__get_trust_fatal(self, mock_rpc, mock_driver, mock_context):
x_rpc = mock.Mock()
x_rpc.call2.return_value = None
x_rpc.call.return_value = None
mock_rpc.return_value = x_rpc
x_svc_cred = {'uid': 'FAKE_ID', 'passwd': 'FAKE_PASS'}
@ -201,8 +201,8 @@ class TestTrustMiddleware(base.SenlinTestCase):
self.assertEqual('Boom', six.text_type(ex))
mock_rpc.assert_called_once_with()
x_rpc.call2.assert_called_once_with(self.context, 'credential_get',
mock.ANY)
x_rpc.call.assert_called_once_with(self.context, 'credential_get',
mock.ANY)
mock_driver.assert_called_once_with()
x_driver.identity.assert_called_once_with({
'auth_url': self.context.auth_url,

View File

@ -131,7 +131,7 @@ class TestWebhookMiddleware(base.SenlinTestCase):
'id': 'FAKE_ID',
'actor': {'foo': 'bar'}
}
rpcc.call2.return_value = fake_receiver
rpcc.call.return_value = fake_receiver
mock_client.return_value = rpcc
dbctx = mock.Mock()
mock_ctx.return_value = dbctx
@ -149,8 +149,8 @@ class TestWebhookMiddleware(base.SenlinTestCase):
mock_token.assert_called_once_with(
auth_url='AUTH_URL', password='PASSWORD', username='USERNAME',
user_domain_name='DOMAIN', foo='bar')
rpcc.call2.assert_called_with(dbctx, 'receiver_get', mock.ANY)
request = rpcc.call2.call_args[0][2]
rpcc.call.assert_called_with(dbctx, 'receiver_get', mock.ANY)
request = rpcc.call.call_args[0][2]
self.assertIsInstance(request, vorr.ReceiverGetRequest)
self.assertEqual('WEBHOOK', request.identity)

View File

@ -39,7 +39,7 @@ class ActionControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.controller = actions.ActionController(options=cfgopts)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_action_index(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
req = self._get('/actions')
@ -78,7 +78,7 @@ class ActionControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'action_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_action_index_whitelists_params(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -114,7 +114,7 @@ class ActionControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'action_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_action_index_whitelists_invalid_params(self, mock_call,
mock_parse,
mock_enforce):
@ -132,7 +132,7 @@ class ActionControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_action_index_with_bad_schema(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -150,7 +150,7 @@ class ActionControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_action_index_limit_not_int(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -167,7 +167,7 @@ class ActionControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_action_index_global_project_true(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -187,7 +187,7 @@ class ActionControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'action_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_action_index_global_project_false(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -210,7 +210,7 @@ class ActionControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'action_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_action_index_global_project_not_bool(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -236,7 +236,7 @@ class ActionControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_action_get_success(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
action_id = 'aaaa-bbbb-cccc'
@ -275,7 +275,7 @@ class ActionControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'action_get', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_action_get_not_found(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)

View File

@ -29,7 +29,7 @@ class BuildInfoControllerTest(shared.ControllerTest, base.SenlinTestCase):
super(BuildInfoControllerTest, self).setUp()
self.controller = build_info.BuildInfoController({})
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_default_build_revision(self, mock_call, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'build_info', True)
req = self._get('/build_info')
@ -51,7 +51,7 @@ class BuildInfoControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIsInstance(request, vorb.GetRevisionRequest)
@mock.patch.object(build_info.cfg, 'CONF')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_response_api_build_revision_from_config_file(
self, mock_call, mock_conf, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'build_info', True)

View File

@ -39,7 +39,7 @@ class ClusterPolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.controller = cp_mod.ClusterPolicyController(options=cfgopts)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_cluster_policy_index(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
cid = 'test_cluster'
@ -71,7 +71,7 @@ class ClusterPolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_policy_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_cluster_policy_index_with_params(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -99,7 +99,7 @@ class ClusterPolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_policy_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_cluster_policy_index_invalid_params(self, mock_call,
mock_parse,
mock_enforce):
@ -119,7 +119,7 @@ class ClusterPolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(0, mock_call.call_count)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_cluster_policy_index_invalid_sort(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -152,7 +152,7 @@ class ClusterPolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_cluster_policy_get_success(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
@ -189,7 +189,7 @@ class ClusterPolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_policy_get', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_cluster_policy_get_not_found(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
@ -234,7 +234,7 @@ class ClusterPolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_action_get_bad_params(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)

View File

@ -45,7 +45,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.context = utils.dummy_context()
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_index(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
req = self._get('/clusters')
@ -65,7 +65,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'cluster_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_index_with_params(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
fake_id = uuidutils.generate_uuid()
@ -101,7 +101,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'cluster_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_index_failed_with_exception(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -117,7 +117,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(0, mock_call.call_count)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_index_failed_engine_error(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -150,7 +150,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_create(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
body = {
@ -190,7 +190,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
obj.cluster)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_create_failed_request(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
body = {'foo': 'bar'}
@ -205,7 +205,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(0, mock_call.call_count)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_create_failed_engine(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
body = {'foo': 'bar'}
@ -244,7 +244,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_get(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
cid = 'cid'
@ -262,7 +262,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'cluster_get', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_get_failed_request(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
cid = 'FAKE_ID'
@ -278,7 +278,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(0, mock_call.call_count)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_get_failed_engine(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
cid = 'non-existent-cluster'
@ -309,7 +309,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_update(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
cid = 'aaaa-bbbb-cccc'
@ -338,7 +338,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
cid = 'aaaa-bbbb-cccc'
body = {'profile_id': 'xxxx-yyyy-zzzz'}
req = self._patch('/clusters/%s' % cid, jsonutils.dumps(body))
mock_call = self.patchobject(rpc_client.EngineClient, 'call2')
mock_call = self.patchobject(rpc_client.EngineClient, 'call')
ex = self.assertRaises(exc.HTTPBadRequest,
self.controller.update,
@ -349,7 +349,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_update_failed_request(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
cid = 'aaaa-bbbb-cccc'
@ -368,7 +368,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_update_engine_error(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
cid = 'non-existent-cluster'
@ -406,7 +406,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__add_nodes(self, mock_call, mock_parse, mock_enforce):
req = mock.Mock()
cid = 'FAKE_ID'
@ -424,7 +424,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_add_nodes', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__add_nodes_failed_request(self, mock_call, mock_parse, _ignore):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -441,7 +441,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__add_nodes_failed_engine(self, mock_call, mock_parse, _ignore):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -461,7 +461,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_add_nodes', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__del_nodes(self, mock_call, mock_parse, _ignore):
req = mock.Mock()
cid = 'FAKE_ID'
@ -479,7 +479,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_del_nodes', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__del_nodes_failed_request(self, mock_call, mock_parse, _ignore):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -496,7 +496,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__del_nodes_failed_engine(self, mock_call, mock_parse, _ignore):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -516,7 +516,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_del_nodes', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__replace_nodes(self, mock_call, mock_parse, _ignore):
req = mock.Mock()
cid = 'FAKE_ID'
@ -535,7 +535,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_replace_nodes', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__replace_nodes_none(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -549,7 +549,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__replace_nodes_not_map(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -563,7 +563,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__replace_nodes_failed_request(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -581,7 +581,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__replace_nodes_failed_engine(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -602,7 +602,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_replace_nodes', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def _test_resize_with_type(self, adj_type, mock_call, mock_parse):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -638,7 +638,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self._test_resize_with_type('CHANGE_IN_PERCENTAGE')
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_resize_failed_request(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -660,7 +660,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_resize_missing_number(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -676,7 +676,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(0, mock_call.call_count)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_resize_missing_type(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -693,7 +693,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(0, mock_call.call_count)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_resize_max_size_too_small(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -710,7 +710,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(0, mock_call.call_count)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_resize_failed_engine(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -730,7 +730,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_resize', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_scale_out(self, mock_call, mock_parse, _ignore):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -748,7 +748,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_scale_out', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_scale_out_failed_request(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -765,7 +765,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_scale_out_failed_engine(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -785,7 +785,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_scale_out', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_scale_in(self, mock_call, mock_parse, _ignore):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -803,7 +803,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_scale_in', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_scale_in_failed_request(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -820,7 +820,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_scale_in_failed_engine(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -840,7 +840,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_scale_in', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_policy_attach(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -859,7 +859,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_policy_attach', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_policy_attach_not_map(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -874,7 +874,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(0, mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_policy_attach_failed_request(self, mock_call, mock_parse, _i):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -892,7 +892,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_policy_attach_failed_engine(self, mock_call, mock_parse, _i):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -913,7 +913,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_policy_attach', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_policy_detach(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -932,7 +932,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_policy_detach', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_policy_detach_not_map(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -947,7 +947,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(0, mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_policy_detach_failed_request(self, mock_call, mock_parse, _i):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -965,7 +965,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_policy_detach_failed_engine(self, mock_call, mock_parse, _i):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -986,7 +986,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_policy_detach', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_policy_update(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -1005,7 +1005,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_policy_update', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_policy_update_not_map(self, mock_call, mock_parse, _ign):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -1020,7 +1020,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(0, mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_policy_update_failed_request(self, mock_call, mock_parse, _i):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -1038,7 +1038,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_policy_update_failed_engine(self, mock_call, mock_parse, _i):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -1059,7 +1059,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_policy_update', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_check(self, mock_call, mock_parse, _ignore):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -1078,7 +1078,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'cluster_check', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_check_failed_request(self, mock_call, mock_parse, _ign):
cid = 'fake-cluster'
data = {}
@ -1096,7 +1096,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_check_failed_engine(self, mock_call, mock_parse, _i):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -1116,7 +1116,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'cluster_check', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_recover(self, mock_call, mock_parse, _ignore):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -1135,7 +1135,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'cluster_recover', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_recover_failed_request(self, mock_call, mock_parse, _ign):
cid = 'fake-cluster'
data = {}
@ -1153,7 +1153,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__do_recover_failed_engine(self, mock_call, mock_parse, _i):
req = mock.Mock()
cid = 'aaaa-bbbb-cccc'
@ -1178,7 +1178,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
body = {}
req = self._post('/clusters/%s/actions' % cid, jsonutils.dumps(body))
mock_call = self.patchobject(rpc_client.EngineClient, 'call2')
mock_call = self.patchobject(rpc_client.EngineClient, 'call')
ex = self.assertRaises(exc.HTTPBadRequest,
self.controller.action,
req, cluster_id=cid, body=body)
@ -1191,7 +1191,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
body = {'action_1': {}, 'action_2': {}}
req = self._post('/clusters/%s/actions' % cid, jsonutils.dumps(body))
mock_call = self.patchobject(rpc_client.EngineClient, 'call2')
mock_call = self.patchobject(rpc_client.EngineClient, 'call')
ex = self.assertRaises(exc.HTTPBadRequest,
self.controller.action,
req, cluster_id=cid, body=body)
@ -1204,7 +1204,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
body = {'fly': None}
req = self._post('/clusters/%s/actions' % cid, jsonutils.dumps(body))
mock_call = self.patchobject(rpc_client.EngineClient, 'call2')
mock_call = self.patchobject(rpc_client.EngineClient, 'call')
ex = self.assertRaises(exc.HTTPBadRequest,
self.controller.action,
req, cluster_id=cid, body=body)
@ -1227,7 +1227,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_collect(self, mock_call, mock_parse, mock_enforce):
req = mock.Mock(context=self.context)
cid = 'aaaa-bbbb-cccc'
@ -1242,7 +1242,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(eng_resp, resp)
mock_call.assert_called_once_with(req.context, 'cluster_collect', obj)
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_collect_version_mismatch(self, mock_call, mock_enforce):
# NOTE: we skip the mock_enforce setup below because api version check
# comes before the policy enforcement and the check fails in
@ -1260,7 +1260,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual('API version 1.1 is not supported on this method.',
six.text_type(ex))
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_collect_path_not_provided(self, mock_call, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'collect', True)
req = mock.Mock(context=self.context)
@ -1277,7 +1277,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
six.text_type(ex))
self.assertEqual(0, mock_call.call_count)
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_collect_path_is_none(self, mock_call, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'collect', True)
req = mock.Mock(context=self.context)
@ -1295,7 +1295,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(0, mock_call.call_count)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_collect_failed_request(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'collect', True)
req = mock.Mock(context=self.context)
@ -1313,7 +1313,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_collect_failed_engine(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'collect', True)
req = mock.Mock(context=self.context)
@ -1339,7 +1339,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
path = 'foo.bar'
req = self._get('/clusters/%(cid)s/attrs/%(path)s' %
{'cid': cid, 'path': path}, version='1.2')
mock_call = self.patchobject(rpc_client.EngineClient, 'call2')
mock_call = self.patchobject(rpc_client.EngineClient, 'call')
resp = shared.request_with_middleware(fault.FaultWrapper,
self.controller.collect,
@ -1350,7 +1350,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(0, mock_call.call_count)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_operation(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'operation', True)
cid = 'aaaa-bbbb-cccc'
@ -1376,7 +1376,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(eng_resp, resp)
mock_call.assert_called_once_with(req.context, 'cluster_op', obj)
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_operation_version_mismatch(self, mock_call, mock_enforce):
cid = 'aaaa-bbbb-cccc'
body = {'dance': {}}
@ -1431,7 +1431,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_delete(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'delete', True)
req = mock.Mock(context=self.context)
@ -1450,7 +1450,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_with(req.context, 'cluster_delete', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_delete_failed_request(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'delete', True)
cid = 'fake-cluster'
@ -1467,7 +1467,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_delete_failed_engine(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'delete', True)
req = mock.Mock(context=self.context)

View File

@ -39,7 +39,7 @@ class EventControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.controller = events.EventController(options=cfgopts)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_event_index(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
req = self._get('/events')
@ -76,7 +76,7 @@ class EventControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'event_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_event_index_whitelists_params(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -117,7 +117,7 @@ class EventControllerTest(shared.ControllerTest, base.SenlinTestCase):
'event_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_event_index_whitelists_invalid_params(self, mock_call,
mock_parse,
mock_enforce):
@ -135,7 +135,7 @@ class EventControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_event_index_with_bad_schema(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -153,7 +153,7 @@ class EventControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(0, mock_call.call_count)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_event_index_limit_not_int(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -170,7 +170,7 @@ class EventControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_event_index_global_project_true(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -193,7 +193,7 @@ class EventControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'event_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_events_index_global_project_false(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -212,7 +212,7 @@ class EventControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'event_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_event_index_global_project_not_bool(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -238,7 +238,7 @@ class EventControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_event_get_success(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
event_id = "2d255b9c-8f36-41a2-a137-c0175ccc29c3"
@ -272,7 +272,7 @@ class EventControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'event_get', mock.ANY)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_event_get_not_found(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
event_id = 'non-existent-event'

View File

@ -39,7 +39,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.controller = nodes.NodeController(options=cfgopts)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_index(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
req = self._get('/nodes')
@ -77,7 +77,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'node_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_index_whitelists_params(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -115,7 +115,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'node_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_index_whitelists_invalid_params(self, mock_call,
mock_parse,
mock_enforce):
@ -134,7 +134,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_parse.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_index_global_project_true(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -157,7 +157,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'node_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_index_global_project_false(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -177,7 +177,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'node_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_index_global_project_not_bool(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -193,7 +193,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_index_limit_not_int(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -211,7 +211,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_index_cluster_not_found(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -247,7 +247,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_create_success(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -288,7 +288,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'node_create', mock.ANY)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_create_with_bad_body(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -306,7 +306,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_create_with_missing_profile_id(self, mock_call,
mock_parse,
mock_enforce):
@ -329,7 +329,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_create_with_missing_name(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -351,7 +351,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_create_with_bad_profile(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -380,7 +380,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'node_create', mock.ANY)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_create_with_bad_cluster(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -410,7 +410,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'node_create', mock.ANY)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_get_success(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
node_id = 'aaaa-bbbb-cccc'
@ -447,7 +447,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'node_get', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_get_show_details_not_bool(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
@ -466,7 +466,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_get_not_found(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
@ -500,7 +500,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_update_success(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -544,7 +544,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(result, res)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_update_malformed_request(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -563,7 +563,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_update_not_found(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -595,7 +595,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(msg, resp.json['error']['message'])
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_update_invalid_profile(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -628,7 +628,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(msg, resp.json['error']['message'])
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_update_cluster_id_specified(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -670,7 +670,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_delete_success(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'delete', True)
nid = 'aaaa-bbbb-cccc'
@ -689,7 +689,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'node_delete', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_delete_err_malformed_node_id(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'delete', True)
@ -718,7 +718,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_delete_not_found(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'delete', True)
@ -736,7 +736,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual('ResourceNotFound', resp.json['error']['type'])
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_action_check_success(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'action', True)
@ -762,7 +762,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'node_check', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_action_check_node_not_found(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'action', True)
@ -782,7 +782,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual('ResourceNotFound', resp.json['error']['type'])
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_action_recover_success(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'action', True)
@ -808,7 +808,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'node_recover', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_action_recover_node_not_found(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'action', True)
@ -828,7 +828,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual('ResourceNotFound', resp.json['error']['type'])
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_action_invalid_params(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'action', True)
@ -846,7 +846,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_action_missing_action(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'action', True)
@ -865,7 +865,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('No action specified.', six.text_type(ex))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_action_multiple_action(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'action', True)
@ -884,7 +884,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('Multiple actions specified.', six.text_type(ex))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_action_unknown_action(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'action', True)
@ -904,7 +904,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
six.text_type(ex))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_node_operation(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'operation', True)
node_id = 'xxxx-yyyy'

View File

@ -40,7 +40,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.controller = policies.PolicyController(options=cfgopts)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_index_normal(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -75,7 +75,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock.ANY)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_index_whitelists_params(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -114,7 +114,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock.ANY)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_index_whitelist_bad_params(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -131,7 +131,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(0, mock_parse.call_count)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_index_invalid_param(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -163,7 +163,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_create_success(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -208,7 +208,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock.ANY)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_create_no_policy(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -224,7 +224,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_create_bad_policy(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -240,7 +240,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_create_with_spec_validation_failed(self, mock_call,
mock_parse,
mock_enforce):
@ -292,7 +292,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_get_normal(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
@ -313,7 +313,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock.ANY)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_get_not_found(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
@ -345,7 +345,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_update_normal(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -388,7 +388,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock.ANY)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_update_with_no_name(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -409,7 +409,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_update_with_bad_body(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -428,7 +428,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_parse.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_update_with_unsupported_field(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -454,7 +454,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_update_not_found(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -496,7 +496,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_delete_success(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'delete', True)
@ -514,7 +514,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'policy_delete', mock.ANY)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_delete_not_found(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'delete', True)
@ -544,7 +544,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(403, resp.status_int)
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_validate_version_mismatch(self, mock_call, mock_enforce):
body = {
'policy': {}
@ -589,7 +589,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_validate_no_body(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'validate', True)
@ -606,7 +606,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_validate_no_spec(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'validate', True)
@ -626,7 +626,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_validate_invalide_spec(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'validate', True)
@ -656,7 +656,7 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual('InvalidSpec', resp.json['error']['type'])
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_validate_success(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'validate', True)

View File

@ -36,7 +36,7 @@ class PolicyTypeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.controller = policy_types.PolicyTypeController(options=cfgopts)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_type_list(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
req = self._get('/policy_types')
@ -67,7 +67,7 @@ class PolicyTypeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_type_get(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
type_name = 'SimplePolicy'
@ -94,7 +94,7 @@ class PolicyTypeControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'policy_type_get', mock.ANY)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_type_get_not_found(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
@ -111,7 +111,7 @@ class PolicyTypeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual('ResourceNotFound', resp.json['error']['type'])
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_policy_type_get_bad_param(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)

View File

@ -36,7 +36,7 @@ class ProfileTypeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.controller = profile_types.ProfileTypeController(options=cfgopts)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_type_list(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
req = self._get('/profile_types')
@ -66,7 +66,7 @@ class ProfileTypeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_type_get(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
type_name = 'SimpleProfile'
@ -93,7 +93,7 @@ class ProfileTypeControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'profile_type_get', mock.ANY)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_type_get_with_bad_param(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
@ -112,7 +112,7 @@ class ProfileTypeControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_not_called()
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_type_get_not_found(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
@ -146,7 +146,7 @@ class ProfileTypeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_type_ops(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'ops', True)
type_name = 'SimpleProfile'
@ -172,7 +172,7 @@ class ProfileTypeControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'profile_type_ops', mock.ANY)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_type_ops_with_bad_param(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'ops', True)
@ -191,7 +191,7 @@ class ProfileTypeControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_not_called()
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_type_ops_not_found(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'ops', True)
@ -214,7 +214,7 @@ class ProfileTypeControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(
req.context, 'profile_type_ops', mock.ANY)
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_type_ops_version_mismatch(self, mock_call, mock_enforce):
type_name = 'fake'
req = self._get('/profile_types/%(type)s/ops' % {'type': type_name},

View File

@ -39,7 +39,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.controller = profiles.ProfileController(options=cfgopts)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_index_normal(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -72,7 +72,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'profile_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_index_whitelists_params(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -107,7 +107,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'profile_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_index_whitelist_bad_params(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -123,7 +123,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_index_global_project_not_bool(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -139,7 +139,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_index_limit_non_int(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -167,7 +167,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_create_success(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -215,7 +215,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'profile_create', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_create_with_no_profile(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -234,7 +234,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_create_with_profile_no_spec(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -252,7 +252,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_create_with_bad_type(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -287,7 +287,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'profile_create', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_create_with_spec_validation_failed(self, mock_call,
mock_parse,
mock_enforce):
@ -343,7 +343,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_get_normal(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
pid = 'aaaa-bbbb-cccc'
@ -375,7 +375,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'profile_get', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_get_not_found(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
@ -412,7 +412,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_update_normal(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -451,7 +451,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'profile_update', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_update_no_body(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -471,7 +471,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_update_no_name(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -496,7 +496,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'profile_update', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_update_with_unexpected_field(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -522,7 +522,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_update_not_found(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'update', True)
@ -565,7 +565,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_delete_success(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'delete', True)
@ -583,7 +583,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'profile_delete', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_delete_not_found(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'delete', True)
@ -608,7 +608,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'profile_delete', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_delete_resource_in_use(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'delete', True)
@ -639,7 +639,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_validate_version_mismatch(self, mock_call, mock_parse,
mock_enforce):
body = {
@ -686,7 +686,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_validate_no_body(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'validate', True)
@ -705,7 +705,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_validate_no_spec(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'validate', True)
@ -725,7 +725,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_validate_unsupported_field(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'validate', True)
@ -749,7 +749,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_validate_invalide_spec(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'validate', True)
@ -779,7 +779,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual('InvalidSpec', resp.json['error']['type'])
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_profile_validate_success(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'validate', True)

View File

@ -38,7 +38,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.controller = receivers.ReceiverController(options=cfgopts)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_index_normal(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
req = self._get('/receivers')
@ -77,7 +77,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_with(req.context, 'receiver_list', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_index_whitelists_params(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -115,7 +115,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_with(req.context, 'receiver_list', mock.ANY)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_index_whitelists_invalid_params(self, mock_call,
mock_parse,
mock_enforce):
@ -133,7 +133,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_index_invalid_type(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -154,7 +154,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_index_invalid_action(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -176,7 +176,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_index_limit_non_int(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -198,7 +198,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_index_invalid_sort(self, mock_call,
mock_parse, mock_enforce):
@ -221,7 +221,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_index_global_project(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'index', True)
@ -251,7 +251,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_create_success(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -303,7 +303,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'receiver_create', obj.receiver)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_create_with_bad_body(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -322,7 +322,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_create_missing_required_field(self, mock_call,
mock_parse,
mock_enforce):
@ -348,7 +348,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_create_with_bad_type(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -375,7 +375,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_create_illegal_action(self, mock_call,
mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'create', True)
@ -401,7 +401,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_get_normal(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
wid = 'aaaa-bbbb-cccc'
@ -439,7 +439,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_with(req.context, 'receiver_get', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_get_not_found(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'get', True)
@ -469,7 +469,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_delete_success(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'delete', True)
@ -487,7 +487,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'receiver_delete', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_delete_err_malformed_receiver_id(self, mock_call,
mock_parse,
mock_enforce):
@ -505,7 +505,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_delete_not_found(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'delete', True)
@ -535,7 +535,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertIn('403 Forbidden', six.text_type(resp))
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_notify_success(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'notify')
@ -553,7 +553,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_with(req.context, 'receiver_notify', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_notify_err_malformed_receiver_id(self, mock_call,
mock_parse,
mock_enforce):
@ -572,7 +572,7 @@ class ReceiverControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_receiver_notify_not_found(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'notify', True)

View File

@ -36,7 +36,7 @@ class WebhookControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.controller = webhooks.WebhookController(options=cfgopts)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_webhook_trigger(self, mock_call, mock_parse, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'trigger', True)
body = None
@ -62,7 +62,7 @@ class WebhookControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'webhook_trigger', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_webhook_trigger_with_params(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'trigger', True)
@ -86,7 +86,7 @@ class WebhookControllerTest(shared.ControllerTest, base.SenlinTestCase):
mock_call.assert_called_once_with(req.context, 'webhook_trigger', obj)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_webhook_trigger_invalid_params(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'trigger', True)
@ -104,7 +104,7 @@ class WebhookControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_call.called)
@mock.patch.object(util, 'parse_request')
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test_webhook_trigger_invalid_json(self, mock_call, mock_parse,
mock_enforce):
self._mock_enforce_setup(mock_enforce, 'trigger', True)

View File

@ -297,7 +297,7 @@ class TestHealthManager(base.SenlinTestCase):
},
self.hm.registries[1])
@mock.patch.object(rpc_client.EngineClient, 'call2')
@mock.patch.object(rpc_client.EngineClient, 'call')
def test__poll_cluster(self, mock_check):
self.hm._poll_cluster('CLUSTER_ID')
mock_check.assert_called_once_with(self.hm.ctx, 'cluster_check',

View File

@ -33,7 +33,7 @@ class EngineRpcAPITestCase(base.SenlinTestCase):
super(EngineRpcAPITestCase, self).setUp()
@mock.patch.object(messaging, 'get_rpc_client')
def test_call2(self, mock_client):
def test_call(self, mock_client):
client = mock.Mock()
mock_client.return_value = client
@ -42,7 +42,7 @@ class EngineRpcAPITestCase(base.SenlinTestCase):
rpcapi = rpc_client.EngineClient()
# with no version
res = rpcapi.call2(self.context, method, req)
res = rpcapi.call(self.context, method, req)
self.assertEqual(client, rpcapi._client)
client.call.assert_called_once_with(self.context, 'fake_method',
@ -50,7 +50,7 @@ class EngineRpcAPITestCase(base.SenlinTestCase):
self.assertEqual(res, client.call.return_value)
@mock.patch.object(messaging, 'get_rpc_client')
def test_call2_with_version(self, mock_client):
def test_call_with_version(self, mock_client):
client = mock.Mock()
mock_client.return_value = client
@ -59,7 +59,7 @@ class EngineRpcAPITestCase(base.SenlinTestCase):
rpcapi = rpc_client.EngineClient()
# with version
res = rpcapi.call2(self.context, method, req, version='123')
res = rpcapi.call(self.context, method, req, version='123')
rpcapi._client.prepare.assert_called_once_with(version='123')
new_client = client.prepare.return_value
@ -95,7 +95,7 @@ class EngineRpcAPITestCase(base.SenlinTestCase):
def _test_engine_api(self, method, rpc_method, **kwargs):
ctxt = utils.dummy_context()
expected_retval = 'foo' if method == 'call2' else None
expected_retval = 'foo' if method == 'call' else None
kwargs.pop('version', None)
@ -114,7 +114,7 @@ class EngineRpcAPITestCase(base.SenlinTestCase):
'webhook_delete',
]
if rpc_method == 'call2' and method in cast_and_call:
if rpc_method == 'call' and method in cast_and_call:
kwargs['cast'] = False
mock_rpc_method = self.patchobject(self.rpcapi, rpc_method,