summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/test_public.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-08-28 18:31:06 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-08-28 18:31:06 +0000
commita6ec94da601273719e44c69c4d7c23776ab30f3a (patch)
tree9da8b0eaea911aa7a7aa86e1957feb450e1e5828 /ipalib/tests/test_public.py
parent283c6f8fcec6a4687fd2cc99326a7f2b33e4e8bf (diff)
downloadfreeipa.git-a6ec94da601273719e44c69c4d7c23776ab30f3a.tar.gz
freeipa.git-a6ec94da601273719e44c69c4d7c23776ab30f3a.tar.xz
freeipa.git-a6ec94da601273719e44c69c4d7c23776ab30f3a.zip
217: Started work on new Option2 class that is more declarative and doesn't require subclassing from Option
Diffstat (limited to 'ipalib/tests/test_public.py')
-rw-r--r--ipalib/tests/test_public.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py
index 3ed1f5da..5b5d1d4b 100644
--- a/ipalib/tests/test_public.py
+++ b/ipalib/tests/test_public.py
@@ -22,7 +22,7 @@ Unit tests for `ipalib.public` module.
"""
from tstutil import raises, getitem, no_set, no_del, read_only, ClassChecker
-from ipalib import public, plugable, errors
+from ipalib import public, plugable, errors, ipa_types
def test_RULE_FLAG():
@@ -104,6 +104,33 @@ class test_DefaltFrom(ClassChecker):
assert o(**kw_copy) is None
+class test_Option2(ClassChecker):
+ """
+ Tests the `public.Option2` class.
+ """
+ _cls = public.Option2
+
+ def test_class(self):
+ assert self.cls.__bases__ == (plugable.ReadOnly,)
+
+ def test_init(self):
+ name = 'sn',
+ doc = 'Last Name',
+ type_ = ipa_types.Unicode()
+ o = self.cls(name, doc, type_)
+ assert o.__islocked__() is True
+ assert read_only(o, 'name') is name
+ assert read_only(o, 'doc') is doc
+ assert read_only(o, 'type') is type_
+ assert read_only(o, 'required') is False
+ assert read_only(o, 'multivalue') is False
+ assert read_only(o, 'default') is None
+ assert read_only(o, 'default_from') is None
+ assert read_only(o, 'rules') == (type_.validate,)
+
+
+
+
class test_Option(ClassChecker):
"""
Tests the `public.Option` class.