diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-24 06:25:12 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-24 06:25:12 +0000 |
commit | 6bedb15674ba941c15832ac84387a40ecd2a2879 (patch) | |
tree | 6db19de57d0edd207cacfc15b4fc9c0c4950b346 /ipalib/tests | |
parent | d56f4c643b486bfbcb6523a0fe80252343fa594e (diff) | |
download | freeipa-6bedb15674ba941c15832ac84387a40ecd2a2879.tar.gz freeipa-6bedb15674ba941c15832ac84387a40ecd2a2879.tar.xz freeipa-6bedb15674ba941c15832ac84387a40ecd2a2879.zip |
332: Param.normalize() now returns None if multivalue and len() == 0
Diffstat (limited to 'ipalib/tests')
-rw-r--r-- | ipalib/tests/test_frontend.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ipalib/tests/test_frontend.py b/ipalib/tests/test_frontend.py index c473ad581..63cc92148 100644 --- a/ipalib/tests/test_frontend.py +++ b/ipalib/tests/test_frontend.py @@ -111,9 +111,9 @@ class test_DefaultFrom(ClassChecker): assert o(**kw_copy) is None -class test_Option(ClassChecker): +class test_Param(ClassChecker): """ - Tests the `frontend.Param` class. + Test the `frontend.Param` class. """ _cls = frontend.Param @@ -122,7 +122,7 @@ class test_Option(ClassChecker): def test_init(self): """ - Tests the `frontend.Param.__init__` method. + Test the `frontend.Param.__init__` method. """ name = 'sn' type_ = ipa_types.Unicode() @@ -139,7 +139,7 @@ class test_Option(ClassChecker): def test_convert(self): """ - Tests the `frontend.Param.convert` method. + Test the `frontend.Param.convert` method. """ name = 'some_number' type_ = ipa_types.Int() @@ -184,7 +184,7 @@ class test_Option(ClassChecker): def test_normalize(self): """ - Tests the `frontend.Param.normalize` method. + Test the `frontend.Param.normalize` method. """ name = 'sn' t = ipa_types.Unicode() @@ -212,6 +212,8 @@ class test_Option(ClassChecker): # Scenario 4: multivalue=True, normalize=callback o = self.cls(name, t, multivalue=True, normalize=callback) + assert o.normalize([]) is None + assert o.normalize(tuple()) is None for value in [(u'Hello',), (u'hello',), 'Hello', ['Hello']]: # Okay assert o.normalize(value) == (u'hello',) fail = 42 # Not basestring |