summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/test_cli.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-08-13 02:00:31 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-08-13 02:00:31 +0000
commit76df64954d468e00197b8e26f685f51ce096adb0 (patch)
treef04a7a83acd0a4a94b6401cb3cc9cb5a66eb6abc /ipalib/tests/test_cli.py
parent0b5efa2a62623e09c7e8e5e97e0feafbc5e19823 (diff)
downloadfreeipa.git-76df64954d468e00197b8e26f685f51ce096adb0.tar.gz
freeipa.git-76df64954d468e00197b8e26f685f51ce096adb0.tar.xz
freeipa.git-76df64954d468e00197b8e26f685f51ce096adb0.zip
135: Added unit test for CLI dictoinary interface
Diffstat (limited to 'ipalib/tests/test_cli.py')
-rw-r--r--ipalib/tests/test_cli.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/ipalib/tests/test_cli.py b/ipalib/tests/test_cli.py
index c523e4e8..7892227d 100644
--- a/ipalib/tests/test_cli.py
+++ b/ipalib/tests/test_cli.py
@@ -106,3 +106,19 @@ class test_CLI(ClassChecker):
assert o.mcl is None
o.finalize()
assert o.mcl == 6 # len('cmd_99')
+
+ def test_dict(self):
+ """
+ Tests the `__contains__` and `__getitem__` methods.
+ """
+ cnt = 25
+ api = DummyAPI(cnt)
+ assert len(api.cmd) == cnt
+ o = self.cls(api)
+ o.finalize()
+ for cmd in api.cmd:
+ key = cli.to_cli(cmd.name)
+ assert key in o
+ assert o[key] is cmd
+ assert cmd.name not in o
+ raises(KeyError, getitem, o, cmd.name)