From 5872221bd49dda962391ddfb88f22e86bf72afec Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Sun, 21 Sep 2008 21:30:19 +0000 Subject: 306: Added Plugin.set_api() method; added corresponding unit tests --- ipalib/tests/test_plugable.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'ipalib/tests') diff --git a/ipalib/tests/test_plugable.py b/ipalib/tests/test_plugable.py index 9623f99e..3972cfa9 100644 --- a/ipalib/tests/test_plugable.py +++ b/ipalib/tests/test_plugable.py @@ -387,6 +387,20 @@ class test_Plugin(ClassChecker): assert base.implemented_by(fail) is False assert base.implemented_by(fail()) is False + def test_set_api(self): + """ + Tests the `plugable.Plugin.set_api` method. + """ + api = 'the api instance' + o = self.cls() + assert o.api is None + e = raises(AssertionError, o.set_api, None) + assert str(e) == 'set_api() argument cannot be None' + o.set_api(api) + assert o.api is api + e = raises(AssertionError, o.set_api, api) + assert str(e) == 'set_api() can only be called once' + def test_finalize(self): """ Tests the `plugable.Plugin.finalize` method. -- cgit