From f3aaf65f1c4bbee31dae9431423ab88a15eba990 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Wed, 24 Sep 2008 00:44:41 +0000 Subject: 320: plugable.API now respects the Plugin.__proxy__ flag; added test for plugins without proxy to unit tests for API --- ipalib/tests/test_plugable.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'ipalib/tests/test_plugable.py') 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) -- cgit