From 625b5742801be98fde98b54a1cea8e5c64cd6d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 18 Nov 2019 20:12:02 +0100 Subject: [PATCH] tests: update check against json exception message (#36515) --- tests/test_datasource.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_datasource.py b/tests/test_datasource.py index 57cbbbc89..438d57ec5 100644 --- a/tests/test_datasource.py +++ b/tests/test_datasource.py @@ -7,6 +7,7 @@ import json import sys import shutil +from django.utils import six from django.utils.six import StringIO from django.utils.six.moves.urllib import parse as urlparse @@ -282,7 +283,10 @@ def test_json_datasource_bad_url(http_requests, caplog): datasource = {'type': 'json', 'value': 'http://remote.example.net/xml'} assert data_sources.get_items(datasource) == [] assert 'Error reading JSON data source output' in caplog.records[-1].message - assert 'No JSON object could be decoded' in caplog.records[-1].message + if six.PY2: + assert 'No JSON object could be decoded' in caplog.records[-1].message + else: + assert 'Expecting value:' in caplog.records[-1].message datasource = {'type': 'json', 'value': 'http://remote.example.net/connection-error'} assert data_sources.get_items(datasource) == []