Cover additional behavior changes in tests

This commit is contained in:
Adrián Chaves 2023-01-10 21:11:48 +01:00
parent 86baef02a0
commit 7bb5289ced
1 changed files with 47 additions and 11 deletions

View File

@ -450,6 +450,16 @@ POST_XTRACTMIME_SCENARIOS = (
'application/ld+json',
)
),
# XML MIME types should trigger an XmlResponse.
#
# https://mimesniff.spec.whatwg.org/#xml-mime-type
*(
(mime_type, XmlResponse)
for mime_type in (
'application/foo+xml',
)
),
)
),
@ -500,6 +510,21 @@ POST_XTRACTMIME_SCENARIOS = (
)
),
# Content-Type also triumphs Content-Disposition.
(
{
'headers': Headers(
{
'Content-Disposition': [
'attachment; filename="a.html"',
],
'Content-Type': ['application/octet-stream'],
}
)
},
Response,
),
# Compressed content should be of type Response until uncompressed.
(
{
@ -514,17 +539,6 @@ POST_XTRACTMIME_SCENARIOS = (
},
Response,
),
(
{
"url": "file:///a.html",
'headers': Headers(
{
'Content-Encoding': ['zip'],
}
)
},
Response,
),
(
{
"body": b"<html>",
@ -595,6 +609,28 @@ POST_XTRACTMIME_SCENARIOS = (
)
),
# File extension triumphs body.
(
{
"body": b"<html>",
'headers': Headers(
{
'Content-Disposition': [
'attachment; filename="a.gz"',
],
}
)
},
Response,
),
(
{
"body": b"<html>",
'url': 'file:///a.gz',
},
Response,
),
# Without anything else, the body determines the response class.
*(
({"body": body}, response_class)