summaryrefslogtreecommitdiff
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorAanand Prasad <aanand.prasad@gmail.com>2016-02-05 17:03:05 +0000
committerAanand Prasad <aanand.prasad@gmail.com>2016-03-02 15:09:48 -0800
commit2c75a8fdf556329acf1a8442cd9ac5f1e94be8cc (patch)
tree3f61bfe7daf6e60559bdad7d8fe76aded306c5d1 /tests/helpers.py
parent3f3c05e465ab7b7cc5bda11f42f27eeef70fc2e8 (diff)
Extract helper methods for building config objects from dicts
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
new file mode 100644
index 00000000..dd0b668e
--- /dev/null
+++ b/tests/helpers.py
@@ -0,0 +1,16 @@
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
+from compose.config.config import ConfigDetails
+from compose.config.config import ConfigFile
+from compose.config.config import load
+
+
+def build_config(contents, **kwargs):
+ return load(build_config_details(contents, **kwargs))
+
+
+def build_config_details(contents, working_dir='working_dir', filename='filename.yml'):
+ return ConfigDetails(
+ working_dir,
+ [ConfigFile(filename, contents)])