summaryrefslogtreecommitdiffstats
path: root/ipalib/tests
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-07-19 08:31:46 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-07-19 08:31:46 +0000
commit26c9f4c8818e9904dab838ac95839c0d527219b8 (patch)
tree3d83f1d2bbab8508e7b5ff2904300e097fb07645 /ipalib/tests
parent91adc9c2d060b65d96a8515d08fc7192be79da83 (diff)
downloadfreeipa-26c9f4c8818e9904dab838ac95839c0d527219b8.tar.gz
freeipa-26c9f4c8818e9904dab838ac95839c0d527219b8.tar.xz
freeipa-26c9f4c8818e9904dab838ac95839c0d527219b8.zip
7: Roughed out API.finalize(); added corresponding unit tests
Diffstat (limited to 'ipalib/tests')
-rw-r--r--ipalib/tests/test_base.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/ipalib/tests/test_base.py b/ipalib/tests/test_base.py
index bf727ed6..81794d7a 100644
--- a/ipalib/tests/test_base.py
+++ b/ipalib/tests/test_base.py
@@ -267,8 +267,7 @@ class test_API:
Test expectations of a fresh API instance.
"""
api = self.new()
- assert read_only(api, 'objects') is None
- assert read_only(api, 'objects') is None
+ assert read_only(api, 'cmd') is None
def test_register_command(self):
api = self.new()
@@ -314,3 +313,28 @@ class test_API:
# Check that override=True works:
api.register_command(cmd_my_command, override=True)
+
+ def test_finalize(self):
+ api = self.new()
+ assert read_only(api, 'cmd') is None
+
+ class cmd_my_command(base.Command):
+ pass
+ class cmd_another_command(base.Command):
+ pass
+
+ api.register_command(cmd_my_command)
+ api.register_command(cmd_another_command)
+
+ api.finalize()
+
+ cmd = read_only(api, 'cmd')
+ assert isinstance(cmd, base.NameSpace)
+ assert api.cmd is cmd
+
+ assert len(cmd) == 2
+ assert list(cmd) == ['another_command', 'my_command']
+ assert isinstance(cmd.my_command, cmd_my_command)
+ assert cmd.my_command is cmd['my_command']
+ assert isinstance(cmd.another_command, cmd_another_command)
+ assert cmd.another_command is cmd['another_command']