(self)
| 1201 | self.assertEqual(newreq.selector, '') |
| 1202 | |
| 1203 | def test_errors(self): |
| 1204 | h = urllib.request.HTTPErrorProcessor() |
| 1205 | o = h.parent = MockOpener() |
| 1206 | |
| 1207 | url = "http://example.com/" |
| 1208 | req = Request(url) |
| 1209 | # all 2xx are passed through |
| 1210 | r = MockResponse(200, "OK", {}, "", url) |
| 1211 | newr = h.http_response(req, r) |
| 1212 | self.assertIs(r, newr) |
| 1213 | self.assertNotHasAttr(o, "proto") # o.error not called |
| 1214 | r = MockResponse(202, "Accepted", {}, "", url) |
| 1215 | newr = h.http_response(req, r) |
| 1216 | self.assertIs(r, newr) |
| 1217 | self.assertNotHasAttr(o, "proto") # o.error not called |
| 1218 | r = MockResponse(206, "Partial content", {}, "", url) |
| 1219 | newr = h.http_response(req, r) |
| 1220 | self.assertIs(r, newr) |
| 1221 | self.assertNotHasAttr(o, "proto") # o.error not called |
| 1222 | # anything else calls o.error (and MockOpener returns None, here) |
| 1223 | r = MockResponse(502, "Bad gateway", {}, "", url) |
| 1224 | self.assertIsNone(h.http_response(req, r)) |
| 1225 | self.assertEqual(o.proto, "http") # o.error called |
| 1226 | self.assertEqual(o.args, (req, r, 502, "Bad gateway", {})) |
| 1227 | |
| 1228 | def test_cookies(self): |
| 1229 | cj = MockCookieJar() |
nothing calls this directly
no test coverage detected