summaryrefslogtreecommitdiff
path: root/tests/unittests/test_util.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-04-04 21:35:32 -0400
committerScott Moser <smoser@ubuntu.com>2012-04-04 21:35:32 -0400
commit7b2fc4e014e6b7a43e6b8fc719d82c3d0b0a8bed (patch)
tree12859523160be456f76e0d0c33010bd6f0452ce8 /tests/unittests/test_util.py
parentb39abf5bbe51d62d1ef1dd1e813720eafc1ddc85 (diff)
downloadvyos-cloud-init-7b2fc4e014e6b7a43e6b8fc719d82c3d0b0a8bed.tar.gz
vyos-cloud-init-7b2fc4e014e6b7a43e6b8fc719d82c3d0b0a8bed.zip
initial checkin of kernel commandline cloud-config url support
Diffstat (limited to 'tests/unittests/test_util.py')
-rw-r--r--tests/unittests/test_util.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py
index ca96bc60..e8f5885c 100644
--- a/tests/unittests/test_util.py
+++ b/tests/unittests/test_util.py
@@ -6,7 +6,8 @@ import os
import stat
from cloudinit.util import (mergedict, get_cfg_option_list_or_str, write_file,
- delete_dir_contents)
+ delete_dir_contents, get_cmdline,
+ keyval_str_to_dict)
class TestMergeDict(TestCase):
@@ -248,3 +249,18 @@ class TestDeleteDirContents(TestCase):
delete_dir_contents(self.tmp)
self.assertDirEmpty(self.tmp)
+
+
+class TestKeyValStrings(TestCase):
+ def test_keyval_str_to_dict(self):
+ expected = {'1': 'one', '2': 'one+one', 'ro': True}
+ cmdline = "1=one ro 2=one+one"
+ self.assertEqual(expected, keyval_str_to_dict(cmdline))
+
+
+class TestGetCmdline(TestCase):
+ def test_cmdline_reads_debug_env(self):
+ os.environ['DEBUG_PROC_CMDLINE'] = 'abcd 123'
+ self.assertEqual(os.environ['DEBUG_PROC_CMDLINE'], get_cmdline())
+
+# vi: ts=4 expandtab