(self)
| 673 | self.assertEqual(o.calls, [(handlers[0], "http_open", (req,), {})]) |
| 674 | |
| 675 | def test_http_error(self): |
| 676 | # XXX http_error_default |
| 677 | # http errors are a special case |
| 678 | o = OpenerDirector() |
| 679 | meth_spec = [ |
| 680 | [("http_open", "error 302")], |
| 681 | [("http_error_400", "raise"), "http_open"], |
| 682 | [("http_error_302", "return response"), "http_error_303", |
| 683 | "http_error"], |
| 684 | [("http_error_302")], |
| 685 | ] |
| 686 | handlers = add_ordered_mock_handlers(o, meth_spec) |
| 687 | req = Request("http://example.com/") |
| 688 | o.open(req) |
| 689 | assert len(o.calls) == 2 |
| 690 | calls = [(handlers[0], "http_open", (req,)), |
| 691 | (handlers[2], "http_error_302", |
| 692 | (req, support.ALWAYS_EQ, 302, "", {}))] |
| 693 | for expected, got in zip(calls, o.calls): |
| 694 | handler, method_name, args = expected |
| 695 | self.assertEqual((handler, method_name), got[:2]) |
| 696 | self.assertEqual(args, got[2]) |
| 697 | |
| 698 | def test_processors(self): |
| 699 | # *_request / *_response methods get called appropriately |
nothing calls this directly
no test coverage detected