From fa3ba512d992346c5675aaaaa57559e3ced76934 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Chaves?= Date: Sun, 8 Jan 2023 13:21:36 +0100 Subject: [PATCH] Uncomment test scenarios --- tests/test_utils_response.py | 104 +++++++++++++++++------------------ 1 file changed, 51 insertions(+), 53 deletions(-) diff --git a/tests/test_utils_response.py b/tests/test_utils_response.py index 3c150faab..7b7819ee2 100644 --- a/tests/test_utils_response.py +++ b/tests/test_utils_response.py @@ -110,6 +110,19 @@ PRE_XTRACTMIME_SCENARIOS = ( ) ), + # HTTP headers take priority over local file extensions. + ( + { + 'url': 'file.txt', + 'headers': Headers( + { + 'Content-Type': ['text/html'], + } + ), + }, + HtmlResponse, + ), + *( ( { @@ -309,7 +322,6 @@ POST_XTRACTMIME_SCENARIOS = ( ) ), - # Compressed content should be of type Response until uncompressed. # # When it comes to compression, we trust the encoding from the following @@ -322,58 +334,44 @@ POST_XTRACTMIME_SCENARIOS = ( # # 3. File extension of the file name if the resource comes through a # file-based protocol (FTP, local file system). - #( - #{ - #'url': 'file.html', - #'body': b'\n.', - #'headers': Headers( - #{ - #'Content-Disposition': [ - #'attachment; filename="file.html"' - #], - #'Content-Encoding': ['zip'], - #'Content-Type': ['text/html'], - #} - #), - #}, - #Response, - #), - #( - #{ - #'url': 'file.html', - #'body': b'\n.', - #'headers': Headers( - #{ - #'Content-Disposition': [ - #'attachment; filename="file.html.zip"' - #], - #'Content-Type': ['text/html'], - #} - #), - #}, - #Response, - #), - #( - #{ - #'url': 'file.html.zip', - #'body': b'\n.', - #}, - #Response, - #), - - # HTTP headers take priority over local file extensions. - #( - #{ - #'url': 'file.html.zip', - #'body': b'\n.', - #'headers': Headers( - #{ - #'Content-Type': ['text/html'], - #} - #), - #}, - #HtmlResponse, - #), + ( + { + 'url': 'file.html', + 'body': b'\n.', + 'headers': Headers( + { + 'Content-Disposition': [ + 'attachment; filename="file.html"' + ], + 'Content-Encoding': ['zip'], + 'Content-Type': ['text/html'], + } + ), + }, + Response, + ), + ( + { + 'url': 'file.html', + 'body': b'\n.', + 'headers': Headers( + { + 'Content-Disposition': [ + 'attachment; filename="file.html.zip"' + ], + 'Content-Type': ['text/html'], + } + ), + }, + Response, + ), + ( + { + 'url': 'file.html.zip', + 'body': b'\n.', + }, + Response, + ), ( {