Answer stability round 2: 1 🔴, 0 🟡 (0 misread); read an error answer's body guarded, so one cut short names its status

This commit is contained in:
2026-11-11 22:39:45 +01:00
parent b6c14ba223
commit d2d5e10e19
2 changed files with 9 additions and 4 deletions
+4
View File
@@ -176,6 +176,10 @@ class HttpJson(unittest.TestCase):
failed = dm.http_json("GET", f"{base}/api/v4/users/me", "t", None)
self.assertTrue(isinstance(failed, Failure) and failed.reason.startswith("GET /api/v4/users/me got a broken answer: "), failed)
def test_names_the_status_of_an_error_whose_body_is_cut_short(self):
base = self.serve((None, b"HTTP/1.1 500 Internal Server Error\r\nContent-Length: 100\r\n\r\n{}"))
self.assertEqual(dm.http_json("GET", f"{base}/api/v4/users/me", "t", None), Failure("GET /api/v4/users/me answered 500: Internal Server Error"))
def test_gives_up_on_a_server_that_never_answers_after_the_timeout(self):
silent = socket.socket()
self.addCleanup(silent.close)