diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-25 02:13:16 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-25 02:13:16 +0000 |
commit | 023f612921b4d9cbd15e3148d09c02932a61d73e (patch) | |
tree | c057625096fa46123f653876e7d20760237e8119 /ipalib/tests | |
parent | 9f704e001daf760de92c590f69582fc7ffd0c0f2 (diff) | |
download | freeipa-023f612921b4d9cbd15e3148d09c02932a61d73e.tar.gz freeipa-023f612921b4d9cbd15e3148d09c02932a61d73e.tar.xz freeipa-023f612921b4d9cbd15e3148d09c02932a61d73e.zip |
361: Implemented crud.Add.get_options() method; added corresponding unit tests
Diffstat (limited to 'ipalib/tests')
-rw-r--r-- | ipalib/tests/test_crud.py | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/ipalib/tests/test_crud.py b/ipalib/tests/test_crud.py index d708d8082..41eb88346 100644 --- a/ipalib/tests/test_crud.py +++ b/ipalib/tests/test_crud.py @@ -22,7 +22,23 @@ Unit tests for `ipalib.crud` module. """ from tstutil import read_only, raises, ClassChecker -from ipalib import crud, frontend +from ipalib import crud, frontend, plugable + +def get_api(): + api = plugable.API( + frontend.Object, + frontend.Method, + frontend.Property, + ) + class user(frontend.Object): + takes_params = ( + 'givenname', + 'sn', + frontend.Param('uid', primary_key=True), + 'initials', + ) + api.register(user) + return api class test_Add(ClassChecker): @@ -35,6 +51,20 @@ class test_Add(ClassChecker): def test_class(self): assert self.cls.__bases__ == (frontend.Method,) + def test_get_options(self): + """ + Test the `crud.Add.get_options` method. + """ + api = get_api() + class user_add(self.cls): + pass + api.register(user_add) + api.finalize() + assert list(api.Method.user_add.args) == [] + assert list(api.Method.user_add.options) == \ + ['givenname', 'sn', 'uid', 'initials'] + + class test_Get(ClassChecker): """ |