diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-10 20:05:45 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-10 20:05:45 +0000 |
commit | 100492d98a199169a985086c20746dea7ff1fd3e (patch) | |
tree | 9562a2d69c60b57ab7320a28429e4de60fedadd2 /ipalib/tests | |
parent | 687f60356203a33b7af24842f24570a12d9b2039 (diff) | |
download | freeipa-100492d98a199169a985086c20746dea7ff1fd3e.tar.gz freeipa-100492d98a199169a985086c20746dea7ff1fd3e.tar.xz freeipa-100492d98a199169a985086c20746dea7ff1fd3e.zip |
285: Started work on Command.args_to_kw() method; added unit test for functionality so far in args_to_kw()
Diffstat (limited to 'ipalib/tests')
-rw-r--r-- | ipalib/tests/test_public.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py index 5dcbd84ca..6662b9d05 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): """ |