diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-24 00:44:41 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-24 00:44:41 +0000 |
commit | f3aaf65f1c4bbee31dae9431423ab88a15eba990 (patch) | |
tree | 46ddafec983e8337b014e3c9fcda59d7bb6071a3 /ipalib/tests/test_plugable.py | |
parent | 81de10f176437053ac47bfee8f5ec81e38f2cf57 (diff) | |
download | freeipa.git-f3aaf65f1c4bbee31dae9431423ab88a15eba990.tar.gz freeipa.git-f3aaf65f1c4bbee31dae9431423ab88a15eba990.tar.xz freeipa.git-f3aaf65f1c4bbee31dae9431423ab88a15eba990.zip |
320: plugable.API now respects the Plugin.__proxy__ flag; added test for plugins without proxy to unit tests for API
Diffstat (limited to 'ipalib/tests/test_plugable.py')
-rw-r--r-- | ipalib/tests/test_plugable.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ipalib/tests/test_plugable.py b/ipalib/tests/test_plugable.py index 6c796f9e..02d35cde 100644 --- a/ipalib/tests/test_plugable.py +++ b/ipalib/tests/test_plugable.py @@ -795,3 +795,22 @@ def test_API(): # Test that calling finilize again raises AssertionError: raises(AssertionError, api.finalize) + + # Test with base class that doesn't request a proxy + class NoProxy(plugable.Plugin): + __proxy__ = False + api = plugable.API(NoProxy) + class plugin0(NoProxy): + pass + api.register(plugin0) + class plugin1(NoProxy): + pass + api.register(plugin1) + api.finalize() + names = ['plugin0', 'plugin1'] + assert list(api.NoProxy) == names + for name in names: + plugin = api.NoProxy[name] + assert getattr(api.NoProxy, name) is plugin + assert isinstance(plugin, plugable.Plugin) + assert not isinstance(plugin, plugable.PluginProxy) |