(self)
| 910 | self.assertTrue(resp.closed) |
| 911 | |
| 912 | def test_partial_readintos_no_content_length(self): |
| 913 | # when no length is present, the socket should be gracefully closed when |
| 914 | # all data was read |
| 915 | body = "HTTP/1.1 200 Ok\r\n\r\nText" |
| 916 | sock = FakeSocket(body) |
| 917 | resp = client.HTTPResponse(sock) |
| 918 | resp.begin() |
| 919 | b = bytearray(2) |
| 920 | n = resp.readinto(b) |
| 921 | self.assertEqual(n, 2) |
| 922 | self.assertEqual(bytes(b), b'Te') |
| 923 | self.assertFalse(resp.isclosed()) |
| 924 | n = resp.readinto(b) |
| 925 | self.assertEqual(n, 2) |
| 926 | self.assertEqual(bytes(b), b'xt') |
| 927 | n = resp.readinto(b) |
| 928 | self.assertEqual(n, 0) |
| 929 | self.assertTrue(resp.isclosed()) |
| 930 | |
| 931 | def test_partial_reads_incomplete_body(self): |
| 932 | # if the server shuts down the connection before the whole |
nothing calls this directly
no test coverage detected