reject() creates a failed opening handshake response.
(self, _formatdate)
| 286 | |
| 287 | @patch("email.utils.formatdate", return_value=DATE) |
| 288 | def test_reject_response(self, _formatdate): |
| 289 | """reject() creates a failed opening handshake response.""" |
| 290 | server = ServerProtocol() |
| 291 | response = server.reject(http.HTTPStatus.NOT_FOUND, "Sorry folks.\n") |
| 292 | |
| 293 | self.assertIsInstance(response, Response) |
| 294 | self.assertEqual(response.status_code, 404) |
| 295 | self.assertEqual(response.reason_phrase, "Not Found") |
| 296 | self.assertEqual( |
| 297 | response.headers, |
| 298 | Headers( |
| 299 | { |
| 300 | "Date": DATE, |
| 301 | "Connection": "close", |
| 302 | "Content-Length": "13", |
| 303 | "Content-Type": "text/plain; charset=utf-8", |
| 304 | } |
| 305 | ), |
| 306 | ) |
| 307 | self.assertEqual(response.body, b"Sorry folks.\n") |
| 308 | |
| 309 | def test_reject_response_supports_int_status(self): |
| 310 | """reject() accepts an integer status code instead of an HTTPStatus.""" |
nothing calls this directly
no test coverage detected