| 155 | |
| 156 | @contextlib.contextmanager |
| 157 | def expect_request(self, path: str) -> Generator[ExpectResponse[TestServerRequest], None, None]: |
| 158 | future = asyncio.create_task(self.wait_for_request(path)) |
| 159 | |
| 160 | cb_wrapper: ExpectResponse[TestServerRequest] = ExpectResponse() |
| 161 | |
| 162 | def done_cb(task: asyncio.Task) -> None: |
| 163 | cb_wrapper._value = future.result() |
| 164 | |
| 165 | future.add_done_callback(done_cb) |
| 166 | yield cb_wrapper |
| 167 | |
| 168 | def set_auth(self, path: str, username: str, password: str) -> None: |
| 169 | self.auth[path] = (username, password) |