summaryrefslogtreecommitdiffstats
path: root/tests/test_ipalib/test_crud.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-10-09 11:33:35 -0600
committerJason Gerard DeRose <jderose@redhat.com>2008-10-09 11:33:35 -0600
commit87390665f6998116ec2429773088c7165e281611 (patch)
tree43e1c04030abb97bef69ce685617980029378818 /tests/test_ipalib/test_crud.py
parent887016e69d6678892a2ff53735623ce5d413b074 (diff)
downloadfreeipa-87390665f6998116ec2429773088c7165e281611.tar.gz
freeipa-87390665f6998116ec2429773088c7165e281611.tar.xz
freeipa-87390665f6998116ec2429773088c7165e281611.zip
crud.Add.get_args() and get_options() now yield static values in takes_args, takes_options after the automagic ones
Diffstat (limited to 'tests/test_ipalib/test_crud.py')
-rw-r--r--tests/test_ipalib/test_crud.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py
index 1e538cc13..37da503b5 100644
--- a/tests/test_ipalib/test_crud.py
+++ b/tests/test_ipalib/test_crud.py
@@ -30,7 +30,7 @@ class CrudChecker(ClassChecker):
Class for testing base classes in `ipalib.crud`.
"""
- def get_api(self):
+ def get_api(self, args=tuple(), options={}):
"""
Return a finalized `ipalib.plugable.API` instance.
"""
@@ -49,7 +49,8 @@ class CrudChecker(ClassChecker):
'initials',
)
class user_verb(self.cls):
- pass
+ takes_args = args
+ takes_options = options
api.register(user)
api.register(user_verb)
api.finalize()
@@ -70,6 +71,10 @@ class test_Add(CrudChecker):
api = self.get_api()
assert list(api.Method.user_verb.args) == ['uid']
assert api.Method.user_verb.args.uid.required is True
+ api = self.get_api(args=('extra?',))
+ assert list(api.Method.user_verb.args) == ['uid', 'extra']
+ assert api.Method.user_verb.args.uid.required is True
+ assert api.Method.user_verb.args.extra.required is False
def test_get_options(self):
"""
@@ -80,6 +85,10 @@ class test_Add(CrudChecker):
['givenname', 'sn', 'initials']
for param in api.Method.user_verb.options():
assert param.required is True
+ api = self.get_api(options=('extra?',))
+ assert list(api.Method.user_verb.options) == \
+ ['givenname', 'sn', 'initials', 'extra']
+ assert api.Method.user_verb.options.extra.required is False
class test_Get(CrudChecker):