Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing compat changes for flask 3.x #243

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion testing/utilities/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 3 additions & 7 deletions tests/testing/utilities/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,12 @@ def test_return_value_is_testing_response(client_open_mock):


def test_pq():
response = auto_namedtuple(
'Response', data=b'<p>Oh hai!</p>', charset='UTF-8',
)
response = auto_namedtuple('Response', text='<p>Oh hai!</p>')
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'}