(self, tctx, pipeline)
| 115 | class TestClient: |
| 116 | @pytest.mark.parametrize("pipeline", ["pipeline", None]) |
| 117 | def test_simple(self, tctx, pipeline): |
| 118 | req = http.Request.make("GET", "http://example.com/") |
| 119 | resp = Placeholder(ResponseHeaders) |
| 120 | |
| 121 | playbook = Playbook(Http1Client(tctx)) |
| 122 | ( |
| 123 | playbook |
| 124 | >> RequestHeaders(1, req, True) |
| 125 | << SendData(tctx.server, b"GET / HTTP/1.1\r\ncontent-length: 0\r\n\r\n") |
| 126 | >> RequestEndOfMessage(1) |
| 127 | ) |
| 128 | if pipeline: |
| 129 | with pytest.raises( |
| 130 | AssertionError, match="assert self.stream_id == event.stream_id" |
| 131 | ): |
| 132 | assert playbook >> RequestHeaders(3, req, True) |
| 133 | return |
| 134 | assert ( |
| 135 | playbook |
| 136 | >> DataReceived( |
| 137 | tctx.server, b"HTTP/1.1 200 OK\r\ncontent-length: 0\r\n\r\n" |
| 138 | ) |
| 139 | << ReceiveHttp(resp) |
| 140 | << ReceiveHttp(ResponseEndOfMessage(1)) |
| 141 | # no we can send the next request |
| 142 | >> RequestHeaders(3, req, True) |
| 143 | << SendData(tctx.server, b"GET / HTTP/1.1\r\ncontent-length: 0\r\n\r\n") |
| 144 | ) |
| 145 | assert resp().response.status_code == 200 |
| 146 | |
| 147 | def test_connect(self, tctx): |
| 148 | req = http.Request.make("CONNECT", "http://example.com:443") |
nothing calls this directly
no test coverage detected