diff options
author | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2013-08-16 08:32:41 +0000 |
---|---|---|
committer | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2013-08-16 13:05:18 +0000 |
commit | 2514eb9717ab6f8161d1fb403ca2bfff9e1169ea (patch) | |
tree | c3fb8f8f6a8ca4ed0decd978648f5f79908057ea /morphlib/util_tests.py | |
parent | 0a5ef89e107c22a5d1931838526fe3b22af42b95 (diff) | |
download | morph-2514eb9717ab6f8161d1fb403ca2bfff9e1169ea.tar.gz |
Utility function to convert all values in a dictionary to strings
This will be useful in the next commit, where we want
to construct an environment to run a command from a
dictionary.
The cliapp runcmd method expects that the values in this
dictionary are strings, so we need to convert them before.
Diffstat (limited to 'morphlib/util_tests.py')
-rw-r--r-- | morphlib/util_tests.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/morphlib/util_tests.py b/morphlib/util_tests.py index ca9fe5ae..2ad9e8aa 100644 --- a/morphlib/util_tests.py +++ b/morphlib/util_tests.py @@ -105,3 +105,8 @@ class ParseEnvironmentPairsTests(unittest.TestCase): morphlib.util.parse_environment_pairs, {"foo": "bar"}, ["foo=bar"]) + + def test_sanitize_environment(self): + d = { 'a': 1 } + morphlib.util.sanitize_environment(d) + self.assertTrue(isinstance(d['a'], str)) |