py34: test_sahara/software_deployment

* Sort the output for consistent checking in tests
* don't use %(x)r, instead use %('x')s. repr flattens
  the unicode literal too along with the string.

partial blueprint heat-python34-support

Change-Id: I77b1c4a41aaf3d54008ec0a24be219e0292131d0
This commit is contained in:
Sirushti Murugesan 2015-08-01 18:30:23 +05:30
parent d5aa987c29
commit ee22a90133
4 changed files with 25 additions and 20 deletions

View File

@ -586,8 +586,8 @@ class BaseCustomConstraint(object):
def error(self, value):
if self._error_message is None:
return _("Error validating value %(value)r") % {"value": value}
return _("Error validating value %(value)r: %(message)s") % {
return _("Error validating value '%(value)s'") % {"value": value}
return _("Error validating value '%(value)s': %(message)s") % {
"value": value, "message": self._error_message}
def validate(self, value, context):

View File

@ -216,7 +216,7 @@ class SaharaNodeGroupTemplateTest(common.HeatTestCase):
ex = self.assertRaises(exception.StackValidationFailed, ngt.validate)
self.assertEqual(u"Property error: "
u"resources.node-group.properties.flavor: "
u"Error validating value u'm1.large'",
u"Error validating value 'm1.large'",
six.text_type(ex))
def test_template_invalid_name(self):

View File

@ -378,28 +378,38 @@ class SoftwareDeploymentTest(common.HeatTestCase):
self.deployment.handle_create()
self.assertEqual(sd['id'], self.deployment.resource_id)
call_arg = self.rpc_client.create_software_config.call_args[1]
call_arg['inputs'] = sorted(
call_arg['inputs'], key=lambda k: k['name'])
self.assertEqual({
'config': '',
'group': 'Heat::Ungrouped',
'name': self.deployment.physical_resource_name(),
'inputs': [{
'name': 'foo',
'type': 'String',
'value': 'bar'
}, {
'name': 'bink',
'type': 'String',
'value': 'bonk'
}, {
'description': 'Name of the current action being deployed',
'name': 'deploy_action',
'type': 'String',
'value': 'CREATE'
}, {
'description': 'Name of this deployment resource in the stack',
'name': 'deploy_resource_name',
'type': 'String',
'value': 'deployment_mysql'
}, {
'description': 'ID of the server being deployed to',
'name': 'deploy_server_id',
'type': 'String',
'value': '9f1f0e00-05d2-4ca5-8602-95021f19c9d0'
}, {
'description': 'Name of the current action being deployed',
'name': 'deploy_action',
'description': ('How the server should signal to heat with '
'the deployment output values.'),
'name': 'deploy_signal_transport',
'type': 'String',
'value': 'CREATE'
'value': 'NO_SIGNAL'
}, {
'description': 'ID of the stack this deployment belongs to',
'name': 'deploy_stack_id',
@ -407,20 +417,13 @@ class SoftwareDeploymentTest(common.HeatTestCase):
'value': ('software_deployment_test_stack'
'/42f6f66b-631a-44e7-8d01-e22fb54574a9')
}, {
'description': 'Name of this deployment resource in the stack',
'name': 'deploy_resource_name',
'name': 'foo',
'type': 'String',
'value': 'deployment_mysql'
}, {
'description': ('How the server should signal to heat with '
'the deployment output values.'),
'name': 'deploy_signal_transport',
'type': 'String',
'value': 'NO_SIGNAL'
'value': 'bar'
}],
'options': None,
'outputs': None
}, self.rpc_client.create_software_config.call_args[1])
}, call_arg)
self.assertEqual(
{'action': 'CREATE',

View File

@ -123,11 +123,13 @@ heat.tests.test_rpc_listener_client
heat.tests.test_rpc_worker_client
heat.tests.test_rsrc_defn
heat.tests.test_sahara_cluster
heat.tests.test_sahara_templates
heat.tests.test_scaling_template
heat.tests.test_server_tags
heat.tests.test_short_id
heat.tests.test_software_component
heat.tests.test_software_config
heat.tests.test_software_deployment
heat.tests.test_stack
heat.tests.test_stack_collect_attributes
heat.tests.test_stack_delete