Merge "Example for "Replace" function should use self.fn_name"
This commit is contained in:
commit
6722cc00e9
|
@ -373,13 +373,13 @@ class Replace(function.Function):
|
||||||
mapping = self.args['params']
|
mapping = self.args['params']
|
||||||
string = self.args['template']
|
string = self.args['template']
|
||||||
except (KeyError, TypeError):
|
except (KeyError, TypeError):
|
||||||
example = ('''str_replace:
|
example = _('''%s:
|
||||||
template: This is var1 template var2
|
template: This is var1 template var2
|
||||||
params:
|
params:
|
||||||
var1: a
|
var1: a
|
||||||
var2: string''')
|
var2: string''') % self.fn_name
|
||||||
raise KeyError(_('"str_replace" syntax should be %s') %
|
raise KeyError(_('"%(fn_name)s" syntax should be %(example)s') %
|
||||||
example)
|
{'fn_name': self.fn_name, 'example': example})
|
||||||
else:
|
else:
|
||||||
return mapping, string
|
return mapping, string
|
||||||
|
|
||||||
|
|
|
@ -700,8 +700,10 @@ class HOTemplateTest(common.HeatTestCase):
|
||||||
snippet = {'str_replace': {'tmpl': 'Template var1 string var2',
|
snippet = {'str_replace': {'tmpl': 'Template var1 string var2',
|
||||||
'parms': {'var1': 'foo', 'var2': 'bar'}}}
|
'parms': {'var1': 'foo', 'var2': 'bar'}}}
|
||||||
|
|
||||||
self.assertRaises(exception.StackValidationFailed,
|
ex = self.assertRaises(exception.StackValidationFailed,
|
||||||
self.resolve, snippet, tmpl)
|
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):
|
def test_str_replace_invalid_param_types(self):
|
||||||
"""Test str_replace function parameter values.
|
"""Test str_replace function parameter values.
|
||||||
|
|
Loading…
Reference in New Issue