change if bad to assert not bad, message
[vvp/validation-scripts.git] / ice_validator / tests / test_vm_type_case.py
index a7dbdaf..6919404 100644 (file)
@@ -35,7 +35,6 @@
 #
 # ============LICENSE_END============================================
 #
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
 #
 
 """
@@ -66,8 +65,6 @@ resources:
 import collections
 import re
 
-import pytest
-
 from .structures import Heat
 from .helpers import validates
 
@@ -95,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)
@@ -116,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