Merge "Remove unnecessary check for pytest.skip"
[vvp/validation-scripts.git] / ice_validator / tests / test_heat_pairs_provided.py
index 2f4b74a..149a547 100644 (file)
@@ -6,7 +6,7 @@
 # ===================================================================
 #
 # Unless otherwise specified, all software contained herein is licensed
 # ===================================================================
 #
 # Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
+# under the Apache License, Version 2.0 (the "License");
 # you may not use this software except in compliance with the License.
 # You may obtain a copy of the License at
 #
 # you may not use this software except in compliance with the License.
 # You may obtain a copy of the License at
 #
@@ -21,7 +21,7 @@
 #
 #
 # Unless otherwise specified, all documentation contained herein is licensed
 #
 #
 # Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
 # you may not use this documentation except in compliance with the License.
 # You may obtain a copy of the License at
 #
 # you may not use this documentation except in compliance with the License.
 # You may obtain a copy of the License at
 #
 #
 # ============LICENSE_END============================================
 #
 #
 # ============LICENSE_END============================================
 #
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
 #
 
 from os import path
 
 #
 
 from os import path
 
+from .helpers import validates
 
 
+
+@validates(
+    "R-86285",
+    "R-38474",
+    "R-81725",
+    "R-53433",
+    "R-56438",
+    "R-74304",
+    "R-91342",
+    "R-94509",
+    "R-31141",
+)
 def test_heat_pairs_provided(heat_templates, env_files, volume_templates):
 def test_heat_pairs_provided(heat_templates, env_files, volume_templates):
-    '''
+    """
     Check that every yaml file is submitted with
     an associated env file, and every env has an
     associated yaml file.
     Check that every yaml file is submitted with
     an associated env file, and every env has an
     associated yaml file.
-    '''
+    """
 
 
+    env_files_missing_template = []
     for filename in env_files:
         basename = path.splitext(filename)[0]
     for filename in env_files:
         basename = path.splitext(filename)[0]
-        assert basename + '.yaml' in heat_templates or \
-            basename + '.yml' in heat_templates or \
-            basename + '.yml' in volume_templates or \
-            basename + '.yaml' in volume_templates
+        if not (
+            basename + ".yaml" in heat_templates
+            or basename + ".yml" in heat_templates
+            or basename + ".yml" in volume_templates
+            or basename + ".yaml" in volume_templates
+        ):
+            env_files_missing_template.append(filename)
+
+    heat_template_missing_env = []
     for filename in heat_templates:
         basename = path.splitext(filename)[0]
     for filename in heat_templates:
         basename = path.splitext(filename)[0]
-        assert basename + '.env' in env_files
+        if not basename + ".env" in env_files:
+            heat_template_missing_env.append(filename)
+
     for filename in volume_templates:
         basename = path.splitext(filename)[0]
     for filename in volume_templates:
         basename = path.splitext(filename)[0]
-        assert basename + '.env' in env_files
+        if not basename + ".env" in env_files:
+            heat_template_missing_env.append(filename)
+
+    msg = (
+        "Mismatched template and environment file pairs detected. "
+        + "Environment files with no matching template: {} ".format(
+            env_files_missing_template
+        )
+        + "Heat templates with no matching environment file: {}".format(
+            heat_template_missing_env
+        )
+    )
+
+    assert not (env_files_missing_template or heat_template_missing_env), msg