summaryrefslogtreecommitdiffstats
path: root/tests/test_ipalib
diff options
context:
space:
mode:
authorLynn Root <lroot@redhat.com>2012-11-08 10:06:35 -0500
committerMartin Kosek <mkosek@redhat.com>2012-12-11 10:52:06 +0100
commit173ee4d141958f198a706d65d4ee47c4a2ec31ed (patch)
treef03ad715dfa5f57ce676327f709831264d54612f /tests/test_ipalib
parent585b91df3b1fab9c865e00f522950003709ea23d (diff)
downloadfreeipa-173ee4d141958f198a706d65d4ee47c4a2ec31ed.tar.gz
freeipa-173ee4d141958f198a706d65d4ee47c4a2ec31ed.tar.xz
freeipa-173ee4d141958f198a706d65d4ee47c4a2ec31ed.zip
Switch %r specifiers to '%s' in Public errors
This switch drops the preceding 'u' from strings within Public error messages. This patch also addresses the related unfriendly 'u' from re-raising errors from netaddr.IPAddress by passing a bytestring through the function. Also switched ValidationError to TypeError in validate_scalar per jcholast@redhat.com. Ticket: https://fedorahosted.org/freeipa/ticket/3121 Ticket: https://fedorahosted.org/freeipa/ticket/2588
Diffstat (limited to 'tests/test_ipalib')
-rw-r--r--tests/test_ipalib/test_parameters.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/test_ipalib/test_parameters.py b/tests/test_ipalib/test_parameters.py
index e6ac91db7..b30ae5ada 100644
--- a/tests/test_ipalib/test_parameters.py
+++ b/tests/test_ipalib/test_parameters.py
@@ -469,11 +469,11 @@ class test_Param(ClassChecker):
assert str(e) == 'value: empty tuple must be converted to None'
# Test with wrong (scalar) type:
- e = raises(ValidationError, o.validate, (None, None, 42, None), 'cli')
- assert str(e) == 'invalid %s' % (TYPE_ERROR % ('\'my_param\'', NoneType, 42, int))
+ e = raises(TypeError, o.validate, (None, None, 42, None), 'cli')
+ assert str(e) == TYPE_ERROR % ('my_param', NoneType, 42, int)
o = self.cls('my_param')
- e = raises(ValidationError, o.validate, 'Hello', 'cli')
- assert str(e) == 'invalid %s' % (TYPE_ERROR % ('\'my_param\'', NoneType, 'Hello', str))
+ e = raises(TypeError, o.validate, 'Hello', 'cli')
+ assert str(e) == TYPE_ERROR % ('my_param', NoneType, 'Hello', str)
class Example(self.cls):
type = int
@@ -535,10 +535,10 @@ class test_Param(ClassChecker):
o = MyParam('my_param', okay)
# Test that TypeError is appropriately raised:
- 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, 0)
+ assert str(e) == TYPE_ERROR % ('my_param', bool, 0, int)
+ e = raises(TypeError, o._validate_scalar, 'Hi', index=4)
+ assert str(e) == 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)
@@ -1574,4 +1574,4 @@ class test_IA5Str(ClassChecker):
e = raises(errors.ConversionError, mthd, value)
assert e.name == 'my_str'
assert e.index is None
- assert_equal(e.error, "The character \''\\xc3'\' is not allowed.")
+ assert_equal(e.error, "The character '\\xc3' is not allowed.")