Example for "Replace" function should use self.fn_name
rather than have "str_replace" hardcoded in. Change-Id: I779ca2ab72d218000d3501a2bd5c30dbacada4b2
This commit is contained in:
parent
5dc1084260
commit
d5cd3985de
|
@ -373,13 +373,13 @@ class Replace(function.Function):
|
|||
mapping = self.args['params']
|
||||
string = self.args['template']
|
||||
except (KeyError, TypeError):
|
||||
example = ('''str_replace:
|
||||
example = _('''%s:
|
||||
template: This is var1 template var2
|
||||
params:
|
||||
var1: a
|
||||
var2: string''')
|
||||
raise KeyError(_('"str_replace" syntax should be %s') %
|
||||
example)
|
||||
var2: string''') % self.fn_name
|
||||
raise KeyError(_('"%(fn_name)s" syntax should be %(example)s') %
|
||||
{'fn_name': self.fn_name, 'example': example})
|
||||
else:
|
||||
return mapping, string
|
||||
|
||||
|
|
|
@ -700,8 +700,10 @@ class HOTemplateTest(common.HeatTestCase):
|
|||
snippet = {'str_replace': {'tmpl': 'Template var1 string var2',
|
||||
'parms': {'var1': 'foo', 'var2': 'bar'}}}
|
||||
|
||||
self.assertRaises(exception.StackValidationFailed,
|
||||
self.resolve, snippet, tmpl)
|
||||
ex = self.assertRaises(exception.StackValidationFailed,
|
||||
self.resolve, snippet, tmpl)
|
||||
self.assertIn('"str_replace" syntax should be str_replace:\\n',
|
||||
six.text_type(ex))
|
||||
|
||||
def test_str_replace_invalid_param_types(self):
|
||||
"""Test str_replace function parameter values.
|
||||
|
|
Loading…
Reference in New Issue