summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/test_plugable.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-09-24 00:44:41 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-09-24 00:44:41 +0000
commitf3aaf65f1c4bbee31dae9431423ab88a15eba990 (patch)
tree46ddafec983e8337b014e3c9fcda59d7bb6071a3 /ipalib/tests/test_plugable.py
parent81de10f176437053ac47bfee8f5ec81e38f2cf57 (diff)
downloadfreeipa.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.py19
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)