(self)
| 656 | self.assertEqual(o.calls, [(handlers[0], "http_open", (req,), {})]) |
| 657 | |
| 658 | def test_http_error(self): |
| 659 | # XXX http_error_default |
| 660 | # http errors are a special case |
| 661 | o = OpenerDirector() |
| 662 | meth_spec = [ |
| 663 | [("http_open", "error 302")], |
| 664 | [("http_error_400", "raise"), "http_open"], |
| 665 | [("http_error_302", "return response"), "http_error_303", |
| 666 | "http_error"], |
| 667 | [("http_error_302")], |
| 668 | ] |
| 669 | handlers = add_ordered_mock_handlers(o, meth_spec) |
| 670 | req = Request("http://example.com/") |
| 671 | o.open(req) |
| 672 | assert len(o.calls) == 2 |
| 673 | calls = [(handlers[0], "http_open", (req,)), |
| 674 | (handlers[2], "http_error_302", |
| 675 | (req, support.ALWAYS_EQ, 302, "", {}))] |
| 676 | for expected, got in zip(calls, o.calls): |
| 677 | handler, method_name, args = expected |
| 678 | self.assertEqual((handler, method_name), got[:2]) |
| 679 | self.assertEqual(args, got[2]) |
| 680 | |
| 681 | def test_processors(self): |
| 682 | # *_request / *_response methods get called appropriately |
nothing calls this directly
no test coverage detected