diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-13 06:25:42 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-13 06:25:42 +0000 |
commit | 337c9964d42066368460da9a7c0d770142e2d1c3 (patch) | |
tree | 9b9b1fd8671c93464250b1e1e66dfc5eb72b2b36 /ipalib/tests/test_cli.py | |
parent | 6924d5e25e237244e20554c380454a4029a0288f (diff) | |
download | freeipa.git-337c9964d42066368460da9a7c0d770142e2d1c3.tar.gz freeipa.git-337c9964d42066368460da9a7c0d770142e2d1c3.tar.xz freeipa.git-337c9964d42066368460da9a7c0d770142e2d1c3.zip |
145: Added new CLI.parse() method; added corresponding unit tests
Diffstat (limited to 'ipalib/tests/test_cli.py')
-rw-r--r-- | ipalib/tests/test_cli.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ipalib/tests/test_cli.py b/ipalib/tests/test_cli.py index e80dee43..4e2942d7 100644 --- a/ipalib/tests/test_cli.py +++ b/ipalib/tests/test_cli.py @@ -98,6 +98,23 @@ class test_CLI(ClassChecker): args = tuple('--%s=%s' % (cli.to_cli(k), v) for (k,v) in kw.items()) assert dict(o.parse_kw(args)) == kw + def test_parse(self): + """ + Tests the `parse` method. + """ + o = self.cls(None) + args = ['hello', 'naughty', 'nurse'] + kw = dict( + first_name='Naughty', + last_name='Nurse', + ) + opts = ['--%s=%s' % (k.replace('_', '-'), v) for (k, v) in kw.items()] + assert o.parse(args + []) == (args, {}) + assert o.parse(opts + []) == ([], kw) + assert o.parse(args + opts) == (args, kw) + assert o.parse(opts + args) == (args, kw) + + def test_mcl(self): """ Tests the `mcl` (Max Command Length) property . |