Test the scenario where the server doesn't serve a response
(tctx, data)
| 779 | ], |
| 780 | ) |
| 781 | def test_server_aborts(tctx, data): |
| 782 | """Test the scenario where the server doesn't serve a response""" |
| 783 | server = Placeholder(Server) |
| 784 | flow = Placeholder(HTTPFlow) |
| 785 | playbook = Playbook(http.HttpLayer(tctx, HTTPMode.regular), hooks=False) |
| 786 | assert ( |
| 787 | playbook |
| 788 | >> DataReceived( |
| 789 | tctx.client, |
| 790 | b"GET http://example.com/ HTTP/1.1\r\nHost: example.com\r\n\r\n", |
| 791 | ) |
| 792 | << OpenConnection(server) |
| 793 | >> reply(None) |
| 794 | << SendData(server, b"GET / HTTP/1.1\r\nHost: example.com\r\n\r\n") |
| 795 | ) |
| 796 | if data: |
| 797 | playbook >> DataReceived(server, data) |
| 798 | assert ( |
| 799 | playbook |
| 800 | >> ConnectionClosed(server) |
| 801 | << CloseConnection(server) |
| 802 | << http.HttpErrorHook(flow) |
| 803 | >> reply() |
| 804 | << SendData(tctx.client, BytesMatching(b"502 Bad Gateway")) |
| 805 | << CloseConnection(tctx.client) |
| 806 | ) |
| 807 | assert flow().error |
| 808 | assert not flow().live |
| 809 | |
| 810 | |
| 811 | @pytest.mark.parametrize("redirect", ["", "change-destination", "change-proxy"]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…