diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-10-13 09:50:29 -0600 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-10-13 09:50:29 -0600 |
commit | 225e2b0c939d81b490c955762e125e8afcd5bb94 (patch) | |
tree | e920da1ef6be6691a512b5ae59d1bcf12020e386 /tests | |
parent | 39ad5ccffa60e42904b7f3d2f7a60fef5977f089 (diff) | |
download | freeipa-225e2b0c939d81b490c955762e125e8afcd5bb94.tar.gz freeipa-225e2b0c939d81b490c955762e125e8afcd5bb94.tar.xz freeipa-225e2b0c939d81b490c955762e125e8afcd5bb94.zip |
Added CrudBackend abstract class defining generic CRUD API
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_ipalib/test_crud.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py index 37da503b5..d7e6b51f3 100644 --- a/tests/test_ipalib/test_crud.py +++ b/tests/test_ipalib/test_crud.py @@ -189,3 +189,54 @@ class test_Find(CrudChecker): ['givenname', 'sn', 'initials'] for param in api.Method.user_verb.options(): assert param.required is False + + +class test_CrudBackend(ClassChecker): + """ + Test the `ipalib.crud.CrudBackend` class. + """ + + _cls = crud.CrudBackend + + def get_subcls(self): + class ldap(self.cls): + pass + return ldap + + def check_method(self, name, *args): + o = self.cls() + e = raises(NotImplementedError, getattr(o, name), *args) + assert str(e) == 'CrudBackend.%s()' % name + sub = self.subcls() + e = raises(NotImplementedError, getattr(sub, name), *args) + assert str(e) == 'ldap.%s()' % name + + def test_create(self): + """ + Test the `ipalib.crud.CrudBackend.create` method. + """ + self.check_method('create') + + def test_retrieve(self): + """ + Test the `ipalib.crud.CrudBackend.retrieve` method. + """ + self.check_method('retrieve', 'primary key') + + def test_update(self): + """ + Test the `ipalib.crud.CrudBackend.update` method. + """ + self.check_method('update', 'primary key') + + def test_delete(self): + """ + Test the `ipalib.crud.CrudBackend.delete` method. + """ + self.check_method('delete', 'primary key') + + def test_search(self): + """ + Test the `ipalib.crud.CrudBackend.search` method. + """ + self.check_method('search') |