From 882d04d88c6dbe45e5d49273c9d739c6f4e119d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 25 Jul 2018 22:16:54 +0200 Subject: [PATCH] Revert "tests: use response.text for textual contents (py3)" This reverts commit 079faada75a92d9a7d1b7004e87e85c16b0006a2, .text should not be used for request cache yet. --- tests/test_requests.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_requests.py b/tests/test_requests.py index 4cc5cfc8..430c5702 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -130,21 +130,21 @@ def test_requests_cache(): with mock.patch('combo.utils.requests_wrapper.RequestsSession.request') as requests_get: requests_get.return_value = mock.Mock(content='hello world', status_code=200) # default cache, nothing in there - assert requests.get('http://cache.example.org/').text == 'hello world' + assert requests.get('http://cache.example.org/').content == 'hello world' assert requests_get.call_count == 1 # now there's something in cache - assert requests.get('http://cache.example.org/').text == 'hello world' + assert requests.get('http://cache.example.org/').content == 'hello world' assert requests_get.call_count == 1 # value changed requests_get.return_value = mock.Mock(content='hello second world', status_code=200) - assert requests.get('http://cache.example.org/').text == 'hello world' + assert requests.get('http://cache.example.org/').content == 'hello world' assert requests_get.call_count == 1 # force cache invalidation - assert requests.get('http://cache.example.org/', invalidate_cache=True).text == 'hello second world' + assert requests.get('http://cache.example.org/', invalidate_cache=True).content == 'hello second world' assert requests_get.call_count == 2 # check raise_if_not_cached with pytest.raises(NothingInCacheException): requests.get('http://cache.example.org/other', raise_if_not_cached=True) # check with unicode url - assert requests.get(u'http://cache.example.org/éléphant').text == 'hello second world' + assert requests.get(u'http://cache.example.org/éléphant').content == 'hello second world'