diff options
author | Pavel Zuna <pzuna@redhat.com> | 2009-08-27 15:55:19 +0200 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-10-05 15:59:09 -0400 |
commit | e01b1b8f99e67b08d1827b13f411f6d3cccfcf41 (patch) | |
tree | 674f392b669e5d5e46bc30dde550926494cfce4b /tests/test_ipalib/test_parameters.py | |
parent | 1e48662b9ba623ebd8ad62035c9c84dc4f1fed70 (diff) | |
download | freeipa-e01b1b8f99e67b08d1827b13f411f6d3cccfcf41.tar.gz freeipa-e01b1b8f99e67b08d1827b13f411f6d3cccfcf41.tar.xz freeipa-e01b1b8f99e67b08d1827b13f411f6d3cccfcf41.zip |
Fix unit tests for plugins using baseldap classes.
Diffstat (limited to 'tests/test_ipalib/test_parameters.py')
-rw-r--r-- | tests/test_ipalib/test_parameters.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/test_ipalib/test_parameters.py b/tests/test_ipalib/test_parameters.py index db9c01efc..d651b2366 100644 --- a/tests/test_ipalib/test_parameters.py +++ b/tests/test_ipalib/test_parameters.py @@ -29,6 +29,7 @@ from tests.util import dummy_ugettext, assert_equal from tests.data import binary_bytes, utf8_bytes, unicode_str from ipalib import parameters, request, errors, config from ipalib.constants import TYPE_ERROR, CALLABLE_ERROR, NULLS +from ipalib.errors import ValidationError class test_DefaultFrom(ClassChecker): @@ -445,11 +446,11 @@ class test_Param(ClassChecker): assert str(e) == 'value: empty tuple must be converted to None' # Test with wrong (scalar) type: - e = raises(TypeError, o.validate, (None, None, 42, None)) - assert str(e) == TYPE_ERROR % ('value[2]', NoneType, 42, int) + e = raises(ValidationError, o.validate, (None, None, 42, None)) + assert str(e) == 'invalid %s' % (TYPE_ERROR % ('\'my_param\'', NoneType, 42, int)) o = self.cls('my_param') - e = raises(TypeError, o.validate, 'Hello') - assert str(e) == TYPE_ERROR % ('value', NoneType, 'Hello', str) + e = raises(ValidationError, o.validate, 'Hello') + assert str(e) == 'invalid %s' % (TYPE_ERROR % ('\'my_param\'', NoneType, 'Hello', str)) class Example(self.cls): type = int @@ -511,10 +512,10 @@ class test_Param(ClassChecker): o = MyParam('my_param', okay) # Test that TypeError is appropriately raised: - e = raises(TypeError, o._validate_scalar, 0) - assert str(e) == TYPE_ERROR % ('value', bool, 0, int) - e = raises(TypeError, o._validate_scalar, 'Hi', index=4) - assert str(e) == TYPE_ERROR % ('value[4]', bool, 'Hi', str) + e = raises(ValidationError, o._validate_scalar, 0) + assert str(e) == 'invalid %s' % (TYPE_ERROR % ('\'my_param\'', bool, 0, int)) + e = raises(ValidationError, o._validate_scalar, 'Hi', index=4) + assert str(e) == 'invalid %s' % (TYPE_ERROR % ('\'my_param\'', bool, 'Hi', str)) e = raises(TypeError, o._validate_scalar, True, index=3.0) assert str(e) == TYPE_ERROR % ('index', int, 3.0, float) |