summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-09-10 14:54:01 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-09-10 14:54:01 +0000
commit2d85a6daa3798ee5feda1b2bda33300b73bed615 (patch)
tree7d93d47ae22cd27840b0476eb9c61793fafe2576 /ipalib
parentcbfacf7c2ee7387dc95494c6231fd9b256bb68cd (diff)
downloadfreeipa.git-2d85a6daa3798ee5feda1b2bda33300b73bed615.tar.gz
freeipa.git-2d85a6daa3798ee5feda1b2bda33300b73bed615.tar.xz
freeipa.git-2d85a6daa3798ee5feda1b2bda33300b73bed615.zip
281: Completed unit tests for Command.args
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/tests/test_public.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py
index 2c9fbce8..7c9a0244 100644
--- a/ipalib/tests/test_public.py
+++ b/ipalib/tests/test_public.py
@@ -422,11 +422,19 @@ class test_Command(ClassChecker):
assert ns.source.required is False
assert ns.source.multivalue is False
- # Test type error:
+ # Test TypeError:
e = raises(TypeError, self.__get_instance, args=(u'whatever',))
assert str(e) == \
'arg: need %r or %r; got %r' % (str, public.Option, u'whatever')
+ # Test ValueError, required after optional:
+ e = raises(ValueError, self.__get_instance, args=('arg1?', 'arg2'))
+ assert str(e) == 'arg2: required argument after optional'
+
+ # Test ValueError, scalar after multivalue:
+ e = raises(ValueError, self.__get_instance, args=('arg1+', 'arg2'))
+ assert str(e) == 'arg2: only final argument can be multivalue'
+
def test_Option(self):
"""
Tests the `public.Command.Option` property.