(self)
| 2315 | self.assertEqual(b'4\r\nbody\r\n0\r\n\r\n', f.read()) |
| 2316 | |
| 2317 | def test_binary_file_body(self): |
| 2318 | self.addCleanup(os_helper.unlink, os_helper.TESTFN) |
| 2319 | with open(os_helper.TESTFN, "wb") as f: |
| 2320 | f.write(b"body\xc1") |
| 2321 | with open(os_helper.TESTFN, "rb") as f: |
| 2322 | self.conn.request("PUT", "/url", f) |
| 2323 | message, f = self.get_headers_and_fp() |
| 2324 | self.assertEqual("text/plain", message.get_content_type()) |
| 2325 | self.assertIsNone(message.get_charset()) |
| 2326 | self.assertEqual("chunked", message.get("Transfer-Encoding")) |
| 2327 | self.assertNotIn("Content-Length", message) |
| 2328 | self.assertEqual(b'5\r\nbody\xc1\r\n0\r\n\r\n', f.read()) |
| 2329 | |
| 2330 | |
| 2331 | class HTTPResponseTest(TestCase): |
nothing calls this directly
no test coverage detected