From 9ca450ac436344afd3a46d9852d8329a2e9a48d2 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: May 30 2016 14:44:08 +0000 Subject: 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 --- diff --git a/ipatests/test_ipaserver/test_rpcserver.py b/ipatests/test_ipaserver/test_rpcserver.py index 03a4ceb..94ebd06 100644 --- a/ipatests/test_ipaserver/test_rpcserver.py +++ b/ipatests/test_ipaserver/test_rpcserver.py @@ -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]))