Fix test cases pass dict schema directly as parameter schema object
Filter the parameter schema snippet through a Template object and out the other side completely unchanged before passing it to Parameter. Implements blueprint hot-parameters Change-Id: I8c3dd99c1a2f460f50a92565d9098c70c9e77a8a
This commit is contained in:
parent
171cf95bb4
commit
4368dccc08
@ -385,6 +385,9 @@ class Template(collections.Mapping):
|
|||||||
handle_resource_facade,
|
handle_resource_facade,
|
||||||
s)
|
s)
|
||||||
|
|
||||||
|
def param_schemata(self):
|
||||||
|
return self[PARAMETERS]
|
||||||
|
|
||||||
|
|
||||||
def _resolve(match, handle, snippet):
|
def _resolve(match, handle, snippet):
|
||||||
'''
|
'''
|
||||||
|
@ -22,40 +22,49 @@ from heat.engine import template
|
|||||||
|
|
||||||
|
|
||||||
class ParameterTest(testtools.TestCase):
|
class ParameterTest(testtools.TestCase):
|
||||||
|
|
||||||
|
def new_parameter(self, name, schema, value=None,
|
||||||
|
validate_value=True):
|
||||||
|
tmpl = template.Template({template.PARAMETERS: {name:
|
||||||
|
schema}})
|
||||||
|
schema = tmpl.param_schemata()[name]
|
||||||
|
return parameters.Parameter(name, schema, value,
|
||||||
|
validate_value)
|
||||||
|
|
||||||
def test_new_string(self):
|
def test_new_string(self):
|
||||||
p = parameters.Parameter('p', {'Type': 'String'}, validate_value=False)
|
p = self.new_parameter('p', {'Type': 'String'}, validate_value=False)
|
||||||
self.assertTrue(isinstance(p, parameters.StringParam))
|
self.assertTrue(isinstance(p, parameters.StringParam))
|
||||||
|
|
||||||
def test_new_number(self):
|
def test_new_number(self):
|
||||||
p = parameters.Parameter('p', {'Type': 'Number'}, validate_value=False)
|
p = self.new_parameter('p', {'Type': 'Number'}, validate_value=False)
|
||||||
self.assertTrue(isinstance(p, parameters.NumberParam))
|
self.assertTrue(isinstance(p, parameters.NumberParam))
|
||||||
|
|
||||||
def test_new_list(self):
|
def test_new_list(self):
|
||||||
p = parameters.Parameter('p', {'Type': 'CommaDelimitedList'},
|
p = self.new_parameter('p', {'Type': 'CommaDelimitedList'},
|
||||||
validate_value=False)
|
validate_value=False)
|
||||||
self.assertTrue(isinstance(p, parameters.CommaDelimitedListParam))
|
self.assertTrue(isinstance(p, parameters.CommaDelimitedListParam))
|
||||||
|
|
||||||
def test_new_json(self):
|
def test_new_json(self):
|
||||||
p = parameters.Parameter('p', {'Type': 'Json'}, validate_value=False)
|
p = self.new_parameter('p', {'Type': 'Json'}, validate_value=False)
|
||||||
self.assertTrue(isinstance(p, parameters.JsonParam))
|
self.assertTrue(isinstance(p, parameters.JsonParam))
|
||||||
|
|
||||||
def test_new_bad_type(self):
|
def test_new_bad_type(self):
|
||||||
self.assertRaises(ValueError, parameters.Parameter,
|
self.assertRaises(ValueError, self.new_parameter, 'p',
|
||||||
'p', {'Type': 'List'})
|
{'Type': 'List'})
|
||||||
|
|
||||||
def test_new_no_type(self):
|
def test_new_no_type(self):
|
||||||
self.assertRaises(KeyError, parameters.Parameter,
|
self.assertRaises(KeyError, self.new_parameter,
|
||||||
'p', {'Default': 'blarg'})
|
'p', {'Default': 'blarg'})
|
||||||
|
|
||||||
def test_default_no_override(self):
|
def test_default_no_override(self):
|
||||||
p = parameters.Parameter('defaulted', {'Type': 'String',
|
p = self.new_parameter('defaulted', {'Type': 'String',
|
||||||
'Default': 'blarg'})
|
'Default': 'blarg'})
|
||||||
self.assertTrue(p.has_default())
|
self.assertTrue(p.has_default())
|
||||||
self.assertEqual(p.default(), 'blarg')
|
self.assertEqual(p.default(), 'blarg')
|
||||||
self.assertEqual(p.value(), 'blarg')
|
self.assertEqual(p.value(), 'blarg')
|
||||||
|
|
||||||
def test_default_override(self):
|
def test_default_override(self):
|
||||||
p = parameters.Parameter('defaulted',
|
p = self.new_parameter('defaulted',
|
||||||
{'Type': 'String',
|
{'Type': 'String',
|
||||||
'Default': 'blarg'},
|
'Default': 'blarg'},
|
||||||
'wibble')
|
'wibble')
|
||||||
@ -69,7 +78,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'ConstraintDescription': 'wibble',
|
'ConstraintDescription': 'wibble',
|
||||||
'Default': 'bar'}
|
'Default': 'bar'}
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, 'foo')
|
self.new_parameter('p', schema, 'foo')
|
||||||
except ValueError as ve:
|
except ValueError as ve:
|
||||||
msg = str(ve)
|
msg = str(ve)
|
||||||
self.assertNotEqual(msg.find('wibble'), -1)
|
self.assertNotEqual(msg.find('wibble'), -1)
|
||||||
@ -77,7 +86,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
self.fail('ValueError not raised')
|
self.fail('ValueError not raised')
|
||||||
|
|
||||||
def test_no_echo_true(self):
|
def test_no_echo_true(self):
|
||||||
p = parameters.Parameter('anechoic',
|
p = self.new_parameter('anechoic',
|
||||||
{'Type': 'String',
|
{'Type': 'String',
|
||||||
'NoEcho': 'true'},
|
'NoEcho': 'true'},
|
||||||
'wibble')
|
'wibble')
|
||||||
@ -85,7 +94,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
self.assertNotEqual(str(p), 'wibble')
|
self.assertNotEqual(str(p), 'wibble')
|
||||||
|
|
||||||
def test_no_echo_true_caps(self):
|
def test_no_echo_true_caps(self):
|
||||||
p = parameters.Parameter('anechoic',
|
p = self.new_parameter('anechoic',
|
||||||
{'Type': 'String',
|
{'Type': 'String',
|
||||||
'NoEcho': 'TrUe'},
|
'NoEcho': 'TrUe'},
|
||||||
'wibble')
|
'wibble')
|
||||||
@ -93,7 +102,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
self.assertNotEqual(str(p), 'wibble')
|
self.assertNotEqual(str(p), 'wibble')
|
||||||
|
|
||||||
def test_no_echo_false(self):
|
def test_no_echo_false(self):
|
||||||
p = parameters.Parameter('echoic',
|
p = self.new_parameter('echoic',
|
||||||
{'Type': 'String',
|
{'Type': 'String',
|
||||||
'NoEcho': 'false'},
|
'NoEcho': 'false'},
|
||||||
'wibble')
|
'wibble')
|
||||||
@ -102,20 +111,20 @@ class ParameterTest(testtools.TestCase):
|
|||||||
|
|
||||||
def test_description(self):
|
def test_description(self):
|
||||||
description = 'Description of the parameter'
|
description = 'Description of the parameter'
|
||||||
p = parameters.Parameter('p', {'Type': 'String',
|
p = self.new_parameter('p', {'Type': 'String',
|
||||||
'Description': description},
|
'Description': description},
|
||||||
validate_value=False)
|
validate_value=False)
|
||||||
self.assertEqual(p.description(), description)
|
self.assertEqual(p.description(), description)
|
||||||
|
|
||||||
def test_no_description(self):
|
def test_no_description(self):
|
||||||
p = parameters.Parameter('p', {'Type': 'String'}, validate_value=False)
|
p = self.new_parameter('p', {'Type': 'String'}, validate_value=False)
|
||||||
self.assertEqual(p.description(), '')
|
self.assertEqual(p.description(), '')
|
||||||
|
|
||||||
def test_string_len_good(self):
|
def test_string_len_good(self):
|
||||||
schema = {'Type': 'String',
|
schema = {'Type': 'String',
|
||||||
'MinLength': '3',
|
'MinLength': '3',
|
||||||
'MaxLength': '3'}
|
'MaxLength': '3'}
|
||||||
p = parameters.Parameter('p', schema, 'foo')
|
p = self.new_parameter('p', schema, 'foo')
|
||||||
self.assertEqual(p.value(), 'foo')
|
self.assertEqual(p.value(), 'foo')
|
||||||
|
|
||||||
def test_string_underflow(self):
|
def test_string_underflow(self):
|
||||||
@ -123,7 +132,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'ConstraintDescription': 'wibble',
|
'ConstraintDescription': 'wibble',
|
||||||
'MinLength': '4'}
|
'MinLength': '4'}
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, 'foo')
|
self.new_parameter('p', schema, 'foo')
|
||||||
except ValueError as ve:
|
except ValueError as ve:
|
||||||
msg = str(ve)
|
msg = str(ve)
|
||||||
self.assertNotEqual(msg.find('wibble'), -1)
|
self.assertNotEqual(msg.find('wibble'), -1)
|
||||||
@ -135,7 +144,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'ConstraintDescription': 'wibble',
|
'ConstraintDescription': 'wibble',
|
||||||
'MaxLength': '2'}
|
'MaxLength': '2'}
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, 'foo')
|
self.new_parameter('p', schema, 'foo')
|
||||||
except ValueError as ve:
|
except ValueError as ve:
|
||||||
msg = str(ve)
|
msg = str(ve)
|
||||||
self.assertNotEqual(msg.find('wibble'), -1)
|
self.assertNotEqual(msg.find('wibble'), -1)
|
||||||
@ -145,7 +154,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
def test_string_pattern_good(self):
|
def test_string_pattern_good(self):
|
||||||
schema = {'Type': 'String',
|
schema = {'Type': 'String',
|
||||||
'AllowedPattern': '[a-z]*'}
|
'AllowedPattern': '[a-z]*'}
|
||||||
p = parameters.Parameter('p', schema, 'foo')
|
p = self.new_parameter('p', schema, 'foo')
|
||||||
self.assertEqual(p.value(), 'foo')
|
self.assertEqual(p.value(), 'foo')
|
||||||
|
|
||||||
def test_string_pattern_bad_prefix(self):
|
def test_string_pattern_bad_prefix(self):
|
||||||
@ -153,7 +162,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'ConstraintDescription': 'wibble',
|
'ConstraintDescription': 'wibble',
|
||||||
'AllowedPattern': '[a-z]*'}
|
'AllowedPattern': '[a-z]*'}
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, '1foo')
|
self.new_parameter('p', schema, '1foo')
|
||||||
except ValueError as ve:
|
except ValueError as ve:
|
||||||
msg = str(ve)
|
msg = str(ve)
|
||||||
self.assertNotEqual(msg.find('wibble'), -1)
|
self.assertNotEqual(msg.find('wibble'), -1)
|
||||||
@ -165,7 +174,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'ConstraintDescription': 'wibble',
|
'ConstraintDescription': 'wibble',
|
||||||
'AllowedPattern': '[a-z]*'}
|
'AllowedPattern': '[a-z]*'}
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, 'foo1')
|
self.new_parameter('p', schema, 'foo1')
|
||||||
except ValueError as ve:
|
except ValueError as ve:
|
||||||
msg = str(ve)
|
msg = str(ve)
|
||||||
self.assertNotEqual(msg.find('wibble'), -1)
|
self.assertNotEqual(msg.find('wibble'), -1)
|
||||||
@ -175,7 +184,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
def test_string_value_list_good(self):
|
def test_string_value_list_good(self):
|
||||||
schema = {'Type': 'String',
|
schema = {'Type': 'String',
|
||||||
'AllowedValues': ['foo', 'bar', 'baz']}
|
'AllowedValues': ['foo', 'bar', 'baz']}
|
||||||
p = parameters.Parameter('p', schema, 'bar')
|
p = self.new_parameter('p', schema, 'bar')
|
||||||
self.assertEqual(p.value(), 'bar')
|
self.assertEqual(p.value(), 'bar')
|
||||||
|
|
||||||
def test_string_value_list_bad(self):
|
def test_string_value_list_bad(self):
|
||||||
@ -183,7 +192,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'ConstraintDescription': 'wibble',
|
'ConstraintDescription': 'wibble',
|
||||||
'AllowedValues': ['foo', 'bar', 'baz']}
|
'AllowedValues': ['foo', 'bar', 'baz']}
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, 'blarg')
|
self.new_parameter('p', schema, 'blarg')
|
||||||
except ValueError as ve:
|
except ValueError as ve:
|
||||||
msg = str(ve)
|
msg = str(ve)
|
||||||
self.assertNotEqual(msg.find('wibble'), -1)
|
self.assertNotEqual(msg.find('wibble'), -1)
|
||||||
@ -194,14 +203,14 @@ class ParameterTest(testtools.TestCase):
|
|||||||
schema = {'Type': 'Number',
|
schema = {'Type': 'Number',
|
||||||
'MinValue': '3',
|
'MinValue': '3',
|
||||||
'MaxValue': '3'}
|
'MaxValue': '3'}
|
||||||
p = parameters.Parameter('p', schema, '3')
|
p = self.new_parameter('p', schema, '3')
|
||||||
self.assertEqual(p.value(), '3')
|
self.assertEqual(p.value(), '3')
|
||||||
|
|
||||||
def test_number_float_good(self):
|
def test_number_float_good(self):
|
||||||
schema = {'Type': 'Number',
|
schema = {'Type': 'Number',
|
||||||
'MinValue': '3.0',
|
'MinValue': '3.0',
|
||||||
'MaxValue': '3.0'}
|
'MaxValue': '3.0'}
|
||||||
p = parameters.Parameter('p', schema, '3.0')
|
p = self.new_parameter('p', schema, '3.0')
|
||||||
self.assertEqual(p.value(), '3.0')
|
self.assertEqual(p.value(), '3.0')
|
||||||
|
|
||||||
def test_number_low(self):
|
def test_number_low(self):
|
||||||
@ -209,7 +218,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'ConstraintDescription': 'wibble',
|
'ConstraintDescription': 'wibble',
|
||||||
'MinValue': '4'}
|
'MinValue': '4'}
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, '3')
|
self.new_parameter('p', schema, '3')
|
||||||
except ValueError as ve:
|
except ValueError as ve:
|
||||||
msg = str(ve)
|
msg = str(ve)
|
||||||
self.assertNotEqual(msg.find('wibble'), -1)
|
self.assertNotEqual(msg.find('wibble'), -1)
|
||||||
@ -221,7 +230,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'ConstraintDescription': 'wibble',
|
'ConstraintDescription': 'wibble',
|
||||||
'MaxValue': '2'}
|
'MaxValue': '2'}
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, '3')
|
self.new_parameter('p', schema, '3')
|
||||||
except ValueError as ve:
|
except ValueError as ve:
|
||||||
msg = str(ve)
|
msg = str(ve)
|
||||||
self.assertNotEqual(msg.find('wibble'), -1)
|
self.assertNotEqual(msg.find('wibble'), -1)
|
||||||
@ -231,7 +240,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
def test_number_value_list_good(self):
|
def test_number_value_list_good(self):
|
||||||
schema = {'Type': 'Number',
|
schema = {'Type': 'Number',
|
||||||
'AllowedValues': ['1', '3', '5']}
|
'AllowedValues': ['1', '3', '5']}
|
||||||
p = parameters.Parameter('p', schema, '5')
|
p = self.new_parameter('p', schema, '5')
|
||||||
self.assertEqual(p.value(), '5')
|
self.assertEqual(p.value(), '5')
|
||||||
|
|
||||||
def test_number_value_list_bad(self):
|
def test_number_value_list_bad(self):
|
||||||
@ -239,7 +248,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'ConstraintDescription': 'wibble',
|
'ConstraintDescription': 'wibble',
|
||||||
'AllowedValues': ['1', '3', '5']}
|
'AllowedValues': ['1', '3', '5']}
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, '2')
|
self.new_parameter('p', schema, '2')
|
||||||
except ValueError as ve:
|
except ValueError as ve:
|
||||||
msg = str(ve)
|
msg = str(ve)
|
||||||
self.assertNotEqual(msg.find('wibble'), -1)
|
self.assertNotEqual(msg.find('wibble'), -1)
|
||||||
@ -249,7 +258,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
def test_list_value_list_good(self):
|
def test_list_value_list_good(self):
|
||||||
schema = {'Type': 'CommaDelimitedList',
|
schema = {'Type': 'CommaDelimitedList',
|
||||||
'AllowedValues': ['foo', 'bar', 'baz']}
|
'AllowedValues': ['foo', 'bar', 'baz']}
|
||||||
p = parameters.Parameter('p', schema, 'baz,foo,bar')
|
p = self.new_parameter('p', schema, 'baz,foo,bar')
|
||||||
self.assertEqual(p.value(), 'baz,foo,bar')
|
self.assertEqual(p.value(), 'baz,foo,bar')
|
||||||
|
|
||||||
def test_list_value_list_bad(self):
|
def test_list_value_list_bad(self):
|
||||||
@ -257,7 +266,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'ConstraintDescription': 'wibble',
|
'ConstraintDescription': 'wibble',
|
||||||
'AllowedValues': ['foo', 'bar', 'baz']}
|
'AllowedValues': ['foo', 'bar', 'baz']}
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, 'foo,baz,blarg')
|
self.new_parameter('p', schema, 'foo,baz,blarg')
|
||||||
except ValueError as ve:
|
except ValueError as ve:
|
||||||
msg = str(ve)
|
msg = str(ve)
|
||||||
self.assertNotEqual(msg.find('wibble'), -1)
|
self.assertNotEqual(msg.find('wibble'), -1)
|
||||||
@ -269,7 +278,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
schema = {'Type': 'Json'}
|
schema = {'Type': 'Json'}
|
||||||
val = {"foo": "bar", "items": [1, 2, 3]}
|
val = {"foo": "bar", "items": [1, 2, 3]}
|
||||||
val_s = json.dumps(val)
|
val_s = json.dumps(val)
|
||||||
p = parameters.Parameter('p', schema, val)
|
p = self.new_parameter('p', schema, val)
|
||||||
self.assertEqual(val_s, p.value())
|
self.assertEqual(val_s, p.value())
|
||||||
self.assertEqual(val, p.parsed)
|
self.assertEqual(val, p.parsed)
|
||||||
|
|
||||||
@ -279,7 +288,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'ConstraintDescription': 'wibble'}
|
'ConstraintDescription': 'wibble'}
|
||||||
val = {"foo": "bar", "not_json": len}
|
val = {"foo": "bar", "not_json": len}
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, val)
|
self.new_parameter('p', schema, val)
|
||||||
except ValueError as verr:
|
except ValueError as verr:
|
||||||
self.assertIn('Value must be valid JSON', str(verr))
|
self.assertIn('Value must be valid JSON', str(verr))
|
||||||
else:
|
else:
|
||||||
@ -290,7 +299,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
schema = {'Type': 'Json'}
|
schema = {'Type': 'Json'}
|
||||||
val = {"foo": "bar", "items": [1, 2, 3]}
|
val = {"foo": "bar", "items": [1, 2, 3]}
|
||||||
val_s = json.dumps(val)
|
val_s = json.dumps(val)
|
||||||
p = parameters.Parameter('p', schema, val_s)
|
p = self.new_parameter('p', schema, val_s)
|
||||||
self.assertEqual(val_s, p.value())
|
self.assertEqual(val_s, p.value())
|
||||||
self.assertEqual(val, p.parsed)
|
self.assertEqual(val, p.parsed)
|
||||||
|
|
||||||
@ -300,7 +309,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'ConstraintDescription': 'wibble'}
|
'ConstraintDescription': 'wibble'}
|
||||||
val = "I am not a map"
|
val = "I am not a map"
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, val)
|
self.new_parameter('p', schema, val)
|
||||||
except ValueError as verr:
|
except ValueError as verr:
|
||||||
self.assertIn('Value must be valid JSON', str(verr))
|
self.assertIn('Value must be valid JSON', str(verr))
|
||||||
else:
|
else:
|
||||||
@ -312,7 +321,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'AllowedValues': ["foo", "bar", "baz"]}
|
'AllowedValues': ["foo", "bar", "baz"]}
|
||||||
val = {"foo": "bar", "baz": [1, 2, 3]}
|
val = {"foo": "bar", "baz": [1, 2, 3]}
|
||||||
val_s = json.dumps(val)
|
val_s = json.dumps(val)
|
||||||
p = parameters.Parameter('p', schema, val_s)
|
p = self.new_parameter('p', schema, val_s)
|
||||||
self.assertEqual(val_s, p.value())
|
self.assertEqual(val_s, p.value())
|
||||||
self.assertEqual(val, p.parsed)
|
self.assertEqual(val, p.parsed)
|
||||||
|
|
||||||
@ -322,7 +331,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'AllowedValues': ["foo", "bar", "baz"]}
|
'AllowedValues': ["foo", "bar", "baz"]}
|
||||||
val = {"foo": "bar", "items": [1, 2, 3]}
|
val = {"foo": "bar", "items": [1, 2, 3]}
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, val)
|
self.new_parameter('p', schema, val)
|
||||||
except ValueError as verr:
|
except ValueError as verr:
|
||||||
self.assertIn("items", str(verr))
|
self.assertIn("items", str(verr))
|
||||||
else:
|
else:
|
||||||
@ -334,7 +343,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'MinLength': 3}
|
'MinLength': 3}
|
||||||
val = {"foo": "bar", "items": [1, 2, 3]}
|
val = {"foo": "bar", "items": [1, 2, 3]}
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, val)
|
self.new_parameter('p', schema, val)
|
||||||
except ValueError as verr:
|
except ValueError as verr:
|
||||||
self.assertIn('underflows', str(verr))
|
self.assertIn('underflows', str(verr))
|
||||||
else:
|
else:
|
||||||
@ -346,7 +355,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
'MaxLength': 1}
|
'MaxLength': 1}
|
||||||
val = {"foo": "bar", "items": [1, 2, 3]}
|
val = {"foo": "bar", "items": [1, 2, 3]}
|
||||||
try:
|
try:
|
||||||
parameters.Parameter('p', schema, val)
|
self.new_parameter('p', schema, val)
|
||||||
except ValueError as verr:
|
except ValueError as verr:
|
||||||
self.assertIn('overflows', str(verr))
|
self.assertIn('overflows', str(verr))
|
||||||
else:
|
else:
|
||||||
@ -355,7 +364,7 @@ class ParameterTest(testtools.TestCase):
|
|||||||
def test_missing_param(self):
|
def test_missing_param(self):
|
||||||
'''Test missing user parameter.'''
|
'''Test missing user parameter.'''
|
||||||
self.assertRaises(exception.UserParameterMissing,
|
self.assertRaises(exception.UserParameterMissing,
|
||||||
parameters.Parameter, 'p',
|
self.new_parameter, 'p',
|
||||||
{'Type': 'String'})
|
{'Type': 'String'})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user