X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ice_validator%2Ftests%2Ftest_heat_template_structure.py;h=cc05df98974a6e79048a06e2fc0dcecbdd27982e;hb=refs%2Fchanges%2F69%2F56969%2F3;hp=0d8242eeb221250da5d144cb4131024bb60e846f;hpb=c42086a36bbfaf9286e1c08330f25d1b06a35f4b;p=vvp%2Fvalidation-scripts.git 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)