unify exceptions' message

this patch unify all exception's message which contain ().
Change all () to ''.

Change-Id: I28190c1a0317a721a26297e0b0e36dde90ab3340
This commit is contained in:
RUIJIE YUAN 2017-01-17 15:23:28 +08:00
parent 14cc2d0009
commit 5c580e4bb6
48 changed files with 266 additions and 267 deletions

View File

@ -85,22 +85,22 @@ class BadRequest(SenlinException):
class InvalidAPIVersionString(SenlinException):
msg_fmt = _("API Version String (%(version)s) is of invalid format. It "
msg_fmt = _("API Version String '%(version)s' is of invalid format. It "
"must be of format 'major.minor'.")
class MethodVersionNotFound(SenlinException):
msg_fmt = _("API version %(version)s is not supported on this method.")
msg_fmt = _("API version '%(version)s' is not supported on this method.")
class InvalidGlobalAPIVersion(SenlinException):
msg_fmt = _("Version %(req_ver)s is not supported by the API. Minimum is "
"%(min_ver)s and maximum is %(max_ver)s.")
msg_fmt = _("Version '%(req_ver)s' is not supported by the API. Minimum "
"is '%(min_ver)s' and maximum is '%(max_ver)s'.")
class MultipleChoices(SenlinException):
msg_fmt = _("Multiple results found matching the query criteria %(arg)s. "
"Please be more specific.")
msg_fmt = _("Multiple results found matching the query criteria "
"'%(arg)s'. Please be more specific.")
class ResourceNotFound(SenlinException):
@ -110,7 +110,7 @@ class ResourceNotFound(SenlinException):
'policy', 'receiver', 'webhook', 'profile_type', 'policy_type',
'action', 'event' and so on.
"""
msg_fmt = _("The %(type)s (%(id)s) could not be found.")
msg_fmt = _("The %(type)s '%(id)s' could not be found.")
@staticmethod
def enhance_msg(enhance, ex):
@ -125,7 +125,7 @@ class ResourceInUse(SenlinException):
'policy', 'receiver', 'webhook', 'profile_type', 'policy_type',
'action', 'event' and so on.
"""
msg_fmt = _("The %(type)s %(id)s cannot be deleted: %(reason)s.")
msg_fmt = _("The %(type)s '%(id)s' cannot be deleted: %(reason)s.")
class ProfileNotSpecified(SenlinException):
@ -145,12 +145,12 @@ class PolicyNotSpecified(SenlinException):
class PolicyBindingNotFound(SenlinException):
msg_fmt = _("The policy (%(policy)s) is not found attached to the "
"specified cluster (%(identity)s).")
msg_fmt = _("The policy '%(policy)s' is not found attached to the "
"specified cluster '%(identity)s'.")
class PolicyTypeConflict(SenlinException):
msg_fmt = _("The policy with type (%(policy_type)s) already exists.")
msg_fmt = _("The policy with type '%(policy_type)s' already exists.")
class InvalidSpec(SenlinException):
@ -177,7 +177,7 @@ class RequestLimitExceeded(SenlinException):
class ActionInProgress(SenlinException):
msg_fmt = _("The %(type)s %(id)s is in status %(status)s.")
msg_fmt = _("The %(type)s '%(id)s' is in status %(status)s.")
class NodeNotOrphan(SenlinException):
@ -203,12 +203,12 @@ class InternalError(SenlinException):
class EResourceBusy(InternalError):
# Internal exception, not to be exposed to end user.
msg_fmt = _("The %(type)s (%(id)s) is busy now.")
msg_fmt = _("The %(type)s '%(id)s' is busy now.")
class TrustNotFound(InternalError):
# Internal exception, not to be exposed to end user.
msg_fmt = _("The trust for trustor (%(trustor)s) could not be found.")
msg_fmt = _("The trust for trustor '%(trustor)s' could not be found.")
class EResourceCreation(InternalError):
@ -222,12 +222,12 @@ class EResourceCreation(InternalError):
class EResourceUpdate(InternalError):
# Used when updating resources from other services
msg_fmt = _("Failed in updating %(type)s %(id)s: %(message)s.")
msg_fmt = _("Failed in updating %(type)s '%(id)s': %(message)s.")
class EResourceDeletion(InternalError):
# Used when deleting resources from other services
msg_fmt = _("Failed in deleting %(type)s %(id)s: %(message)s.")
msg_fmt = _("Failed in deleting %(type)s '%(id)s': %(message)s.")
class EResourceOperation(InternalError):
@ -244,7 +244,7 @@ class EResourceOperation(InternalError):
'ResourceInUse' and so on, or developer can specified message.
"""
# Used when operating resources from other services
msg_fmt = _("Failed in %(op)s %(type)s %(id)s: %(message)s.")
msg_fmt = _("Failed in %(op)s %(type)s '%(id)s': %(message)s.")
class ESchema(InternalError):
@ -256,8 +256,8 @@ class InvalidPlugin(InternalError):
class PolicyNotAttached(InternalError):
msg_fmt = _("The policy (%(policy)s) is not attached to the specified "
"cluster (%(cluster)s).")
msg_fmt = _("The policy '%(policy)s' is not attached to the specified "
"cluster '%(cluster)s'.")
class HTTPExceptionDisguise(Exception):

View File

@ -1915,8 +1915,8 @@ class EngineService(service.Service):
binding = cp_obj.ClusterPolicy.get(ctx, db_cluster.id, db_policy.id)
if binding is None:
msg = _("The policy (%(p)s) is not attached to the specified "
"cluster (%(c)s)."
msg = _("The policy '%(p)s' is not attached to the specified "
"cluster '%(c)s'."
) % {'p': req.policy_id, 'c': req.identity}
raise exception.BadRequest(msg=msg)
@ -1956,8 +1956,8 @@ class EngineService(service.Service):
binding = cp_obj.ClusterPolicy.get(ctx, db_cluster.id, db_policy.id)
if binding is None:
msg = _("The policy (%(p)s) is not attached to the specified "
"cluster (%(c)s)."
msg = _("The policy '%(p)s' is not attached to the specified "
"cluster '%(c)s'."
) % {'p': req.policy_id, 'c': req.identity}
raise exception.BadRequest(msg=msg)

View File

@ -28,5 +28,5 @@ class TestActionShowNegativeNotFound(base.BaseSenlinAPITest):
message = ex.resp_body['error']['message']
self.assertEqual(
"The action (26cb0f3a-4e6c-49f6-8475-7cb472933bff) could not"
" be found.", str(message))
"The action '26cb0f3a-4e6c-49f6-8475-7cb472933bff' could "
"not be found.", str(message))

View File

@ -39,7 +39,7 @@ class TestClusterPolicyListNegativeBadRequest(base.BaseSenlinAPITest):
message = ex.resp_body['error']['message']
self.assertEqual(
"The cluster (0259cbac-0fb3-480b-8f23-1ec59616f3af) "
"The cluster '0259cbac-0fb3-480b-8f23-1ec59616f3af' "
"could not be found.", str(message))
@test.attr(type=['negative'])

View File

@ -30,7 +30,7 @@ class TestClusterPolicyShowNegativeClusterNotFound(base.BaseSenlinAPITest):
message = ex.resp_body['error']['message']
self.assertEqual(
"The cluster (965d7324-e3f7-4d77-8e7f-44c862b851f7) "
"The cluster '965d7324-e3f7-4d77-8e7f-44c862b851f7' "
"could not be found.", str(message))
@ -53,7 +53,7 @@ class TestClusterPolicyShowNegativePolicyNotFound(base.BaseSenlinAPITest):
'fake_policy')
message = ex.resp_body['error']['message']
self.assertEqual("The policy (fake_policy) could not be found.",
self.assertEqual("The policy 'fake_policy' could not be found.",
str(message))
@ -79,8 +79,8 @@ class TestClusterPolicyShowNegativeNoPolicyBinding(base.BaseSenlinAPITest):
message = ex.resp_body['error']['message']
self.assertEqual(
"The policy (%s) is not found attached to the specified cluster "
"(%s)." % (self.policy_id, self.cluster_id), str(message))
"The policy '%s' is not found attached to the specified cluster "
"'%s'." % (self.policy_id, self.cluster_id), str(message))
class TestClusterPolicyShowNegativeBadRequest(base.BaseSenlinAPITest):
@ -114,5 +114,5 @@ class TestClusterPolicyShowNegativeBadRequest(base.BaseSenlinAPITest):
message = ex.resp_body['error']['message']
self.assertEqual(
"Multiple results found matching the query criteria test-policy. "
"Please be more specific.", str(message))
"Multiple results found matching the query criteria "
"'test-policy'. Please be more specific.", str(message))

View File

@ -266,5 +266,5 @@ class TestClusterAddNodesNegativeClusterNotFound(base.BaseSenlinAPITest):
message = ex.resp_body['error']['message']
self.assertEqual(
"The cluster (db0faadf-9cd2-457f-b434-4891b77938ab) "
"The cluster 'db0faadf-9cd2-457f-b434-4891b77938ab' "
"could not be found.", str(message))

View File

@ -76,5 +76,5 @@ class TestClusterCheckNegativeNotFound(base.BaseSenlinAPITest):
'bbbe3feb-8482-4ae4-9c29-b4732efce931', params)
message = ex.resp_body['error']['message']
self.assertEqual("The cluster (bbbe3feb-8482-4ae4-9c29-b4732efce931) "
self.assertEqual("The cluster 'bbbe3feb-8482-4ae4-9c29-b4732efce931' "
"could not be found.", str(message))

View File

@ -56,7 +56,7 @@ class TestNodeOperationNegative(base.BaseSenlinAPITest):
ex = self.assertRaises(exceptions.BadRequest,
self.client.trigger_operation,
'nodes', 'FAKE_ID', params)
self.assertIn('API version 1.3 is not supported', six.text_type(ex))
self.assertIn("API version '1.3' is not supported", six.text_type(ex))
@utils.api_microversion('1.4')
@decorators.idempotent_id('2b53a240-7ec6-4d92-bc2d-aaba2e63ee21')

View File

@ -250,7 +250,6 @@ class ResourceExceptionHandlingTest(base.SenlinTestCase):
def raise_exception(self, req, body):
raise self.excpetion_to_raise()
actions = {'action': 'raise_exception', 'body': 'data'}
env = {'wsgiorg.routing_args': [None, actions]}
request = wsgi.Request.blank('/tests/123', environ=env)
@ -361,16 +360,16 @@ class MicroversionTest(base.SenlinTestCase):
ex = self.assertRaises(exception.MethodVersionNotFound,
c.index, request)
self.assertEqual('API version 1.0 is not supported on this method.',
six.text_type(ex))
self.assertEqual("API version '1.0' is not supported on "
"this method.", six.text_type(ex))
res = c.foo(request)
self.assertEqual({'bar': 'zoo'}, res)
ex = self.assertRaises(exception.MethodVersionNotFound,
c.dance, request)
self.assertEqual('API version 1.0 is not supported on this method.',
six.text_type(ex))
self.assertEqual("API version '1.0' is not supported on "
"this method.", six.text_type(ex))
def test_versioned_request_lower(self):
data = mock.Mock()
@ -431,8 +430,8 @@ class MicroversionTest(base.SenlinTestCase):
ex = self.assertRaises(exception.MethodVersionNotFound,
c.dance, request)
self.assertEqual('API version 3.5 is not supported on this method.',
six.text_type(ex))
self.assertEqual("API version '3.5' is not supported on "
"this method.", six.text_type(ex))
def test_vserioned_request_inner_functions(self):
data = mock.Mock()

View File

@ -61,14 +61,14 @@ class FaultMiddlewareTest(base.SenlinTestCase):
id='a'))
expected = {
'code': 404,
'error': {
'code': 404,
'message': 'The cluster (a) could not be found.',
'type': 'ResourceNotFound'
"code": 404,
"error": {
"code": 404,
"message": "The cluster 'a' could not be found.",
"type": "ResourceNotFound"
},
'explanation': 'The resource could not be found.',
'title': 'Not Found'
"explanation": "The resource could not be found.",
"title": "Not Found"
}
self.assertEqual(expected, msg)
@ -191,14 +191,14 @@ class FaultMiddlewareTest(base.SenlinTestCase):
msg = wrapper._error(ClusterNotFoundChild(type='cluster', id='a'))
expected = {
'code': 404,
'error': {
'code': 404,
'message': 'The cluster (a) could not be found.',
'type': 'ClusterNotFoundChild'
"code": 404,
"error": {
"code": 404,
"message": "The cluster 'a' could not be found.",
"type": "ClusterNotFoundChild"
},
'explanation': 'The resource could not be found.',
'title': 'Not Found'
"explanation": "The resource could not be found.",
"title": "Not Found"
}
self.assertEqual(expected, msg)
@ -210,15 +210,15 @@ class FaultMiddlewareTest(base.SenlinTestCase):
msg = wrapper._error(NotMappedException('A message'))
expected = {
'code': 500,
'error': {
'code': 500,
'message': u'A message',
'type': 'NotMappedException'
"code": 500,
"error": {
"code": 500,
"message": "A message",
"type": "NotMappedException"
},
'explanation': ('The server has either erred or is incapable '
'of performing the requested operation.'),
'title': 'Internal Server Error'
"explanation": ("The server has either erred or is incapable "
"of performing the requested operation."),
"title": "Internal Server Error"
}
self.assertEqual(expected, msg)

View File

@ -246,7 +246,7 @@ class VersionNegotiationTest(base.SenlinTestCase):
ex = self.assertRaises(webob.exc.HTTPBadRequest,
vnf._check_version_request,
request, controller)
self.assertEqual("API Version String (2.03) is of invalid format. It "
self.assertEqual("API Version String '2.03' is of invalid format. It "
"must be of format 'major.minor'.",
six.text_type(ex))
@ -264,8 +264,8 @@ class VersionNegotiationTest(base.SenlinTestCase):
ex = self.assertRaises(exception.InvalidGlobalAPIVersion,
vnf._check_version_request,
request, controller)
expected = ("Version 2.3 is not supported by the API. Minimum is "
"%(min_ver)s and maximum is %(max_ver)s." %
expected = ("Version '2.3' is not supported by the API. Minimum is "
"'%(min_ver)s' and maximum is '%(max_ver)s'." %
{'min_ver': str(minv), 'max_ver': str(maxv)})
self.assertEqual(expected, six.text_type(ex))

View File

@ -1263,7 +1263,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req, cluster_id=cid, path=path)
self.assertEqual(0, mock_call.call_count)
self.assertEqual('API version 1.1 is not supported on this method.',
self.assertEqual("API version '1.1' is not supported on this method.",
six.text_type(ex))
@mock.patch.object(rpc_client.EngineClient, 'call')
@ -1394,7 +1394,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase):
req, cluster_id=cid, body=body)
self.assertEqual(0, mock_call.call_count)
self.assertEqual('API version 1.1 is not supported on this method.',
self.assertEqual("API version '1.1' is not supported on this method.",
six.text_type(ex))
def test_operation_no_operations(self, mock_enforce):

View File

@ -591,7 +591,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertEqual(404, resp.json['code'])
self.assertEqual('ResourceNotFound', resp.json['error']['type'])
msg = 'The node (non-exist-node) could not be found.'
msg = "The node 'non-exist-node' could not be found."
self.assertEqual(msg, resp.json['error']['message'])
@mock.patch.object(util, 'parse_request')
@ -624,7 +624,7 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
req.context, 'node_update', mock.ANY)
self.assertEqual(404, resp.json['code'])
self.assertEqual('ResourceNotFound', resp.json['error']['type'])
msg = 'The profile (aaaa-bbbb-cccc) could not be found.'
msg = "The profile 'aaaa-bbbb-cccc' could not be found."
self.assertEqual(msg, resp.json['error']['message'])
@mock.patch.object(util, 'parse_request')
@ -940,8 +940,8 @@ class NodeControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.controller.operation,
req, node_id=node_id, body=body)
self.assertEqual("API version 1.3 is not supported on this method.",
six.text_type(ex))
self.assertEqual("API version '1.3' is not supported on this "
"method.", six.text_type(ex))
def test_node_operation_missing_operation(self, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'operation', True)

View File

@ -557,8 +557,8 @@ class PolicyControllerTest(shared.ControllerTest, base.SenlinTestCase):
req, body=body)
mock_call.assert_not_called()
self.assertEqual('API version 1.1 is not supported on this method.',
six.text_type(ex))
self.assertEqual("API version '1.1' is not supported on this "
"method.", six.text_type(ex))
def test_profile_validate_denied_policy(self, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'validate', False)

View File

@ -276,7 +276,7 @@ class ProfileTypeControllerTest(shared.ControllerTest, base.SenlinTestCase):
req, type_name=type_name)
self.assertEqual(0, mock_call.call_count)
self.assertEqual('API version 1.1 is not supported on this method.',
self.assertEqual("API version '1.1' is not supported on this method.",
six.text_type(ex))
def test_profile_type_ops_err_denied_policy(self, mock_enforce):

View File

@ -654,8 +654,8 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
self.assertFalse(mock_parse.called)
self.assertFalse(mock_call.called)
self.assertEqual('API version 1.1 is not supported on this method.',
six.text_type(ex))
self.assertEqual("API version '1.1' is not supported on this "
"method.", six.text_type(ex))
def test_profile_validate_denied_policy(self, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'validate', False)

View File

@ -415,7 +415,7 @@ class DBAPIActionTest(base.SenlinTestCase):
ex = self.assertRaises(exception.EResourceBusy,
db_api.action_delete,
self.ctx, action.id)
self.assertEqual('The action (%s) is busy now.' % action.id,
self.assertEqual("The action '%s' is busy now." % action.id,
six.text_type(ex))
def test_action_delete_by_target(self):

View File

@ -503,7 +503,7 @@ class DBAPINodeTest(base.SenlinTestCase):
ex = self.assertRaises(exception.ResourceNotFound,
db_api.node_update,
self.ctx, 'BogusId', new_attributes)
self.assertEqual('The node (BogusId) could not be found.',
self.assertEqual("The node 'BogusId' could not be found.",
six.text_type(ex))
def test_node_update_cluster_status_updated(self):

View File

@ -342,7 +342,7 @@ class DBAPIProfileTest(base.SenlinTestCase):
profile_id = profile.id
ex = self.assertRaises(exception.EResourceBusy,
db_api.profile_delete, self.ctx, profile_id)
self.assertEqual('The profile (%s) is busy now.' % profile_id,
self.assertEqual("The profile '%s' is busy now." % profile_id,
six.text_type(ex))
db_api.cluster_delete(self.ctx, cluster.id)
@ -355,7 +355,7 @@ class DBAPIProfileTest(base.SenlinTestCase):
profile_id = profile.id
ex = self.assertRaises(exception.EResourceBusy,
db_api.profile_delete, self.ctx, profile_id)
self.assertEqual('The profile (%s) is busy now.' % profile_id,
self.assertEqual("The profile '%s' is busy now." % profile_id,
six.text_type(ex))
db_api.node_delete(self.ctx, node.id)

View File

@ -218,15 +218,15 @@ class ActionBaseTest(base.SenlinTestCase):
ex = self.assertRaises(exception.ResourceNotFound,
ab.Action.load,
self.ctx, 'non-existent', None)
self.assertEqual('The action (non-existent) could not be found.',
six.text_type(ex))
self.assertEqual("The action 'non-existent' could not be "
"found.", six.text_type(ex))
# not found due to no object
self.patchobject(ao.Action, 'get', return_value=None)
ex = self.assertRaises(exception.ResourceNotFound,
ab.Action.load,
self.ctx, 'whatever', None)
self.assertEqual('The action (whatever) could not be found.',
self.assertEqual("The action 'whatever' could not be found.",
six.text_type(ex))
def test_load_all(self):

View File

@ -222,8 +222,8 @@ class TestReceiver(base.SenlinTestCase):
ex = self.assertRaises(exception.ResourceNotFound,
rb.Receiver.load,
self.context, 'fake-receiver', None)
self.assertEqual('The receiver (fake-receiver) could not be found.',
six.text_type(ex))
self.assertEqual("The receiver 'fake-receiver' could not "
"be found.", six.text_type(ex))
def test_receiver_load_diff_project(self):
receiver = self._create_receiver('receiver-1', UUID1)
@ -232,7 +232,7 @@ class TestReceiver(base.SenlinTestCase):
ex = self.assertRaises(exception.ResourceNotFound,
rb.Receiver.load,
new_context, UUID1, None)
self.assertEqual('The receiver (%s) could not be found.' % UUID1,
self.assertEqual("The receiver '%s' could not be found." % UUID1,
six.text_type(ex))
res = rb.Receiver.load(new_context, receiver.id, project_safe=False)
@ -426,5 +426,5 @@ class TestReceiver(base.SenlinTestCase):
receiver = rb.Receiver.load(self.context, receiver_obj=receiver)
ex = self.assertRaises(exception.TrustNotFound,
receiver._build_conn_params, user, project)
msg = "The trust for trustor (user1) could not be found."
msg = "The trust for trustor 'user1' could not be found."
self.assertEqual(msg, six.text_type(ex))

View File

@ -189,8 +189,8 @@ class ActionTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceInUse, ex.exc_info[0])
self.assertEqual("The action ACTION_ID cannot be deleted: still in "
"one of WAITING, RUNNING or SUSPENDED state.",
self.assertEqual("The action 'ACTION_ID' cannot be deleted: still "
"in one of WAITING, RUNNING or SUSPENDED state.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'ACTION_ID')
mock_delete.assert_called_once_with(self.ctx, 'FAKE_ID')

View File

@ -92,7 +92,7 @@ class ClusterOpTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The cluster (Bogus) could not be found.',
self.assertEqual("The cluster 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')

View File

@ -98,7 +98,7 @@ class ClusterPolicyTest(base.SenlinTestCase):
self.eng.cluster_policy_list,
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual("The cluster (Bogus) could not be found.",
self.assertEqual("The cluster 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -132,7 +132,7 @@ class ClusterPolicyTest(base.SenlinTestCase):
self.eng.cluster_policy_get,
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual("The cluster (cid) could not be found.",
self.assertEqual("The cluster 'cid' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'cid')
@ -149,7 +149,7 @@ class ClusterPolicyTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual("The policy (pid) could not be found.",
self.assertEqual("The policy 'pid' could not be found.",
six.text_type(ex.exc_info[1]))
mock_cluster.assert_called_once_with(self.ctx, 'cid')
mock_policy.assert_called_once_with(self.ctx, 'pid')
@ -170,8 +170,8 @@ class ClusterPolicyTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.PolicyBindingNotFound, ex.exc_info[0])
self.assertEqual("The policy (pid) is not found attached to "
"the specified cluster (cid).",
self.assertEqual("The policy 'pid' is not found attached to "
"the specified cluster 'cid'.",
six.text_type(ex.exc_info[1]))
@mock.patch.object(action_mod.Action, 'create')
@ -212,7 +212,7 @@ class ClusterPolicyTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual("The cluster (BOGUS) could not be found.",
self.assertEqual("The cluster 'BOGUS' could not be found.",
six.text_type(ex.exc_info[1]))
mock_cluster.assert_called_once_with(self.ctx, 'BOGUS')
@ -230,7 +230,7 @@ class ClusterPolicyTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.BadRequest, ex.exc_info[0])
self.assertEqual("The specified policy (BOGUS) could not be found.",
self.assertEqual("The specified policy 'BOGUS' could not be found.",
six.text_type(ex.exc_info[1]))
mock_cluster.assert_called_once_with(self.ctx, 'CLUSTER')
mock_policy.assert_called_once_with(self.ctx, 'BOGUS')
@ -276,7 +276,7 @@ class ClusterPolicyTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual("The cluster (Bogus) could not be found.",
self.assertEqual("The cluster 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_cluster.assert_called_once_with(self.ctx, 'Bogus')
@ -294,7 +294,7 @@ class ClusterPolicyTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.BadRequest, ex.exc_info[0])
self.assertEqual("The specified policy (Bogus) could not be found.",
self.assertEqual("The specified policy 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_cluster.assert_called_once_with(self.ctx, 'CLUSTER')
mock_policy.assert_called_once_with(self.ctx, 'Bogus')
@ -314,8 +314,8 @@ class ClusterPolicyTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.BadRequest, ex.exc_info[0])
self.assertEqual("The policy (P1) is not attached to "
"the specified cluster (C1).",
self.assertEqual("The policy 'P1' is not attached to "
"the specified cluster 'C1'.",
six.text_type(ex.exc_info[1]))
mock_cluster.assert_called_once_with(self.ctx, 'C1')
mock_policy.assert_called_once_with(self.ctx, 'P1')
@ -363,7 +363,7 @@ class ClusterPolicyTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual("The cluster (Bogus) could not be found.",
self.assertEqual("The cluster 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_cluster.assert_called_once_with(self.ctx, 'Bogus')
@ -381,7 +381,7 @@ class ClusterPolicyTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.BadRequest, ex.exc_info[0])
self.assertEqual("The specified policy (Bogus) could not be found.",
self.assertEqual("The specified policy 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_cluster.assert_called_once_with(self.ctx, 'C1')
mock_policy.assert_called_once_with(self.ctx, 'Bogus')
@ -402,8 +402,8 @@ class ClusterPolicyTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.BadRequest, ex.exc_info[0])
self.assertEqual("The policy (P1) is not attached to the "
"specified cluster (C1).",
self.assertEqual("The policy 'P1' is not attached to the "
"specified cluster 'C1'.",
six.text_type(ex.exc_info[1]))
mock_cluster.assert_called_once_with(self.ctx, 'C1')

View File

@ -203,8 +203,8 @@ class ClusterTest(base.SenlinTestCase):
self.ctx, req)
self.assertEqual(exc.BadRequest, ex.exc_info[0])
self.assertEqual("The specified profile (Bogus) could not be found.",
six.text_type(ex.exc_info[1]))
self.assertEqual("The specified profile 'Bogus' could not "
"be found.", six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@mock.patch.object(service.EngineService, 'check_cluster_quota')
@ -353,7 +353,7 @@ class ClusterTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.BadRequest, ex.exc_info[0])
self.assertEqual("The specified profile (Bogus) could not be found.",
self.assertEqual("The specified profile 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'CLUSTER')
mock_load.assert_called_once_with(self.ctx, dbcluster=x_obj)
@ -494,7 +494,7 @@ class ClusterTest(base.SenlinTestCase):
self.ctx, req)
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The cluster (Bogus) could not be found.',
self.assertEqual("The cluster 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -750,7 +750,7 @@ class ClusterTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The cluster (Bogus) could not be found.',
self.assertEqual("The cluster 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -1060,7 +1060,7 @@ class ClusterTest(base.SenlinTestCase):
mock_find.assert_called_once_with(self.ctx, 'CLUSTER')
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual("The cluster (CLUSTER) could not be found.",
self.assertEqual("The cluster 'CLUSTER' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'CLUSTER')
@ -1127,7 +1127,7 @@ class ClusterTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The cluster (Bogus) could not be found.',
self.assertEqual("The cluster 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -1222,7 +1222,7 @@ class ClusterTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The cluster (Bogus) could not be found.',
self.assertEqual("The cluster 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -1335,7 +1335,7 @@ class ClusterTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The cluster (Bogus) could not be found.',
self.assertEqual("The cluster 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'C1')
@ -1372,7 +1372,7 @@ class ClusterTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The cluster (Bogus) could not be found.',
self.assertEqual("The cluster 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -1798,8 +1798,8 @@ class ClusterTest(base.SenlinTestCase):
self.eng.cluster_delete,
self.ctx, req.obj_to_primitive())
msg = _("The cluster FAKE_CLUSTER cannot be deleted: still referenced "
"by profile(s): ['profile1'].")
msg = _("The cluster 'FAKE_CLUSTER' cannot be deleted: still "
"referenced by profile(s): ['profile1'].")
self.assertEqual(exc.ResourceInUse, ex.exc_info[0])
self.assertEqual(msg, six.text_type(ex.exc_info[1]))
@ -1814,7 +1814,7 @@ class ClusterTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The cluster (Bogus) could not be found.',
self.assertEqual("The cluster 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
@mock.patch.object(co.Cluster, 'find')
@ -1830,8 +1830,9 @@ class ClusterTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ActionInProgress, ex.exc_info[0])
self.assertEqual("The cluster BUSY is in status %s." % bad_status,
six.text_type(ex.exc_info[1]))
self.assertEqual(
"The cluster 'BUSY' is in status %s." % bad_status,
six.text_type(ex.exc_info[1]))
@mock.patch.object(cpo.ClusterPolicy, 'get_all')
@mock.patch.object(co.Cluster, 'find')
@ -1846,8 +1847,8 @@ class ClusterTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceInUse, ex.exc_info[0])
expected_msg = _('The cluster IDENTITY cannot be deleted: '
'there is still policy(s) attached to it.')
expected_msg = _("The cluster 'IDENTITY' cannot be deleted: "
"there is still policy(s) attached to it.")
self.assertEqual(expected_msg, six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'IDENTITY')
mock_policies.assert_called_once_with(self.ctx, '12345678AB')
@ -1868,8 +1869,8 @@ class ClusterTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceInUse, ex.exc_info[0])
expected_msg = _('The cluster IDENTITY cannot be deleted: '
'there is still receiver(s) associated with it.')
expected_msg = _("The cluster 'IDENTITY' cannot be deleted: "
"there is still receiver(s) associated with it.")
self.assertEqual(expected_msg, six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'IDENTITY')
mock_policies.assert_called_once_with(self.ctx, '12345678AB')

View File

@ -285,8 +285,8 @@ class NodeTest(base.SenlinTestCase):
self.eng.node_create,
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.BadRequest, ex.exc_info[0])
self.assertEqual("The specified profile (Bogus) could not be found.",
six.text_type(ex.exc_info[1]))
self.assertEqual("The specified profile 'Bogus' could not be "
"found.", six.text_type(ex.exc_info[1]))
mock_profile.assert_called_once_with(self.ctx, 'Bogus')
@mock.patch.object(co.Cluster, 'find')
@ -304,7 +304,7 @@ class NodeTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.BadRequest, ex.exc_info[0])
self.assertEqual("The specified cluster (Bogus) could not be found.",
self.assertEqual("The specified cluster 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_profile.assert_called_once_with(self.ctx, 'PROFILE_NAME')
mock_cluster.assert_called_once_with(self.ctx, 'Bogus')
@ -384,7 +384,7 @@ class NodeTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual("The node (Bogus) could not be found.",
self.assertEqual("The node 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -501,7 +501,7 @@ class NodeTest(base.SenlinTestCase):
req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The node (Bogus) could not be found.',
self.assertEqual("The node 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -519,9 +519,8 @@ class NodeTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.BadRequest, ex.exc_info[0])
self.assertEqual("The specified profile "
"(Bogus) could not be found.",
six.text_type(ex.exc_info[1]))
self.assertEqual("The specified profile 'Bogus' could not be "
"found.", six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'FAKE_NODE')
mock_profile.assert_called_once_with(self.ctx, 'Bogus')
@ -597,7 +596,7 @@ class NodeTest(base.SenlinTestCase):
req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The node (Bogus) could not be found.',
self.assertEqual("The node 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -613,7 +612,7 @@ class NodeTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ActionInProgress, ex.exc_info[0])
self.assertEqual("The node BUSY is in status %s." % bad_status,
self.assertEqual("The node 'BUSY' is in status %s." % bad_status,
six.text_type(ex.exc_info[1]))
# skipping assertion on mock_find
@ -627,7 +626,7 @@ class NodeTest(base.SenlinTestCase):
self.eng.node_delete,
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceInUse, ex.exc_info[0])
self.assertEqual("The node node1 cannot be deleted: still depended "
self.assertEqual("The node 'node1' cannot be deleted: still depended "
"by other clusters and/or nodes.",
six.text_type(ex.exc_info[1]))
@ -662,7 +661,7 @@ class NodeTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The node (Bogus) could not be found.',
self.assertEqual("The node 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -697,7 +696,7 @@ class NodeTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The node (Bogus) could not be found.',
self.assertEqual("The node 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -744,7 +743,7 @@ class NodeTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The node (Bogus) could not be found.',
self.assertEqual("The node 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')

View File

@ -138,7 +138,7 @@ class PolicyTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual("The policy_type (FakePolicy-1.0) could "
self.assertEqual("The policy_type 'FakePolicy-1.0' could "
"not be found.",
six.text_type(ex.exc_info[1]))
@ -333,7 +333,7 @@ class PolicyTest(base.SenlinTestCase):
req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The policy (Bogus) could not be found.',
self.assertEqual("The policy 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -352,8 +352,8 @@ class PolicyTest(base.SenlinTestCase):
req.obj_to_primitive())
self.assertEqual(exc.ResourceInUse, ex.exc_info[0])
self.assertEqual(_("The policy POLICY_ID cannot be deleted: still "
"attached to some clusters."),
self.assertEqual(_("The policy 'POLICY_ID' cannot be deleted: "
"still attached to some clusters."),
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'POLICY_ID')
mock_delete.assert_called_once_with(self.ctx, 'POLICY_ID')

View File

@ -76,7 +76,7 @@ class PolicyTypeTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The policy_type (FAKE_TYPE) could not be found.',
six.text_type(ex.exc_info[1]))
self.assertEqual("The policy_type 'FAKE_TYPE' could not be "
"found.", six.text_type(ex.exc_info[1]))
mock_env.assert_called_once_with()
x_env.get_policy.assert_called_once_with('FAKE_TYPE')

View File

@ -76,8 +76,8 @@ class ProfileTypeTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The profile_type (FAKE_TYPE) could not be found.',
six.text_type(ex.exc_info[1]))
self.assertEqual("The profile_type 'FAKE_TYPE' could not be "
"found.", six.text_type(ex.exc_info[1]))
mock_env.assert_called_once_with()
x_env.get_profile.assert_called_once_with('FAKE_TYPE')
@ -110,7 +110,7 @@ class ProfileTypeTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.BadRequest, ex.exc_info[0])
self.assertEqual('The profile_type (FAKE_TYPE) could not be found.',
self.assertEqual("The profile_type 'FAKE_TYPE' could not be found.",
six.text_type(ex.exc_info[1]))
mock_env.assert_called_once_with()

View File

@ -143,8 +143,8 @@ class ProfileTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual("The profile_type (Bogus-1.0) could not be found.",
six.text_type(ex.exc_info[1]))
self.assertEqual("The profile_type 'Bogus-1.0' could not be "
"found.", six.text_type(ex.exc_info[1]))
@mock.patch.object(pb.Profile, 'create')
def test_profile_create_invalid_spec(self, mock_create):
@ -227,7 +227,7 @@ class ProfileTest(base.SenlinTestCase):
req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The profile (Bogus) could not be found.',
self.assertEqual("The profile 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -290,7 +290,7 @@ class ProfileTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The profile (Bogus) could not be found.',
self.assertEqual("The profile 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -345,7 +345,7 @@ class ProfileTest(base.SenlinTestCase):
req.obj_to_primitive())
self.assertEqual(exc.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The profile (Bogus) could not be found.',
self.assertEqual("The profile 'Bogus' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'Bogus')
@ -364,8 +364,8 @@ class ProfileTest(base.SenlinTestCase):
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.ResourceInUse, ex.exc_info[0])
self.assertEqual("The profile PROFILE_ID cannot be deleted: still "
"referenced by some clusters and/or nodes.",
self.assertEqual("The profile 'PROFILE_ID' cannot be deleted: "
"still referenced by some clusters and/or nodes.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'PROFILE_ID')
mock_delete.assert_called_once_with(self.ctx, 'PROFILE_ID')

View File

@ -156,7 +156,7 @@ class ReceiverTest(base.SenlinTestCase):
self.eng.receiver_create,
self.ctx, req.obj_to_primitive())
self.assertEqual(exc.BadRequest, ex.exc_info[0])
self.assertEqual("The referenced cluster (C1) could not be found.",
self.assertEqual("The referenced cluster 'C1' could not be found.",
six.text_type(ex.exc_info[1]))
@mock.patch.object(co.Cluster, 'find')

View File

@ -106,7 +106,7 @@ class WebhookTest(base.SenlinTestCase):
req.obj_to_primitive())
self.assertEqual(exception.ResourceNotFound, ex.exc_info[0])
self.assertEqual('The receiver (RRR) could not be found.',
self.assertEqual("The receiver 'RRR' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'RRR')
@ -125,7 +125,7 @@ class WebhookTest(base.SenlinTestCase):
req.obj_to_primitive())
self.assertEqual(exception.BadRequest, ex.exc_info[0])
self.assertEqual("The referenced cluster (BOGUS) could not be found.",
self.assertEqual("The referenced cluster 'BOGUS' could not be found.",
six.text_type(ex.exc_info[1]))
mock_find.assert_called_once_with(self.ctx, 'RRR')
mock_cluster.assert_called_once_with(self.ctx, 'BOGUS')

View File

@ -231,7 +231,7 @@ class TestCluster(base.SenlinTestCase):
ex = self.assertRaises(exception.ResourceNotFound,
cm.Cluster.load,
self.context, cluster_id=CLUSTER_ID)
self.assertEqual('The cluster (%s) could not be found.' % CLUSTER_ID,
self.assertEqual("The cluster '%s' could not be found." % CLUSTER_ID,
six.text_type(ex))
mock_get.assert_called_once_with(self.context, CLUSTER_ID,
project_safe=True)

View File

@ -93,8 +93,8 @@ class TestClusterPolicy(base.SenlinTestCase):
ex = self.assertRaises(exception.PolicyNotAttached,
cpm.ClusterPolicy.load,
self.context, 'some-cluster', 'any-policy')
self.assertEqual('The policy (any-policy) is not attached to the '
'specified cluster (some-cluster).',
self.assertEqual("The policy 'any-policy' is not attached to the "
"specified cluster 'some-cluster'.",
six.text_type(ex))
cluster = utils.create_cluster(self.context, CLUSTER_ID, PROFILE_ID)

View File

@ -169,7 +169,7 @@ class TestEnvironment(base.SenlinTestCase):
ex = self.assertRaises(exception.ResourceNotFound,
env.get_profile, 'foo')
self.assertEqual('The profile_type (foo) could not be found.',
self.assertEqual("The profile_type 'foo' could not be found.",
six.text_type(ex))
env.register_profile('foo', plugin)
@ -196,7 +196,7 @@ class TestEnvironment(base.SenlinTestCase):
ex = self.assertRaises(exception.ResourceNotFound,
env.get_policy, 'foo')
self.assertEqual('The policy_type (foo) could not be found.',
self.assertEqual("The policy_type 'foo' could not be found.",
six.text_type(ex))
env.register_policy('foo', plugin)

View File

@ -107,7 +107,7 @@ class TestNode(base.SenlinTestCase):
ex = self.assertRaises(exception.ResourceNotFound,
nodem.Node.load,
self.context, 'non-existent', None)
self.assertEqual('The node (non-existent) could not be found.',
self.assertEqual("The node 'non-existent' could not be found.",
six.text_type(ex))
x_node_id = 'ee96c490-2dee-40c8-8919-4c64b89e326c'
@ -144,7 +144,7 @@ class TestNode(base.SenlinTestCase):
ex = self.assertRaises(exception.ResourceNotFound,
nodem.Node.load,
new_ctx, x_node_id, None)
self.assertEqual('The node (%s) could not be found.' % x_node_id,
self.assertEqual("The node '%s' could not be found." % x_node_id,
six.text_type(ex))
res = nodem.Node.load(new_ctx, x_node_id, project_safe=False)
@ -377,9 +377,9 @@ class TestNode(base.SenlinTestCase):
mock_delete.assert_called_once_with(self.context, node)
mock_status.assert_has_calls([
mock.call(self.context, consts.NS_DELETING,
'Deletion in progress'),
"Deletion in progress"),
mock.call(self.context, consts.NS_ERROR,
'Failed in deleting PROFILE NODE_ID: Too Bad.')
"Failed in deleting PROFILE 'NODE_ID': Too Bad.")
])
@mock.patch.object(node_obj.Node, 'update')
@ -466,13 +466,13 @@ class TestNode(base.SenlinTestCase):
mock_db.assert_has_calls([
mock.call(
self.context, node.id,
{'status': 'UPDATING', 'status_reason': 'Update in progress'}
{"status": "UPDATING", "status_reason": "Update in progress"}
),
mock.call(
self.context, node.id,
{'status': 'ERROR',
'status_reason': 'Failed in updating PROFILE ID: reason.',
'updated_at': mock.ANY}
{"status": "ERROR",
"status_reason": "Failed in updating PROFILE 'ID': reason.",
"updated_at": mock.ANY}
)
])
self.assertEqual(1, mock_update.call_count)
@ -600,7 +600,7 @@ class TestNode(base.SenlinTestCase):
mock_status.assert_called_once_with(
self.context,
consts.NS_ERROR,
'Failed in checking server %s: failed get.' % node.physical_id)
"Failed in checking server '%s': failed get." % node.physical_id)
def test_node_check_no_physical_id(self):
node = nodem.Node('node1', PROFILE_ID, '')
@ -735,6 +735,6 @@ class TestNode(base.SenlinTestCase):
mock.call(self.context, consts.NS_OPERATING,
reason="Operation 'dance' in progress"),
mock.call(self.context, consts.NS_ERROR,
reason="Failed in dance container test_id: Boom.")
reason="Failed in dance container 'test_id': Boom.")
])
x_profile.handle_dance.assert_called_once_with(node, style='tango')

View File

@ -84,7 +84,7 @@ class TestAction(testtools.TestCase):
ex = self.assertRaises(exc.ResourceNotFound,
ao.Action.find,
self.ctx, 'BOGUS')
self.assertEqual("The action (BOGUS) could not be found.",
self.assertEqual("The action 'BOGUS' could not be found.",
six.text_type(ex))
mock_name.assert_called_once_with(self.ctx, 'BOGUS')
mock_shortid.assert_called_once_with(self.ctx, 'BOGUS')

View File

@ -68,6 +68,6 @@ class TestEvent(testtools.TestCase):
ex = self.assertRaises(exc.ResourceNotFound,
eo.Event.find,
self.ctx, 'BOGUS')
self.assertEqual("The event (BOGUS) could not be found.",
self.assertEqual("The event 'BOGUS' could not be found.",
six.text_type(ex))
mock_shortid.assert_called_once_with(self.ctx, 'BOGUS')

View File

@ -84,7 +84,7 @@ class TestNode(testtools.TestCase):
ex = self.assertRaises(exc.ResourceNotFound,
no.Node.find,
self.ctx, 'BOGUS')
self.assertEqual("The node (BOGUS) could not be found.",
self.assertEqual("The node 'BOGUS' could not be found.",
six.text_type(ex))
mock_name.assert_called_once_with(self.ctx, 'BOGUS', project_safe=True)
mock_shortid.assert_called_once_with(self.ctx, 'BOGUS',

View File

@ -88,6 +88,6 @@ class TestPolicy(testtools.TestCase):
po.Policy.find,
self.ctx, 'Bogus')
self.assertEqual('The policy (Bogus) could not be found.',
self.assertEqual("The policy 'Bogus' could not be found.",
six.text_type(ex))
mock_get_name.assert_called_once_with(self.ctx, 'Bogus')

View File

@ -88,6 +88,6 @@ class TestProfile(testtools.TestCase):
po.Profile.find,
self.ctx, 'Bogus')
self.assertEqual('The profile (Bogus) could not be found.',
self.assertEqual("The profile 'Bogus' could not be found.",
six.text_type(ex))
mock_get_name.assert_called_once_with(self.ctx, 'Bogus')

View File

@ -166,13 +166,13 @@ class TestPolicyBase(base.SenlinTestCase):
ex = self.assertRaises(exception.ResourceNotFound,
pb.Policy.load,
self.ctx, 'fake-policy', None)
self.assertEqual('The policy (fake-policy) could not be found.',
self.assertEqual("The policy 'fake-policy' could not be found.",
six.text_type(ex))
ex = self.assertRaises(exception.ResourceNotFound,
pb.Policy.load,
self.ctx, None, None)
self.assertEqual('The policy (None) could not be found.',
self.assertEqual("The policy 'None' could not be found.",
six.text_type(ex))
def test_load_all(self):
@ -584,5 +584,5 @@ class TestPolicyBase(base.SenlinTestCase):
policy._build_conn_params,
'user1', 'project1')
msg = "The trust for trustor (user1) could not be found."
msg = "The trust for trustor 'user1' could not be found."
self.assertEqual(msg, six.text_type(ex))

View File

@ -200,7 +200,7 @@ class TestContainerDockerProfile(base.SenlinTestCase):
profile._get_host,
ctx, 'fake_node', None)
msg = _('The host node (fake_node) could not be found.')
msg = _("The host node 'fake_node' could not be found.")
self.assertEqual(msg, ex.message)
@mock.patch.object(cluster.Cluster, 'load')
@ -227,7 +227,7 @@ class TestContainerDockerProfile(base.SenlinTestCase):
profile._get_random_node,
ctx, 'host_cluster')
msg = _("The host cluster (host_cluster) could not be found.")
msg = _("The host cluster 'host_cluster' could not be found.")
self.assertEqual(msg, ex.message)
@mock.patch.object(cluster.Cluster, 'load')
@ -502,8 +502,8 @@ class TestContainerDockerProfile(base.SenlinTestCase):
docker.handle_reboot,
obj)
self.assertEqual("Failed in rebooting container FAKE_ID: Boom.",
six.text_type(ex))
self.assertEqual("Failed in rebooting container 'FAKE_ID': "
"Boom.", six.text_type(ex))
@mock.patch.object(dp.DockerProfile, 'docker')
def test_handle_reboot_docker_failure(self, mock_docker):
@ -517,8 +517,8 @@ class TestContainerDockerProfile(base.SenlinTestCase):
docker.handle_reboot,
obj)
self.assertEqual("Failed in rebooting container FAKE_ID: Boom.",
six.text_type(ex))
self.assertEqual("Failed in rebooting container 'FAKE_ID': "
"Boom.", six.text_type(ex))
@mock.patch.object(dp.DockerProfile, 'docker')
def test_handle_pause(self, mock_docker):
@ -552,8 +552,8 @@ class TestContainerDockerProfile(base.SenlinTestCase):
docker.handle_pause,
obj)
self.assertEqual("Failed in pausing container FAKE_ID: Boom.",
six.text_type(ex))
self.assertEqual("Failed in pausing container 'FAKE_ID': "
"Boom.", six.text_type(ex))
@mock.patch.object(dp.DockerProfile, 'docker')
def test_handle_pause_docker_failure(self, mock_docker):
@ -567,8 +567,8 @@ class TestContainerDockerProfile(base.SenlinTestCase):
docker.handle_pause,
obj)
self.assertEqual("Failed in pausing container FAKE_ID: Boom.",
six.text_type(ex))
self.assertEqual("Failed in pausing container 'FAKE_ID': "
"Boom.", six.text_type(ex))
@mock.patch.object(dp.DockerProfile, 'docker')
def test_handle_unpause(self, mock_docker):
@ -602,8 +602,8 @@ class TestContainerDockerProfile(base.SenlinTestCase):
docker.handle_unpause,
obj)
self.assertEqual("Failed in unpausing container FAKE_ID: Boom.",
six.text_type(ex))
self.assertEqual("Failed in unpausing container 'FAKE_ID': "
"Boom.", six.text_type(ex))
@mock.patch.object(dp.DockerProfile, 'docker')
def test_handle_unpause_docker_failure(self, mock_docker):
@ -617,5 +617,5 @@ class TestContainerDockerProfile(base.SenlinTestCase):
docker.handle_unpause,
obj)
self.assertEqual("Failed in unpausing container FAKE_ID: Boom.",
six.text_type(ex))
self.assertEqual("Failed in unpausing container 'FAKE_ID': "
"Boom.", six.text_type(ex))

View File

@ -303,7 +303,7 @@ class TestHeatStackProfile(base.SenlinTestCase):
test_stack)
# assertions
self.assertEqual('Failed in deleting stack FAKE_ID: Boom.',
self.assertEqual("Failed in deleting stack 'FAKE_ID': Boom.",
six.text_type(ex))
oc.stack_delete.assert_called_once_with('FAKE_ID', True)
self.assertEqual(0, oc.wait_for_stack_delete.call_count)
@ -321,7 +321,7 @@ class TestHeatStackProfile(base.SenlinTestCase):
profile.do_delete, test_stack)
# assertions
self.assertEqual('Failed in deleting stack FAKE_ID: Boom.',
self.assertEqual("Failed in deleting stack 'FAKE_ID': Boom.",
six.text_type(ex))
oc.stack_delete.assert_called_once_with('FAKE_ID', True)
oc.wait_for_stack_delete.assert_called_once_with('FAKE_ID')
@ -512,8 +512,8 @@ class TestHeatStackProfile(base.SenlinTestCase):
oc.stack_update.assert_called_once_with(
'FAKE_ID', environment={"new": "env1"})
self.assertEqual(0, oc.wait_for_stack.call_count)
self.assertEqual('Failed in updating stack FAKE_ID: Failed.',
six.text_type(ex))
self.assertEqual("Failed in updating stack 'FAKE_ID': "
"Failed.", six.text_type(ex))
def test_do_update_timeout(self):
profile = stack.StackProfile('t', self.spec)
@ -534,8 +534,8 @@ class TestHeatStackProfile(base.SenlinTestCase):
'FAKE_ID', environment={"new": "env1"})
oc.wait_for_stack.assert_called_once_with(
'FAKE_ID', 'UPDATE_COMPLETE', timeout=3600)
self.assertEqual('Failed in updating stack FAKE_ID: Timeout.',
six.text_type(ex))
self.assertEqual("Failed in updating stack 'FAKE_ID': "
"Timeout.", six.text_type(ex))
def test_do_check(self):
node_obj = mock.Mock(physical_id='FAKE_ID')

View File

@ -531,8 +531,8 @@ class TestNovaServerBasic(base.SenlinTestCase):
ex = self.assertRaises(exc.EResourceDeletion,
profile.do_delete, obj)
self.assertEqual('Failed in deleting server FAKE_ID: Nova Error.',
six.text_type(ex))
self.assertEqual("Failed in deleting server 'FAKE_ID': "
"Nova Error.", six.text_type(ex))
cc.server_delete.assert_called_once_with('FAKE_ID', True)
self.assertEqual(0, cc.wait_for_server_delete.call_count)
@ -549,8 +549,8 @@ class TestNovaServerBasic(base.SenlinTestCase):
ex = self.assertRaises(exc.EResourceDeletion,
profile.do_delete, obj, force=True)
self.assertEqual('Failed in deleting server FAKE_ID: Nova Error.',
six.text_type(ex))
self.assertEqual("Failed in deleting server 'FAKE_ID': "
"Nova Error.", six.text_type(ex))
cc.server_force_delete.assert_called_once_with('FAKE_ID', True)
self.assertEqual(0, cc.wait_for_server_delete.call_count)
@ -567,7 +567,7 @@ class TestNovaServerBasic(base.SenlinTestCase):
ex = self.assertRaises(exc.EResourceDeletion,
profile.do_delete, obj)
self.assertEqual('Failed in deleting server FAKE_ID: TIMEOUT.',
self.assertEqual("Failed in deleting server 'FAKE_ID': TIMEOUT.",
six.text_type(ex))
cc.server_delete.assert_called_once_with('FAKE_ID', True)
cc.wait_for_server_delete.assert_called_once_with('FAKE_ID')
@ -876,8 +876,8 @@ class TestNovaServerBasic(base.SenlinTestCase):
profile.do_rebuild,
node_obj)
self.assertEqual('Failed in rebuilding server FAKE_ID: '
'FAKE_ID not found.',
self.assertEqual("Failed in rebuilding server 'FAKE_ID': "
"FAKE_ID not found.",
six.text_type(ex))
cc.server_get.assert_called_once_with('FAKE_ID')
@ -896,8 +896,8 @@ class TestNovaServerBasic(base.SenlinTestCase):
profile.do_rebuild,
node_obj)
self.assertEqual('Failed in rebuilding server FAKE_ID: '
'cannot rebuild.',
self.assertEqual("Failed in rebuilding server 'FAKE_ID': "
"cannot rebuild.",
six.text_type(ex))
cc.server_get.assert_called_once_with('FAKE_ID')
cc.server_rebuild.assert_called_once_with('FAKE_ID', '123',
@ -920,8 +920,8 @@ class TestNovaServerBasic(base.SenlinTestCase):
profile.do_rebuild,
node_obj)
self.assertEqual('Failed in rebuilding server FAKE_ID: timeout.',
six.text_type(ex))
self.assertEqual("Failed in rebuilding server 'FAKE_ID': "
"timeout.", six.text_type(ex))
cc.server_get.assert_called_once_with('FAKE_ID')
cc.server_rebuild.assert_called_once_with('FAKE_ID', '123',
'FAKE_SERVER_NAME',

View File

@ -179,7 +179,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._update_name,
obj, 'NEW_NAME')
self.assertEqual('Failed in updating server NOVA_ID: BOOM.',
self.assertEqual("Failed in updating server 'NOVA_ID': BOOM.",
six.text_type(ex))
cc.server_update.assert_called_once_with('NOVA_ID', name='NEW_NAME')
@ -207,7 +207,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._update_password,
obj, 'NEW_PASSWORD')
self.assertEqual('Failed in updating server NOVA_ID: BOOM.',
self.assertEqual("Failed in updating server 'NOVA_ID': BOOM.",
six.text_type(ex))
cc.server_change_password.assert_called_once_with(
'NOVA_ID', 'NEW_PASSWORD')
@ -265,8 +265,8 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._update_metadata,
obj, new_profile)
self.assertEqual('Failed in updating server NOVA_ID: Nova Error.',
six.text_type(ex))
self.assertEqual("Failed in updating server 'NOVA_ID': "
"Nova Error.", six.text_type(ex))
cc.server_metadata_update.assert_called_once_with(
'NOVA_ID', {'fooa': 'baaar', 'cluster_node_id': 'NODE_ID'}
)
@ -382,8 +382,8 @@ class TestNovaServerUpdate(base.SenlinTestCase):
cc.server_resize.assert_called_once_with('NOVA_ID', '456')
cc.server_resize_revert.assert_called_once_with('NOVA_ID')
cc.wait_for_server.assert_called_once_with('NOVA_ID', 'ACTIVE')
self.assertEqual('Failed in updating server NOVA_ID: Resize failed.',
six.text_type(ex))
self.assertEqual("Failed in updating server 'NOVA_ID': Resize "
"failed.", six.text_type(ex))
def test__update_flavor_first_wait_for_server_failed(self):
obj = mock.Mock(physical_id='NOVA_ID')
@ -416,8 +416,8 @@ class TestNovaServerUpdate(base.SenlinTestCase):
mock.call('NOVA_ID', 'VERIFY_RESIZE'),
mock.call('NOVA_ID', 'ACTIVE')])
cc.server_resize_revert.assert_called_once_with('NOVA_ID')
self.assertEqual('Failed in updating server NOVA_ID: TIMEOUT.',
six.text_type(ex))
self.assertEqual("Failed in updating server 'NOVA_ID': "
"TIMEOUT.", six.text_type(ex))
def test__update_flavor_resize_failed_revert_failed(self):
obj = mock.Mock(physical_id='NOVA_ID')
@ -449,8 +449,8 @@ class TestNovaServerUpdate(base.SenlinTestCase):
cc.server_resize_revert.assert_called_once_with('NOVA_ID')
# the wait_for_server wasn't called
self.assertEqual(0, cc.wait_for_server.call_count)
self.assertEqual('Failed in updating server NOVA_ID: Revert.',
six.text_type(ex))
self.assertEqual("Failed in updating server 'NOVA_ID': "
"Revert.", six.text_type(ex))
def test__update_flavor_confirm_failed(self):
obj = mock.Mock(physical_id='NOVA_ID')
@ -479,7 +479,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
cc.server_resize.assert_called_once_with('NOVA_ID', '456')
cc.server_resize_confirm.assert_called_once_with('NOVA_ID')
cc.wait_for_server.assert_called_once_with('NOVA_ID', 'VERIFY_RESIZE')
self.assertEqual('Failed in updating server NOVA_ID: Confirm.',
self.assertEqual("Failed in updating server 'NOVA_ID': Confirm.",
six.text_type(ex))
def test__update_flavor_wait_confirm_failed(self):
@ -512,7 +512,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
mock.call('NOVA_ID', 'VERIFY_RESIZE'),
mock.call('NOVA_ID', 'ACTIVE')
])
self.assertEqual('Failed in updating server NOVA_ID: Wait.',
self.assertEqual("Failed in updating server 'NOVA_ID': Wait.",
six.text_type(ex))
def test__update_image(self):
@ -550,8 +550,8 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._update_image,
obj, new_profile, 'new_name', '')
msg = ("Failed in updating server NOVA_ID: Updating Nova server with "
"image set to None is not supported by Nova.")
msg = ("Failed in updating server 'NOVA_ID': Updating Nova server"
" with image set to None is not supported by Nova.")
self.assertEqual(msg, six.text_type(ex))
def test__update_image_new_image_invalid(self):
@ -571,7 +571,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._update_image,
obj, new_profile, 'new_name', 'new_pass')
msg = ("Failed in updating server NOVA_ID: BAD.")
msg = ("Failed in updating server 'NOVA_ID': BAD.")
self.assertEqual(msg, six.text_type(ex))
mock_check.assert_called_once_with(obj, 'new_image', reason='update')
@ -596,7 +596,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._update_image,
obj, new_profile, 'new_name', 'new_pass')
msg = ("Failed in updating server NOVA_ID: BAD.")
msg = ("Failed in updating server 'NOVA_ID': BAD.")
self.assertEqual(msg, six.text_type(ex))
mock_check.assert_has_calls([
mock.call(obj, 'new_image', reason='update'),
@ -649,7 +649,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._update_image,
obj, new_profile, 'new_name', 'new_pass')
self.assertEqual('Failed in updating server NOVA_ID: DRIVER.',
self.assertEqual("Failed in updating server 'NOVA_ID': DRIVER.",
six.text_type(ex))
mock_check.assert_called_once_with(obj, 'new_image', reason='update')
cc.server_get.assert_called_once_with('NOVA_ID')
@ -697,7 +697,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._update_image,
obj, new_profile, 'new_name', 'new_pass')
self.assertEqual('Failed in updating server NOVA_ID: FAILED.',
self.assertEqual("Failed in updating server 'NOVA_ID': FAILED.",
six.text_type(ex))
mock_check.assert_has_calls([
mock.call(obj, 'new_image', reason='update'),
@ -726,7 +726,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._update_image,
obj, new_profile, 'new_name', 'new_pass')
self.assertEqual('Failed in updating server NOVA_ID: TIMEOUT.',
self.assertEqual("Failed in updating server 'NOVA_ID': TIMEOUT.",
six.text_type(ex))
mock_check.assert_has_calls([
mock.call(obj, 'new_image', reason='update'),
@ -793,7 +793,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._create_interfaces,
obj, networks)
self.assertEqual('Failed in updating server NOVA_ID: Not valid.',
self.assertEqual("Failed in updating server 'NOVA_ID': Not valid.",
six.text_type(ex))
cc.server_get.assert_called_once_with('NOVA_ID')
self.assertEqual(0, cc.server_interface_create.call_count)
@ -815,7 +815,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._create_interfaces,
obj, networks)
self.assertEqual('Failed in updating server NOVA_ID: Driver error.',
self.assertEqual("Failed in updating server 'NOVA_ID': Driver error.",
six.text_type(ex))
cc.server_get.assert_called_once_with('NOVA_ID')
mock_validate.assert_called_once_with(obj, networks[0], 'update')
@ -878,7 +878,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._delete_interfaces,
obj, mock.Mock())
self.assertEqual('Failed in updating server NOVA_ID: BANG.',
self.assertEqual("Failed in updating server 'NOVA_ID': BANG.",
six.text_type(ex))
cc.server_interface_list.assert_called_once_with('NOVA_ID')
@ -915,7 +915,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._delete_interfaces,
obj, networks)
self.assertEqual('Failed in updating server NOVA_ID: BANG.',
self.assertEqual("Failed in updating server 'NOVA_ID': BANG.",
six.text_type(ex))
cc.server_interface_list.assert_called_once_with('NOVA_ID')
cc.server_interface_delete.assert_called_once_with('port3', 'NOVA_ID')
@ -944,7 +944,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._delete_interfaces,
obj, networks)
self.assertEqual('Failed in updating server NOVA_ID: BANG.',
self.assertEqual("Failed in updating server 'NOVA_ID': BANG.",
six.text_type(ex))
cc.server_interface_list.assert_called_once_with('NOVA_ID')
nc.network_get.assert_called_once_with('net1')
@ -975,7 +975,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._delete_interfaces,
obj, networks)
self.assertEqual('Failed in updating server NOVA_ID: BANG.',
self.assertEqual("Failed in updating server 'NOVA_ID': BANG.",
six.text_type(ex))
cc.server_interface_list.assert_called_once_with('NOVA_ID')
nc.network_get.assert_called_once_with('net2')
@ -1006,7 +1006,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._delete_interfaces,
obj, networks)
self.assertEqual('Failed in updating server NOVA_ID: BANG.',
self.assertEqual("Failed in updating server 'NOVA_ID': BANG.",
six.text_type(ex))
cc.server_interface_list.assert_called_once_with('NOVA_ID')
nc.network_get.assert_called_once_with('net1')
@ -1046,7 +1046,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile._delete_interfaces,
obj, networks)
self.assertEqual('Failed in updating server NOVA_ID: BANG.',
self.assertEqual("Failed in updating server 'NOVA_ID': BANG.",
six.text_type(ex))
cc.server_interface_list.assert_called_once_with('NOVA_ID')
nc.network_get.assert_called_once_with('net2')
@ -1185,7 +1185,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile.do_update,
obj, new_profile)
self.assertEqual('Failed in updating server NOVA_ID: BANG.',
self.assertEqual("Failed in updating server 'NOVA_ID': BANG.",
six.text_type(ex))
mock_check_name.assert_called_once_with(obj, new_profile)
mock_check_password.assert_called_once_with(obj, new_profile)
@ -1255,8 +1255,8 @@ class TestNovaServerUpdate(base.SenlinTestCase):
mock_update_image.assert_called_with(
obj, new_profile, 'OLD_NAME', 'OLD_PASS')
self.assertEqual('Failed in updating server NOVA_ID: Image Not Found.',
six.text_type(ex))
self.assertEqual("Failed in updating server 'NOVA_ID': "
"Image Not Found.", six.text_type(ex))
@mock.patch.object(server.ServerProfile, '_update_flavor')
def test_do_update_update_flavor_succeeded(self, mock_update_flavor):
@ -1288,8 +1288,8 @@ class TestNovaServerUpdate(base.SenlinTestCase):
obj, new_profile)
mock_update_flavor.assert_called_with(obj, new_profile)
self.assertEqual('Failed in updating server NOVA_ID: '
'Flavor Not Found.',
self.assertEqual("Failed in updating server 'NOVA_ID': "
"Flavor Not Found.",
six.text_type(ex))
@mock.patch.object(server.ServerProfile, '_update_flavor')
@ -1347,7 +1347,7 @@ class TestNovaServerUpdate(base.SenlinTestCase):
profile.do_update,
obj, new_profile)
self.assertEqual('Failed in updating server NOVA_ID: BOOM.',
self.assertEqual("Failed in updating server 'NOVA_ID': BOOM.",
six.text_type(ex))
mock_check_name.assert_called_once_with(obj, new_profile)
mock_check_password.assert_called_once_with(obj, new_profile)

View File

@ -192,21 +192,21 @@ class TestFlavorValidation(base.SenlinTestCase):
validate_result=exc.InternalError(message='BANG'),
result='FID',
exception=exc.EResourceUpdate,
message='Failed in updating server NOVA_ID: BANG.')),
message="Failed in updating server 'NOVA_ID': BANG.")),
('update:not_found', dict(
reason='update',
success=False,
validate_result=exc.InternalError(code=404, message='BANG'),
result='FID',
exception=exc.EResourceUpdate,
message="Failed in updating server NOVA_ID: BANG.")),
message="Failed in updating server 'NOVA_ID': BANG.")),
('update:disabled', dict(
reason='update',
success=False,
validate_result=[mock.Mock(id='FID', is_disabled=True)],
result='FID',
exception=exc.EResourceUpdate,
message=("Failed in updating server NOVA_ID: The specified "
message=("Failed in updating server 'NOVA_ID': The specified "
"flavor 'FLAVOR' is disabled.")))
]
@ -293,14 +293,14 @@ class TestImageValidation(base.SenlinTestCase):
validate_result=exc.InternalError(message='BANG'),
result='FID',
exception=exc.EResourceUpdate,
message='Failed in updating server NOVA_ID: BANG.')),
message="Failed in updating server 'NOVA_ID': BANG.")),
('update:not_found', dict(
reason='update',
success=False,
validate_result=exc.InternalError(code=404, message='BANG'),
result='FID',
exception=exc.EResourceUpdate,
message="Failed in updating server NOVA_ID: BANG.")),
message="Failed in updating server 'NOVA_ID': BANG.")),
]
def setUp(self):
@ -386,14 +386,14 @@ class TestKeypairValidation(base.SenlinTestCase):
validate_result=exc.InternalError(message='BANG'),
result='FID',
exception=exc.EResourceUpdate,
message='Failed in updating server NOVA_ID: BANG.')),
message="Failed in updating server 'NOVA_ID': BANG.")),
('update:not_found', dict(
reason='update',
success=False,
validate_result=exc.InternalError(code=404, message='BANG'),
result='FID',
exception=exc.EResourceUpdate,
message="Failed in updating server NOVA_ID: BANG.")),
message="Failed in updating server 'NOVA_ID': BANG.")),
]
def setUp(self):
@ -582,7 +582,7 @@ class TestNetworkValidation(base.SenlinTestCase):
port_result=[],
result={},
exception=exc.EResourceUpdate,
message='Failed in updating server NOVA_ID: NET Failure.')),
message="Failed in updating server 'NOVA_ID': NET Failure.")),
('update:net-n:port-f:fixed_ip-n', dict(
reason='update',
success=False,
@ -591,7 +591,7 @@ class TestNetworkValidation(base.SenlinTestCase):
port_result=[exc.InternalError(message='PORT Failure')],
result={},
exception=exc.EResourceUpdate,
message='Failed in updating server NOVA_ID: PORT Failure.')),
message="Failed in updating server 'NOVA_ID': PORT Failure.")),
('update:net-n:port-active:fixed_ip-n', dict(
reason='update',
success=False,
@ -600,8 +600,8 @@ class TestNetworkValidation(base.SenlinTestCase):
port_result=[mock.Mock(id='PORT_ID', status='ACTIVE')],
result={},
exception=exc.EResourceUpdate,
message=('Failed in updating server NOVA_ID: The status of the '
'port PORT must be DOWN.'))),
message=("Failed in updating server 'NOVA_ID': The status of the "
"port PORT must be DOWN."))),
('update:net-n:port-n:fixed_ip-n', dict(
reason='update',
success=False,
@ -610,7 +610,7 @@ class TestNetworkValidation(base.SenlinTestCase):
port_result=[],
result={},
exception=exc.EResourceUpdate,
message=("Failed in updating server NOVA_ID: 'port' is required "
message=("Failed in updating server 'NOVA_ID': 'port' is required "
"if 'network' is omitted."))),
('update:net-n:port-y:fixed_ip-y', dict(
reason='update',
@ -620,9 +620,9 @@ class TestNetworkValidation(base.SenlinTestCase):
port_result=[mock.Mock(id='PORT_ID', status='DOWN')],
result={},
exception=exc.EResourceUpdate,
message=("Failed in updating server NOVA_ID: The 'port' property "
"and the 'fixed_ip' property cannot be specified at the "
"same time."))),
message=("Failed in updating server 'NOVA_ID': The 'port' "
"property and the 'fixed_ip' property cannot be "
"specified at the same time."))),
]
def setUp(self):

View File

@ -277,7 +277,7 @@ class TestProfileBase(base.SenlinTestCase):
self.ctx, 'my_profile', spec)
self.assertEqual("Failed in creating profile my_profile: The "
"profile_type (bogus-1.0) could not be found.",
"profile_type 'bogus-1.0' could not be found.",
six.text_type(ex))
@mock.patch.object(pb.Profile, 'validate')
@ -290,8 +290,8 @@ class TestProfileBase(base.SenlinTestCase):
pb.Profile.create,
self.ctx, 'my_profile', self.spec)
self.assertEqual("Failed in creating profile my_profile: Boom",
six.text_type(ex))
self.assertEqual("Failed in creating profile my_profile: "
"Boom", six.text_type(ex))
@mock.patch.object(po.Profile, 'delete')
def test_delete(self, mock_delete):
@ -783,8 +783,8 @@ class TestProfileBase(base.SenlinTestCase):
ex = self.assertRaises(exception.EResourceOperation,
profile.do_recover,
mock.Mock(id='NODE_ID'), operation='RECREATE')
self.assertEqual("Failed in recovering node NODE_ID: "
"Failed in deleting STACK ID: BANG.",
self.assertEqual("Failed in recovering node 'NODE_ID': "
"Failed in deleting STACK 'ID': BANG.",
six.text_type(ex))
def test_do_recover_with_recreate_failed_create(self):
@ -796,7 +796,7 @@ class TestProfileBase(base.SenlinTestCase):
ex = self.assertRaises(exception.EResourceOperation,
profile.do_recover,
mock.Mock(id='NODE_ID'), operation='RECREATE')
msg = ("Failed in recovering node NODE_ID: Failed in creating "
msg = ("Failed in recovering node 'NODE_ID': Failed in creating "
"STACK: BANNG.")
self.assertEqual(msg, six.text_type(ex))