summaryrefslogtreecommitdiffstats
path: root/ipalib/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/tests')
-rw-r--r--ipalib/tests/test_errors.py31
-rw-r--r--ipalib/tests/test_public.py4
2 files changed, 33 insertions, 2 deletions
diff --git a/ipalib/tests/test_errors.py b/ipalib/tests/test_errors.py
index 34b195e8..b0b5483c 100644
--- a/ipalib/tests/test_errors.py
+++ b/ipalib/tests/test_errors.py
@@ -129,3 +129,34 @@ def test_check_isinstance():
fail_bool = 0
e = raises(AssertionError, f, value, type_, name, allow_none=fail_bool)
assert str(e) == type_format % ('allow_none', bool, fail_bool)
+
+
+class test_IPAError(ClassChecker):
+ """
+ Tests the `errors.IPAError` exception.
+ """
+ _cls = errors.IPAError
+
+ def test_class(self):
+ assert self.cls.__bases__ == (Exception,)
+
+ def test_init(self):
+ """
+ Tests the `errors.IPAError.__init__` method.
+ """
+ args = ('one fish', 'two fish')
+ e = self.cls(*args)
+ assert e.args == args
+ assert self.cls().args == tuple()
+
+ def test_str(self):
+ """
+ Tests the `errors.IPAError.__str__` method.
+ """
+ f = 'The %s color is %s.'
+ class custom_error(self.cls):
+ format = f
+ for args in [('sexiest', 'red'), ('most-batman-like', 'black')]:
+ e = custom_error(*args)
+ assert e.args == args
+ assert str(e) == f % args
diff --git a/ipalib/tests/test_public.py b/ipalib/tests/test_public.py
index c184ac15..bbdd37f3 100644
--- a/ipalib/tests/test_public.py
+++ b/ipalib/tests/test_public.py
@@ -203,7 +203,7 @@ class test_Option(ClassChecker):
for v in [(fail,), (u'Hello', fail)]: # Non unicode member
check_TypeError(fail, unicode, 'value', o.normalize, v)
- def test_validate(self):
+ def dont_validate(self):
"""
Tests the `public.Option.validate` method.
"""
@@ -408,7 +408,7 @@ class test_Command(ClassChecker):
assert sub.get_default(**no_fill) == {}
assert sub.get_default(**fill) == default
- def test_validate(self):
+ def dont_validate(self):
"""
Tests the `public.Command.validate` method.
"""