Use yaml.safe_dump instead of yaml.dump
After changing to use yaml.safe_load, some of the tests are failing locally with unicode error. Though we've not noticed these issues at the gate, it's better to use safe_dump to avoid them. Change-Id: I84cf921afe76b3bed44e84230a71b244bb886cce Closes-Bug: #1547399
This commit is contained in:
parent
714627b39b
commit
03de65d5eb
@ -69,7 +69,7 @@ class RBACPolicyTest(common.HeatTestCase):
|
||||
def test_validate_invalid_action(self):
|
||||
tpl = yaml.safe_load(inline_templates.RBAC_TEMPLATE)
|
||||
tpl['resources']['rbac']['properties']['action'] = 'access_as_external'
|
||||
self._create_stack(tmpl=yaml.dump(tpl))
|
||||
self._create_stack(tmpl=yaml.safe_dump(tpl))
|
||||
msg = "Invalid action access_as_external for object type network."
|
||||
self.assertRaisesRegexp(exception.StackValidationFailed, msg,
|
||||
self.rbac.validate)
|
||||
@ -77,7 +77,7 @@ class RBACPolicyTest(common.HeatTestCase):
|
||||
def test_validate_invalid_type(self):
|
||||
tpl = yaml.safe_load(inline_templates.RBAC_TEMPLATE)
|
||||
tpl['resources']['rbac']['properties']['object_type'] = 'networks'
|
||||
self._create_stack(tmpl=yaml.dump(tpl))
|
||||
self._create_stack(tmpl=yaml.safe_dump(tpl))
|
||||
msg = "Invalid object_type: networks. "
|
||||
self.assertRaisesRegexp(exception.StackValidationFailed, msg,
|
||||
self.rbac.validate)
|
||||
|
@ -77,7 +77,7 @@ outputs:
|
||||
# remove the default from the parameter in the nested template.
|
||||
ntempl = yaml.safe_load(self.nested_template)
|
||||
del ntempl['parameters']['length']['default']
|
||||
nested_template = yaml.dump(ntempl)
|
||||
nested_template = yaml.safe_dump(ntempl)
|
||||
else:
|
||||
nested_template = self.nested_template
|
||||
|
||||
|
@ -191,7 +191,7 @@ class HooksTest(functional_base.FunctionalTestsBase):
|
||||
res_after.physical_resource_id)
|
||||
|
||||
def test_hook_pre_create_nested(self):
|
||||
files = {'nested.yaml': yaml.dump(self.template)}
|
||||
files = {'nested.yaml': yaml.safe_dump(self.template)}
|
||||
env = {'resource_registry':
|
||||
{'resources':
|
||||
{'nested':
|
||||
|
Loading…
Reference in New Issue
Block a user