mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-13 19:29:53 +03:00
Fix `test_http_request` tests with twisted >= 24.7.0. ``` _____________________ TestHTTPRequest.test_bad_requests _______________________ self = <test_http_request.TestHTTPRequest testMethod=test_bad_requests> def test_bad_requests(self): """ Tests that requests with invalid (non-ASCII) characters fail. """ # Bad path response = self.run_daphne_raw( b"GET /\xc3\xa4\xc3\xb6\xc3\xbc HTTP/1.0\r\n\r\n" ) > self.assertTrue(response.startswith(b"HTTP/1.0 400 Bad Request")) E AssertionError: False is not true tests/test_http_request.py:307: AssertionError [...] FAILED tests/test_http_request.py::TestHTTPRequest::test_bad_requests - Asser... FAILED tests/test_http_request.py::TestHTTPRequest::test_invalid_header_name ```
38 lines
1.6 KiB
Diff
38 lines
1.6 KiB
Diff
Patch-Source: https://github.com/django/daphne/commit/9ec5798c0d17f0858229dd800955abab4fa803fb
|
|
---
|
|
From 9ec5798c0d17f0858229dd800955abab4fa803fb Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= <github@dotlambda.de>
|
|
Date: Sat, 24 Aug 2024 11:47:58 -0700
|
|
Subject: [PATCH] fix tests with Twisted 24.7.0 (#526)
|
|
|
|
In the fixed test cases the responses now contain `HTTP/1.1` rather than
|
|
`HTTP/1.0`.
|
|
---
|
|
tests/test_http_request.py | 6 +++---
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/tests/test_http_request.py b/tests/test_http_request.py
|
|
index dca5bd7b..f0fe3765 100644
|
|
--- a/tests/test_http_request.py
|
|
+++ b/tests/test_http_request.py
|
|
@@ -304,12 +304,12 @@ def test_bad_requests(self):
|
|
response = self.run_daphne_raw(
|
|
b"GET /\xc3\xa4\xc3\xb6\xc3\xbc HTTP/1.0\r\n\r\n"
|
|
)
|
|
- self.assertTrue(response.startswith(b"HTTP/1.0 400 Bad Request"))
|
|
+ self.assertTrue(b"400 Bad Request" in response)
|
|
# Bad querystring
|
|
response = self.run_daphne_raw(
|
|
b"GET /?\xc3\xa4\xc3\xb6\xc3\xbc HTTP/1.0\r\n\r\n"
|
|
)
|
|
- self.assertTrue(response.startswith(b"HTTP/1.0 400 Bad Request"))
|
|
+ self.assertTrue(b"400 Bad Request" in response)
|
|
|
|
def test_invalid_header_name(self):
|
|
"""
|
|
@@ -321,4 +321,4 @@ def test_invalid_header_name(self):
|
|
response = self.run_daphne_raw(
|
|
f"GET / HTTP/1.0\r\n{header_name}: baz\r\n\r\n".encode("ascii")
|
|
)
|
|
- self.assertTrue(response.startswith(b"HTTP/1.0 400 Bad Request"))
|
|
+ self.assertTrue(b"400 Bad Request" in response)
|