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.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py
index 6662b9d0..8bff5a19 100644
--- a/ipalib/tests/test_public.py
+++ b/ipalib/tests/test_public.py
@@ -551,6 +551,19 @@ class test_Command(ClassChecker):
assert 'execute' in self.cls.__public__ # Public
def test_args_to_kw(self):
+ o = self.__get_instance(args=('one', 'two?'))
+ assert o.args_to_kw(1) == dict(one=1)
+ assert o.args_to_kw(1, 2) == dict(one=1, two=2)
+
+ o = self.__get_instance(args=('one', 'two*'))
+ assert o.args_to_kw(1) == dict(one=1)
+ assert o.args_to_kw(1, 2) == dict(one=1, two=(2,))
+ assert o.args_to_kw(1, 2, 3) == dict(one=1, two=(2, 3))
+
+ o = self.__get_instance(args=('one', 'two+'))
+ assert o.args_to_kw(1, 2) == dict(one=1, two=(2,))
+ assert o.args_to_kw(1, 2, 3) == dict(one=1, two=(2, 3))
+
o = self.__get_instance()
e = raises(errors.ArgumentError, o.args_to_kw, 1)
assert str(e) == 'example takes no arguments'