summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-09-25 03:14:12 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-09-25 03:14:12 +0000
commitc303a06a948d1813336161e2546bd85f8edead56 (patch)
tree0988c1169ac601442e2668c77b30443c2b5dcc23
parent023f612921b4d9cbd15e3148d09c02932a61d73e (diff)
downloadfreeipa-c303a06a948d1813336161e2546bd85f8edead56.tar.gz
freeipa-c303a06a948d1813336161e2546bd85f8edead56.tar.xz
freeipa-c303a06a948d1813336161e2546bd85f8edead56.zip
362: Implemented Get.get_args() and Del.get_args(); added corresponding unit tests
-rw-r--r--ipalib/crud.py6
-rw-r--r--ipalib/tests/test_crud.py29
2 files changed, 30 insertions, 5 deletions
diff --git a/ipalib/crud.py b/ipalib/crud.py
index bdcf30478..d6d42494a 100644
--- a/ipalib/crud.py
+++ b/ipalib/crud.py
@@ -31,11 +31,13 @@ class Add(frontend.Method):
class Get(frontend.Method):
- pass
+ def get_args(self):
+ yield self.obj.primary_key
class Del(frontend.Method):
- pass
+ def get_args(self):
+ yield self.obj.primary_key
class Mod(frontend.Method):
diff --git a/ipalib/tests/test_crud.py b/ipalib/tests/test_crud.py
index 41eb88346..2cbf4b167 100644
--- a/ipalib/tests/test_crud.py
+++ b/ipalib/tests/test_crud.py
@@ -51,9 +51,9 @@ class test_Add(ClassChecker):
def test_class(self):
assert self.cls.__bases__ == (frontend.Method,)
- def test_get_options(self):
+ def test_options_args(self):
"""
- Test the `crud.Add.get_options` method.
+ Test `crud.Add.get_args` and `crud.Add.get_options` methods.
"""
api = get_api()
class user_add(self.cls):
@@ -65,7 +65,6 @@ class test_Add(ClassChecker):
['givenname', 'sn', 'uid', 'initials']
-
class test_Get(ClassChecker):
"""
Test the `crud.Get` class.
@@ -76,6 +75,18 @@ class test_Get(ClassChecker):
def test_class(self):
assert self.cls.__bases__ == (frontend.Method,)
+ def test_options_args(self):
+ """
+ Test `crud.Get.get_args` and `crud.Get.get_options` methods.
+ """
+ api = get_api()
+ class user_get(self.cls):
+ pass
+ api.register(user_get)
+ api.finalize()
+ assert list(api.Method.user_get.args) == ['uid']
+ assert list(api.Method.user_get.options) == []
+
class test_Del(ClassChecker):
"""
@@ -87,6 +98,18 @@ class test_Del(ClassChecker):
def test_class(self):
assert self.cls.__bases__ == (frontend.Method,)
+ def test_options_args(self):
+ """
+ Test `crud.Del.get_args` and `crud.Del.get_options` methods.
+ """
+ api = get_api()
+ class user_del(self.cls):
+ pass
+ api.register(user_del)
+ api.finalize()
+ assert list(api.Method.user_del.args) == ['uid']
+ assert list(api.Method.user_del.options) == []
+
class test_Mod(ClassChecker):
"""