X-Git-Url: https://gerrit.onap.org/r/gitweb?p=vvp%2Fvalidation-scripts.git;a=blobdiff_plain;f=ice_validator%2Ftests%2Ftest_vm_type_case.py;h=6919404024017b9e54f84deb0be19fc165d7a0a2;hp=34d0a6f4507a5c024cc023ff7557a46b115f6c41;hb=00c64458942602efe5a3b712540b98ac94fb60f4;hpb=ab01f96b1405bc037853847138a121581bb98f05 diff --git a/ice_validator/tests/test_vm_type_case.py b/ice_validator/tests/test_vm_type_case.py index 34d0a6f..6919404 100644 --- a/ice_validator/tests/test_vm_type_case.py +++ b/ice_validator/tests/test_vm_type_case.py @@ -65,8 +65,6 @@ resources: import collections import re -import pytest - from .structures import Heat from .helpers import validates @@ -94,15 +92,13 @@ def case_mismatch(vm_type, param): @validates("R-32394") -def test_vm_type_case(heat_template): +def test_vm_type_case(yaml_file): """ A VNF's Heat Orchestration Template's use of ``{vm-type}`` in all Resource property parameter names **MUST** be the same case. """ - heat = Heat(filepath=heat_template) + heat = Heat(filepath=yaml_file) resources = heat.resources - if not resources: - pytest.skip("No resources found") bad = collections.defaultdict(list) for rid, resource in resources.items(): vm_type = heat.get_vm_type(rid, resource=resource) @@ -115,14 +111,10 @@ def test_vm_type_case(heat_template): param = param[0] if isinstance(param, str) and case_mismatch(vm_type, param): bad[(rid, vm_type)].append((prop, param)) - if bad: - raise AssertionError( - "vm-type/parameter case mis-match %s" - % ( - "; ".join( - "resource: %s vm-type: %s %s" - % (k[0], k[1], ", ".join("%s: %s" % i for i in v)) - for k, v in bad.items() - ) - ) - ) + + msg = 'vm-type/parameter case mis-match %s' \ + % '; '.join('resource: %s vm-type: %s %s' % (k[0], k[1], + ', '.join('%s: %s' % i for i in v)) for (k, v) in + bad.items()) + + assert not bad, msg