From 75422447913d489bfd5b23ae97cb04bcda5e990a Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Fri, 6 Oct 2023 15:40:51 -0400 Subject: [PATCH] testing compat changes for flask 3.x --- testing/utilities/client.py | 2 +- tests/testing/utilities/client_test.py | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/testing/utilities/client.py b/testing/utilities/client.py index 46a7ea4..712b65b 100644 --- a/testing/utilities/client.py +++ b/testing/utilities/client.py @@ -15,7 +15,7 @@ def __init__(self, response): @property def text(self): - return self.response.data.decode(self.response.charset) + return self.response.text @property def pq(self): diff --git a/tests/testing/utilities/client_test.py b/tests/testing/utilities/client_test.py index 081527f..69ef077 100644 --- a/tests/testing/utilities/client_test.py +++ b/tests/testing/utilities/client_test.py @@ -23,16 +23,12 @@ def test_return_value_is_testing_response(client_open_mock): def test_pq(): - response = auto_namedtuple( - 'Response', data=b'

Oh hai!

', charset='UTF-8', - ) + response = auto_namedtuple('Response', text='

Oh hai!

') instance = Response(response) - assert instance.pq.__html__() == response.data.decode('UTF-8') + assert instance.pq.__html__() == response.text def test_json(): - response = auto_namedtuple( - 'Response', data=b'{"foo": "bar"}', charset='UTF-8', - ) + response = auto_namedtuple('Response', text='{"foo": "bar"}') instance = Response(response) assert instance.json == {'foo': 'bar'}