summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/test_public.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-08-11 00:21:12 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-08-11 00:21:12 +0000
commit879133d28a2da2d675d72a3f4e178f5bc4c82594 (patch)
tree4117f9be6bf86371c6fd15faa62f11b6515dca8c /ipalib/tests/test_public.py
parentf6b69a590500cf8c141545a1f95d59817eb5a27e (diff)
downloadfreeipa.git-879133d28a2da2d675d72a3f4e178f5bc4c82594.tar.gz
freeipa.git-879133d28a2da2d675d72a3f4e178f5bc4c82594.tar.xz
freeipa.git-879133d28a2da2d675d72a3f4e178f5bc4c82594.zip
105: Added a default implementation of cmd.get_options; added corresponding unit tests
Diffstat (limited to 'ipalib/tests/test_public.py')
-rw-r--r--ipalib/tests/test_public.py33
1 files changed, 30 insertions, 3 deletions
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py
index 68f25567..91d1f724 100644
--- a/ipalib/tests/test_public.py
+++ b/ipalib/tests/test_public.py
@@ -157,9 +157,36 @@ class test_option(ClassChecker):
assert self.cls().default() is None
-def test_cmd():
- cls = public.cmd
- assert issubclass(cls, plugable.Plugin)
+class test_cmd(ClassChecker):
+ """
+ Tests the `cmd` class.
+ """
+ _cls = public.cmd
+
+ def get_subcls(self):
+ class option0(public.option):
+ pass
+ class option1(public.option):
+ pass
+ class example(self.cls):
+ option_classes = (option0, option1)
+ return example
+
+ def test_class(self):
+ assert self.cls.__bases__ == (plugable.Plugin,)
+ assert type(self.cls.options) == property
+
+ def test_get_options(self):
+ """
+ Tests the `get_options` method.
+ """
+ assert list(self.cls().get_options()) == []
+ sub = self.subcls()
+ for (i, proxy) in enumerate(sub.get_options()):
+ assert isinstance(proxy, plugable.Proxy)
+ assert read_only(proxy, 'name') == 'option%d' % i
+ assert proxy.implements(public.option)
+ assert i == 1
def test_obj():