summaryrefslogtreecommitdiffstats
path: root/ipalib/tests/tstutil.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-09-03 18:32:49 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-09-03 18:32:49 +0000
commit085ea3f62f37539a279f7d4ade51208fcbe868b9 (patch)
tree18029cb9fd5360ea9a088585c1a37b6bda474297 /ipalib/tests/tstutil.py
parentbaef0e6f49aaf75c3d71e3afd9cf2a2abcb07152 (diff)
downloadfreeipa.git-085ea3f62f37539a279f7d4ade51208fcbe868b9.tar.gz
freeipa.git-085ea3f62f37539a279f7d4ade51208fcbe868b9.tar.xz
freeipa.git-085ea3f62f37539a279f7d4ade51208fcbe868b9.zip
239: Added errors.ConversionError; started big clean up of how ValidationError is raised so it works well with multivalues
Diffstat (limited to 'ipalib/tests/tstutil.py')
-rw-r--r--ipalib/tests/tstutil.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/ipalib/tests/tstutil.py b/ipalib/tests/tstutil.py
index 79e8ae38..1bf3eaab 100644
--- a/ipalib/tests/tstutil.py
+++ b/ipalib/tests/tstutil.py
@@ -22,6 +22,7 @@ Utility functions for the unit tests.
"""
import inspect
+from ipalib import errors
class ExceptionNotRaised(Exception):
"""
@@ -131,3 +132,16 @@ class ClassChecker(object):
self.__class__.__name__,
'get_subcls()'
)
+
+
+def check_TypeError(value, type_, name, callback, *args, **kw):
+ """
+ Tests a standard TypeError raised with `errors.raise_TypeError`.
+ """
+ e = raises(TypeError, callback, *args, **kw)
+ assert e.value == value
+ assert type(e.value) is type(value)
+ assert e.type is type_
+ assert e.name == name
+ assert type(e.name) is str
+ assert str(e) == errors.TYPE_FORMAT % (name, type_, value)