(self)
| 1184 | self.assertEqual(newreq.selector, '') |
| 1185 | |
| 1186 | def test_errors(self): |
| 1187 | h = urllib.request.HTTPErrorProcessor() |
| 1188 | o = h.parent = MockOpener() |
| 1189 | |
| 1190 | url = "http://example.com/" |
| 1191 | req = Request(url) |
| 1192 | # all 2xx are passed through |
| 1193 | r = MockResponse(200, "OK", {}, "", url) |
| 1194 | newr = h.http_response(req, r) |
| 1195 | self.assertIs(r, newr) |
| 1196 | self.assertNotHasAttr(o, "proto") # o.error not called |
| 1197 | r = MockResponse(202, "Accepted", {}, "", url) |
| 1198 | newr = h.http_response(req, r) |
| 1199 | self.assertIs(r, newr) |
| 1200 | self.assertNotHasAttr(o, "proto") # o.error not called |
| 1201 | r = MockResponse(206, "Partial content", {}, "", url) |
| 1202 | newr = h.http_response(req, r) |
| 1203 | self.assertIs(r, newr) |
| 1204 | self.assertNotHasAttr(o, "proto") # o.error not called |
| 1205 | # anything else calls o.error (and MockOpener returns None, here) |
| 1206 | r = MockResponse(502, "Bad gateway", {}, "", url) |
| 1207 | self.assertIsNone(h.http_response(req, r)) |
| 1208 | self.assertEqual(o.proto, "http") # o.error called |
| 1209 | self.assertEqual(o.args, (req, r, 502, "Bad gateway", {})) |
| 1210 | |
| 1211 | def test_cookies(self): |
| 1212 | cj = MockCookieJar() |
nothing calls this directly
no test coverage detected