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

Test text content without specifying content type #78

Merged
merged 1 commit into from
Oct 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,17 @@ async def test_headers(client, headers, content_type, expected):

@pytest.mark.asyncio
@pytest.mark.parametrize(
"content,expected", [(b"eldr\xc3\xa4v", "eldräv"), ("äpple", "äpple")]
"content,expected",
[
(b"eldr\xc3\xa4v", "eldräv"),
("äpple", "äpple"),
("Gehäusegröße", "Gehäusegröße"),
],
)
async def test_text_content(client, content, expected):
async with MockTransport() as respx_mock:
url = "https://foo.bar/"
content_type = "text/plain; charset=utf-8" # TODO: Remove once respected
request = respx_mock.post(url, content=content, content_type=content_type)
request = respx_mock.post(url, content=content)
response = await client.post(url)
assert request.called is True
assert response.text == expected
Expand Down