~ubuntu-branches/ubuntu/saucy/cloud-init/saucy

« back to all changes in this revision

Viewing changes to tests/unittests/test_util.py

  • Committer: Package Import Robot
  • Author(s): Scott Moser
  • Date: 2012-04-05 01:24:42 UTC
  • mfrom: (174.2.15 precise)
  • mto: (223.3.1 quantal)
  • mto: This revision was merged to the branch mainline in revision 290.
  • Revision ID: package-import@ubuntu.com-20120405012442-e42fxr72hshp6sqx
* New upstream snapshot.
  * Fix bug in Chef support that required 'validation_cert' (LP: #960547)
  * Provide user-friendly message when a user ssh's in with an invalid
    locale (LP: #960547)
  * Support reading a url reference to cloud-config from the kernel
    command line.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
import stat
7
7
 
8
8
from cloudinit.util import (mergedict, get_cfg_option_list_or_str, write_file,
9
 
                            delete_dir_contents)
 
9
                            delete_dir_contents, get_cmdline,
 
10
                            keyval_str_to_dict)
10
11
 
11
12
 
12
13
class TestMergeDict(TestCase):
248
249
        delete_dir_contents(self.tmp)
249
250
 
250
251
        self.assertDirEmpty(self.tmp)
 
252
 
 
253
 
 
254
class TestKeyValStrings(TestCase):
 
255
    def test_keyval_str_to_dict(self):
 
256
        expected = {'1': 'one', '2': 'one+one', 'ro': True}
 
257
        cmdline = "1=one ro 2=one+one"
 
258
        self.assertEqual(expected, keyval_str_to_dict(cmdline))
 
259
 
 
260
 
 
261
class TestGetCmdline(TestCase):
 
262
    def test_cmdline_reads_debug_env(self):
 
263
        os.environ['DEBUG_PROC_CMDLINE'] = 'abcd 123'
 
264
        self.assertEqual(os.environ['DEBUG_PROC_CMDLINE'], get_cmdline())
 
265
 
 
266
# vi: ts=4 expandtab