diff options
-rw-r--r-- | ipalib/tests/test_cli.py | 16 |
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) |