diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-24 21:29:15 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-24 21:29:15 +0000 |
commit | 566d5ea02a5dfdf6f0da0ce1a3f0bb656604c233 (patch) | |
tree | 913fc43715530c7d8153756bf8601137ae0c447e /ipalib/tests/test_frontend.py | |
parent | 5479a349a87458e8e1a7997ad16720778e65be96 (diff) | |
download | freeipa.git-566d5ea02a5dfdf6f0da0ce1a3f0bb656604c233.tar.gz freeipa.git-566d5ea02a5dfdf6f0da0ce1a3f0bb656604c233.tar.xz freeipa.git-566d5ea02a5dfdf6f0da0ce1a3f0bb656604c233.zip |
347: Added primary_key instance attribute to Param and corresponding kwarg; expanded unit tests for Param.__init__()
Diffstat (limited to 'ipalib/tests/test_frontend.py')
-rw-r--r-- | ipalib/tests/test_frontend.py | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/ipalib/tests/test_frontend.py b/ipalib/tests/test_frontend.py index cc71f1c9..3d01ed11 100644 --- a/ipalib/tests/test_frontend.py +++ b/ipalib/tests/test_frontend.py @@ -140,6 +140,8 @@ class test_Param(ClassChecker): type_ = ipa_types.Unicode() o = self.cls(name, type_) assert o.__islocked__() is True + + # Test default values assert read_only(o, 'name') is name assert read_only(o, 'type') is type_ assert read_only(o, 'doc') == '' @@ -149,12 +151,28 @@ class test_Param(ClassChecker): assert read_only(o, 'default_from') is None assert read_only(o, 'rules') == tuple() assert read_only(o, 'all_rules') == (type_.validate,) - - # Check default type_: + assert read_only(o, 'primary_key') is False + + # Test all kw args: + assert self.cls(name, doc='the doc').doc == 'the doc' + assert self.cls(name, required=False).required is False + assert self.cls(name, multivalue=True).multivalue is True + assert self.cls(name, default=u'Hello').default == u'Hello' + df = frontend.DefaultFrom(lambda f, l: f + l, + 'first', 'last', + ) + assert self.cls(name, default_from=df).default_from == df + rules = (lambda whatever: 'Not okay!',) + o = self.cls(name, rules=rules) + assert o.rules is rules + assert o.all_rules[1:] == rules + assert self.cls(name, primary_key=True).primary_key is True + + # Test default type_: o = self.cls(name) assert isinstance(o.type, ipa_types.Unicode) - # Check param spec parsing: + # Test param spec parsing: o = self.cls('name?') assert o.name == 'name' assert o.required is False |