mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 07:33:27 -06:00
135: Added unit test for CLI dictoinary interface
This commit is contained in:
parent
0b5efa2a62
commit
76df64954d
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user