summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-10-27 19:21:49 -0600
committerJason Gerard DeRose <jderose@redhat.com>2008-10-27 19:21:49 -0600
commit9b1e3f59465c6ba33f4266bc3add469b5e1711eb (patch)
tree300d9b7b798c89bc7d9ca23a9dc42de3e8916b4a /tests
parent491e295412fceead7cf0c6c9cdd44904541e4044 (diff)
downloadfreeipa-9b1e3f59465c6ba33f4266bc3add469b5e1711eb.tar.gz
freeipa-9b1e3f59465c6ba33f4266bc3add469b5e1711eb.tar.xz
freeipa-9b1e3f59465c6ba33f4266bc3add469b5e1711eb.zip
More docstrings, functionality, and unit tests for improved CLI class
Diffstat (limited to 'tests')
-rw-r--r--tests/test_ipalib/test_cli.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/test_ipalib/test_cli.py b/tests/test_ipalib/test_cli.py
index 389bb52c1..7bcbfb0c6 100644
--- a/tests/test_ipalib/test_cli.py
+++ b/tests/test_ipalib/test_cli.py
@@ -115,6 +115,17 @@ class test_CLI(ClassChecker):
assert o.api is api
return (o, api, home)
+ def check_cascade(self, *names):
+ (o, api, home) = self.new()
+ method = getattr(o, names[0])
+ for name in names:
+ assert o.isdone(name) is False
+ method()
+ for name in names:
+ assert o.isdone(name) is True
+ e = raises(StandardError, method)
+ assert str(e) == 'CLI.%s() already called' % names[0]
+
def test_init(self):
"""
Test the `ipalib.cli.CLI.__init__` method.
@@ -201,3 +212,36 @@ class test_CLI(ClassChecker):
assert api.env.from_default_conf == 'set in default.conf'
assert api.env.from_cli_conf == 'set in cli.conf'
assert list(api.env) == sorted(keys + added)
+
+ def test_load_plugins(self):
+ """
+ Test the `ipalib.cli.CLI.load_plugins` method.
+ """
+ self.check_cascade(
+ 'load_plugins',
+ 'bootstrap',
+ 'parse_globals'
+ )
+ (o, api, home) = self.new()
+ assert api.isdone('load_plugins') is False
+ o.load_plugins()
+ assert api.isdone('load_plugins') is True
+
+ def test_finalize(self):
+ """
+ Test the `ipalib.cli.CLI.finalize` method.
+ """
+ self.check_cascade(
+ 'finalize',
+ 'load_plugins',
+ 'bootstrap',
+ 'parse_globals'
+ )
+
+ (o, api, home) = self.new()
+ assert api.isdone('finalize') is False
+ assert 'Command' not in api
+ o.finalize()
+ assert api.isdone('finalize') is True
+ assert list(api.Command) == \
+ sorted(k.__name__ for k in cli.cli_application_commands)