test_rpcserver: Expect updated error message under Python 3

Python 3's JSON module provides line number information in
its parsing error. Update the test to expect this.

Part of the work for: https://fedorahosted.org/freeipa/ticket/4985

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Petr Viktorin 2016-05-06 17:43:06 +02:00 committed by Martin Basti
parent 9477cddfeb
commit 9ca450ac43

View File

@ -213,7 +213,10 @@ class test_jsonserver(PluginTester):
# Test with invalid JSON-data:
e = raises(errors.JSONError, o.unmarshal, 'this wont work')
assert isinstance(e.error, ValueError)
assert unicode(e.error) == 'No JSON object could be decoded'
if six.PY2:
assert unicode(e.error) == 'No JSON object could be decoded'
else:
assert str(e.error).startswith('Expecting value: ')
# Test with non-dict type:
e = raises(errors.JSONError, o.unmarshal, json.dumps([1, 2, 3]))