summaryrefslogtreecommitdiff
path: root/morphlib/util_tests.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2013-08-13 09:53:32 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2013-08-13 14:21:52 +0000
commitec6d4e10304293157ba61501b7f053cb1cbc142a (patch)
tree144869b0f95956aac6756ad3016221580f835028 /morphlib/util_tests.py
parentc38b5ddeb6359f6f848553bcfdde52365c807ab4 (diff)
downloadmorph-ec6d4e10304293157ba61501b7f053cb1cbc142a.tar.gz
deploy: refactor environment argument parsing
It is now a tested helper function in morphlib.util
Diffstat (limited to 'morphlib/util_tests.py')
-rw-r--r--morphlib/util_tests.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/morphlib/util_tests.py b/morphlib/util_tests.py
index eaff0821..ca9fe5ae 100644
--- a/morphlib/util_tests.py
+++ b/morphlib/util_tests.py
@@ -87,3 +87,21 @@ class FindParentOfTests(unittest.TestCase):
def test_find_leaf_returns_none_if_not_found(self):
self.assertEqual(morphlib.util.find_leaf(self.a, '.magic'), None)
+
+class ParseEnvironmentPairsTests(unittest.TestCase):
+
+ def test_parse_environment_pairs_adds_key(self):
+ ret = morphlib.util.parse_environment_pairs({}, ["foo=bar"])
+ self.assertEqual(ret.get("foo"), "bar")
+
+ def test_parse_environment_does_not_alter_passed_dict(self):
+ d = {}
+ morphlib.util.parse_environment_pairs(d, ["foo=bar"])
+ self.assertTrue("foo" not in d)
+
+ def test_parse_environment_raises_on_duplicates(self):
+ self.assertRaises(
+ morphlib.util.EnvironmentAlreadySetError,
+ morphlib.util.parse_environment_pairs,
+ {"foo": "bar"},
+ ["foo=bar"])