diff options
author | Jan Cholasta <jcholast@redhat.com> | 2015-06-22 10:16:34 +0000 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2015-07-01 13:05:30 +0000 |
commit | 2d1515323acb4125306817096bafab6623de0b47 (patch) | |
tree | 5f9c347978fe2c94eb0b0f3996ff7a79d3e848db /ipatests | |
parent | 481f8ddaa32795c64275438645e45d2c4bbbae26 (diff) | |
download | freeipa-2d1515323acb4125306817096bafab6623de0b47.tar.gz freeipa-2d1515323acb4125306817096bafab6623de0b47.tar.xz freeipa-2d1515323acb4125306817096bafab6623de0b47.zip |
plugable: Load plugins only from modules imported by API
Previously all plugin modules imported from anywhere were added to the API.
https://fedorahosted.org/freeipa/ticket/3090
Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
Diffstat (limited to 'ipatests')
-rw-r--r-- | ipatests/test_ipalib/test_backend.py | 8 | ||||
-rw-r--r-- | ipatests/test_ipalib/test_crud.py | 4 | ||||
-rw-r--r-- | ipatests/test_ipalib/test_frontend.py | 12 | ||||
-rw-r--r-- | ipatests/test_ipalib/test_plugable.py | 2 | ||||
-rw-r--r-- | ipatests/test_ipaserver/test_ldap.py | 8 | ||||
-rw-r--r-- | ipatests/util.py | 4 |
6 files changed, 19 insertions, 19 deletions
diff --git a/ipatests/test_ipalib/test_backend.py b/ipatests/test_ipalib/test_backend.py index 121c4745b..91eb92057 100644 --- a/ipatests/test_ipalib/test_backend.py +++ b/ipatests/test_ipalib/test_backend.py @@ -186,7 +186,7 @@ class test_Executioner(ClassChecker): def execute(self, *args, **options): assert type(args[1]) is tuple return dict(result=args + (options,)) - api.register(echo) + api.add_plugin(echo) class good(Command): def execute(self, **options): @@ -194,12 +194,12 @@ class test_Executioner(ClassChecker): name='nurse', error=u'Not naughty!', ) - api.register(good) + api.add_plugin(good) class bad(Command): def execute(self, **options): raise ValueError('This is private.') - api.register(bad) + api.add_plugin(bad) class with_name(Command): """ @@ -208,7 +208,7 @@ class test_Executioner(ClassChecker): takes_options = 'name' def execute(self, **options): return dict(result=options['name'].upper()) - api.register(with_name) + api.add_plugin(with_name) api.finalize() o = self.cls() diff --git a/ipatests/test_ipalib/test_crud.py b/ipatests/test_ipalib/test_crud.py index 6d29ab97a..f17371659 100644 --- a/ipatests/test_ipalib/test_crud.py +++ b/ipatests/test_ipalib/test_crud.py @@ -47,8 +47,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 diff --git a/ipatests/test_ipalib/test_frontend.py b/ipatests/test_ipalib/test_frontend.py index b4fbf3ea3..c47113f6e 100644 --- a/ipatests/test_ipalib/test_frontend.py +++ b/ipatests/test_ipalib/test_frontend.py @@ -817,7 +817,7 @@ class test_LocalOrRemote(ClassChecker): # Test when in_server=False: (api, home) = create_test_api(in_server=False) - api.register(example) + api.add_plugin(example) api.finalize() cmd = api.Command.example assert cmd(version=u'2.47') == dict( @@ -835,7 +835,7 @@ class test_LocalOrRemote(ClassChecker): # Test when in_server=True (should always call execute): (api, home) = create_test_api(in_server=True) - api.register(example) + api.add_plugin(example) api.finalize() cmd = api.Command.example assert cmd(version=u'2.47') == dict( @@ -1012,10 +1012,10 @@ class test_Object(ClassChecker): (api, home) = create_test_api() class ldap(backend.Backend): whatever = 'It worked!' - api.register(ldap) + api.add_plugin(ldap) class user(frontend.Object): backend_name = 'ldap' - api.register(user) + api.add_plugin(user) api.finalize() b = api.Object.user.backend assert isinstance(b, ldap) @@ -1118,8 +1118,8 @@ class test_Method(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 diff --git a/ipatests/test_ipalib/test_plugable.py b/ipatests/test_ipalib/test_plugable.py index 2a6f8aa41..b0f607024 100644 --- a/ipatests/test_ipalib/test_plugable.py +++ b/ipatests/test_ipalib/test_plugable.py @@ -384,7 +384,7 @@ class test_API(ClassChecker): api = plugable.API([base0, base1], []) api.env.mode = 'unit_test' api.env.in_tree = True - r = api.register + r = api.add_plugin class base0_plugin0(base0): pass diff --git a/ipatests/test_ipaserver/test_ldap.py b/ipatests/test_ipaserver/test_ldap.py index 8b4e50058..2c187b0c7 100644 --- a/ipatests/test_ipaserver/test_ldap.py +++ b/ipatests/test_ipaserver/test_ldap.py @@ -110,10 +110,10 @@ class test_ldap(object): # we need for the test. myapi = create_api(mode=None) myapi.bootstrap(context='cli', in_server=True, in_tree=True) - myapi.register(ldap2) - myapi.register(host) - myapi.register(service) - myapi.register(service_show) + myapi.add_plugin(ldap2) + myapi.add_plugin(host) + myapi.add_plugin(service) + myapi.add_plugin(service_show) myapi.finalize() pwfile = api.env.dot_ipa + os.sep + ".dmpw" diff --git a/ipatests/util.py b/ipatests/util.py index 247714a3b..a8899cc6f 100644 --- a/ipatests/util.py +++ b/ipatests/util.py @@ -505,9 +505,9 @@ class PluginTester(object): :param kw: Additional \**kw args to pass to `create_test_api`. """ (api, home) = create_test_api(**kw) - api.register(self.plugin) + api.add_plugin(self.plugin) for p in plugins: - api.register(p) + api.add_plugin(p) return (api, home) def finalize(self, *plugins, **kw): |