aboutsummaryrefslogtreecommitdiffstats
path: root/ice_validator/tests/helpers.py
diff options
context:
space:
mode:
authorstark, steven <ss820f@att.com>2018-09-13 16:49:43 -0700
committerstark, steven <ss820f@att.com>2018-09-13 17:21:45 -0700
commit31d5da59b39d38760cc519a2c5e5b70357b539e8 (patch)
tree7298d118aefb1e7494afa5cbedaa5e499b78373d /ice_validator/tests/helpers.py
parent8de26dd1cc9ed33c3ab85a5014ac949f174db932 (diff)
[VVP] udpating scripts for casablanca
adding new "infrastructure" scripts addresses bugs VVP-100, VVP-101, VVP-102 adding base tests updating tests where arguments have changed Adds traceability for task VVP-92 Change-Id: I067d8e80934403039e66fbc9fc93766587f67b4e Issue-ID: VVP-80 Signed-off-by: stark, steven <ss820f@att.com>
Diffstat (limited to 'ice_validator/tests/helpers.py')
-rw-r--r--ice_validator/tests/helpers.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/ice_validator/tests/helpers.py b/ice_validator/tests/helpers.py
index 5e4f3d3..502d3aa 100644
--- a/ice_validator/tests/helpers.py
+++ b/ice_validator/tests/helpers.py
@@ -41,8 +41,9 @@
"""Helpers
"""
+import os
from boltons import funcutils
-import yaml
+from tests import cached_yaml as yaml
VERSION = '1.1.0'
@@ -106,3 +107,20 @@ def validates(*requirement_ids):
return wrapper
decorator.requirement_ids = requirement_ids
return decorator
+
+
+def get_environment_pair(heat_template):
+ """Returns a yaml/env pair given a yaml file"""
+ base_dir, filename = os.path.split(heat_template)
+ basename = os.path.splitext(filename)[0]
+ env_template = os.path.join(base_dir, "{}.env".format(basename))
+ if os.path.exists(env_template):
+ with open(heat_template, "r") as fh:
+ yyml = yaml.load(fh)
+ with open(env_template, "r") as fh:
+ eyml = yaml.load(fh)
+
+ environment_pair = {"name": basename, "yyml": yyml, "eyml": eyml}
+ return environment_pair
+
+ return None