summaryrefslogtreecommitdiffstats
path: root/tests/test_ipalib/test_plugable.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2009-01-03 17:27:53 -0700
committerJason Gerard DeRose <jderose@redhat.com>2009-01-03 17:27:53 -0700
commit6b6e6b1cab7a633faf16631a565ecb6988dadb48 (patch)
tree86b5b24485955ac3186beb7e350b77c47fefa5b3 /tests/test_ipalib/test_plugable.py
parentd1517b95ca14773773647434fb589c8224307328 (diff)
downloadfreeipa-6b6e6b1cab7a633faf16631a565ecb6988dadb48.tar.gz
freeipa-6b6e6b1cab7a633faf16631a565ecb6988dadb48.tar.xz
freeipa-6b6e6b1cab7a633faf16631a565ecb6988dadb48.zip
Ported plugin registration errors into errors2.py; plugable.Registrar now raises new errors2 exceptions
Diffstat (limited to 'tests/test_ipalib/test_plugable.py')
-rw-r--r--tests/test_ipalib/test_plugable.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/tests/test_ipalib/test_plugable.py b/tests/test_ipalib/test_plugable.py
index 9eb102ff..dbf0cc3f 100644
--- a/tests/test_ipalib/test_plugable.py
+++ b/tests/test_ipalib/test_plugable.py
@@ -25,7 +25,7 @@ import inspect
from tests.util import raises, no_set, no_del, read_only
from tests.util import getitem, setitem, delitem
from tests.util import ClassChecker, create_test_api
-from ipalib import plugable, errors
+from ipalib import plugable, errors, errors2
class test_SetProxy(ClassChecker):
@@ -534,11 +534,14 @@ def test_Registrar():
# Check that TypeError is raised trying to register something that isn't
# a class:
- raises(TypeError, r, plugin1())
+ p = plugin1()
+ e = raises(TypeError, r, p)
+ assert str(e) == 'plugin must be a class; got %r' % p
# Check that SubclassError is raised trying to register a class that is
# not a subclass of an allowed base:
- raises(errors.SubclassError, r, plugin3)
+ e = raises(errors2.PluginSubclassError, r, plugin3)
+ assert e.plugin is plugin3
# Check that registration works
r(plugin1)
@@ -548,7 +551,8 @@ def test_Registrar():
# Check that DuplicateError is raised trying to register exact class
# again:
- raises(errors.DuplicateError, r, plugin1)
+ e = raises(errors2.PluginDuplicateError, r, plugin1)
+ assert e.plugin is plugin1
# Check that OverrideError is raised trying to register class with same
# name and same base:
@@ -557,7 +561,10 @@ def test_Registrar():
pass
class plugin1(base1_extended):
pass
- raises(errors.OverrideError, r, plugin1)
+ e = raises(errors2.PluginOverrideError, r, plugin1)
+ assert e.base == 'Base1'
+ assert e.name == 'plugin1'
+ assert e.plugin is plugin1
# Check that overriding works
r(plugin1, override=True)
@@ -567,7 +574,10 @@ def test_Registrar():
# Check that MissingOverrideError is raised trying to override a name
# not yet registerd:
- raises(errors.MissingOverrideError, r, plugin2, override=True)
+ e = raises(errors2.PluginMissingOverrideError, r, plugin2, override=True)
+ assert e.base == 'Base2'
+ assert e.name == 'plugin2'
+ assert e.plugin is plugin2
# Test that another plugin can be registered:
assert len(r.Base2) == 0