(self)
| 2271 | self.assertEqual(b'4\r\nbody\r\n0\r\n\r\n', f.read()) |
| 2272 | |
| 2273 | def test_binary_file_body(self): |
| 2274 | self.addCleanup(os_helper.unlink, os_helper.TESTFN) |
| 2275 | with open(os_helper.TESTFN, "wb") as f: |
| 2276 | f.write(b"body\xc1") |
| 2277 | with open(os_helper.TESTFN, "rb") as f: |
| 2278 | self.conn.request("PUT", "/url", f) |
| 2279 | message, f = self.get_headers_and_fp() |
| 2280 | self.assertEqual("text/plain", message.get_content_type()) |
| 2281 | self.assertIsNone(message.get_charset()) |
| 2282 | self.assertEqual("chunked", message.get("Transfer-Encoding")) |
| 2283 | self.assertNotIn("Content-Length", message) |
| 2284 | self.assertEqual(b'5\r\nbody\xc1\r\n0\r\n\r\n', f.read()) |
| 2285 | |
| 2286 | |
| 2287 | class HTTPResponseTest(TestCase): |
nothing calls this directly
no test coverage detected