Imported Upstream version 4.7.2
This commit is contained in:
@@ -21,10 +21,13 @@
|
||||
Test the `ipalib.crud` module.
|
||||
"""
|
||||
|
||||
from ipatests.util import read_only, raises, get_api, ClassChecker
|
||||
from ipalib import crud, frontend, plugable, config
|
||||
from ipatests.util import raises, get_api, ClassChecker
|
||||
from ipalib import crud, frontend
|
||||
from ipalib.parameters import Str
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.tier0
|
||||
|
||||
class CrudChecker(ClassChecker):
|
||||
"""
|
||||
@@ -35,7 +38,7 @@ class CrudChecker(ClassChecker):
|
||||
"""
|
||||
Return a finalized `ipalib.plugable.API` instance.
|
||||
"""
|
||||
(api, home) = get_api()
|
||||
api, _home = get_api()
|
||||
class user(frontend.Object):
|
||||
takes_params = (
|
||||
'givenname',
|
||||
@@ -47,8 +50,8 @@ class CrudChecker(ClassChecker):
|
||||
class user_verb(self.cls):
|
||||
takes_args = args
|
||||
takes_options = options
|
||||
api.register(user)
|
||||
api.register(user_verb)
|
||||
api.add_plugin(user)
|
||||
api.add_plugin(user_verb)
|
||||
api.finalize()
|
||||
return api
|
||||
|
||||
@@ -202,10 +205,11 @@ class test_CrudBackend(ClassChecker):
|
||||
return ldap
|
||||
|
||||
def check_method(self, name, *args):
|
||||
o = self.cls()
|
||||
api = 'the api instance'
|
||||
o = self.cls(api)
|
||||
e = raises(NotImplementedError, getattr(o, name), *args)
|
||||
assert str(e) == 'CrudBackend.%s()' % name
|
||||
sub = self.subcls()
|
||||
sub = self.subcls(api)
|
||||
e = raises(NotImplementedError, getattr(sub, name), *args)
|
||||
assert str(e) == 'ldap.%s()' % name
|
||||
|
||||
|
||||
Reference in New Issue
Block a user