aboutsummaryrefslogtreecommitdiffstats
path: root/ice_validator/tests/test_heat_template_structure.py
diff options
context:
space:
mode:
authorstark, steven <ss820f@att.com>2018-07-19 14:23:39 -0700
committerstark, steven <ss820f@att.com>2018-07-19 15:27:56 -0700
commite99347bb14318a57307e2809c3d9577fc29bcb68 (patch)
tree39e7752de2f9e15a6ed590b6d66594be62549637 /ice_validator/tests/test_heat_template_structure.py
parentc42086a36bbfaf9286e1c08330f25d1b06a35f4b (diff)
[VNFRQTS] update decorator for validation script
update decorator for validation script corresponding to 5.2.1 of VNFRTQS update decorator for validation script corresponding to 5.2.2 of VNFRTQS Change-Id: I063e799a27c76bb58c031273aca48031965849d9 Issue-ID: VVP-88 Signed-off-by: stark, steven <ss820f@att.com>
Diffstat (limited to 'ice_validator/tests/test_heat_template_structure.py')
-rw-r--r--ice_validator/tests/test_heat_template_structure.py31
1 files changed, 28 insertions, 3 deletions
diff --git a/ice_validator/tests/test_heat_template_structure.py b/ice_validator/tests/test_heat_template_structure.py
index 0d8242e..cc05df9 100644
--- a/ice_validator/tests/test_heat_template_structure.py
+++ b/ice_validator/tests/test_heat_template_structure.py
@@ -51,10 +51,10 @@ def test_heat_template_structure(yaml_file):
with open(yaml_file) as fh:
yml = yaml.load(fh)
- assert any(map(lambda v: v in yml, key_values))
+ assert all([k in key_values for k in yml])
-@validates('27078', 'R-39402', 'R-35414')
+@validates('R-27078', 'R-39402', 'R-35414')
def test_heat_template_structure_contains_required_sections(yaml_file):
'''
Check that all heat templates have the required sections
@@ -64,7 +64,7 @@ def test_heat_template_structure_contains_required_sections(yaml_file):
with open(yaml_file) as fh:
yml = yaml.load(fh)
- assert any(map(lambda v: v in yml, required_key_values))
+ assert all([k in yml for k in required_key_values])
def test_heat_template_structure_sections_have_the_right_format(yaml_file):
@@ -96,3 +96,28 @@ def test_heat_template_structure_sections_have_the_right_format(yaml_file):
should_not_be_dict += 1
assert (is_dict == should_be_dict and
is_not_dict == should_not_be_dict)
+
+
+@validates('R-11441')
+def test_parameter_type(yaml_file):
+ types = [
+ 'string',
+ 'number',
+ 'json',
+ 'comma_delimited_list',
+ 'boolean',
+ ]
+ with open(yaml_file) as fh:
+ yml = yaml.load(fh)
+ for key, param in yml.get('parameters', {}).items():
+ assert isinstance(param, dict), '%s parameter %s is not dict' % (
+ yaml_file,
+ key)
+ assert 'type' in param, '%s parameter %s has no "type"' % (
+ yaml_file,
+ key)
+ typ = param['type']
+ assert typ in types, '%s parameter %s has invalid type "%s"' % (
+ yaml_file,
+ key,
+ typ)