summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/test_public.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/tests/test_public.py')
-rw-r--r--ipalib/tests/test_public.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py
index 5dcbd84c..6662b9d0 100644
--- a/ipalib/tests/test_public.py
+++ b/ipalib/tests/test_public.py
@@ -550,6 +550,27 @@ class test_Command(ClassChecker):
"""
assert 'execute' in self.cls.__public__ # Public
+ def test_args_to_kw(self):
+ o = self.__get_instance()
+ e = raises(errors.ArgumentError, o.args_to_kw, 1)
+ assert str(e) == 'example takes no arguments'
+
+ o = self.__get_instance(args=('one?',))
+ e = raises(errors.ArgumentError, o.args_to_kw, 1, 2)
+ assert str(e) == 'example takes at most 1 argument'
+
+ o = self.__get_instance(args=('one', 'two?'))
+ e = raises(errors.ArgumentError, o.args_to_kw, 1, 2, 3)
+ assert str(e) == 'example takes at most 2 arguments'
+
+ o = self.__get_instance(args=('one', 'two?'))
+ e = raises(errors.ArgumentError, o.args_to_kw)
+ assert str(e) == 'example takes at least 1 argument'
+
+ o = self.__get_instance(args=('one', 'two', 'three?'))
+ e = raises(errors.ArgumentError, o.args_to_kw, 1)
+ assert str(e) == 'example takes at least 2 arguments'
+
class test_Object(ClassChecker):
"""