summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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):
"""