|
20 | 20 |
|
21 | 21 | from playwright.sync_api import BrowserContext, Error, FilePayload, Page |
22 | 22 | from tests.server import Server |
| 23 | +from tests.utils import must |
23 | 24 |
|
24 | 25 |
|
25 | 26 | def test_get_should_work(context: BrowserContext, server: Server) -> None: |
@@ -150,11 +151,11 @@ def support_post_data(fetch_data: Any, request_post_data: Any) -> None: |
150 | 151 | server.PREFIX + "/simple.json", data=fetch_data |
151 | 152 | ) |
152 | 153 | assert request.value.method.decode() == method.upper() |
153 | | - assert request.value.post_body == request_post_data # type: ignore |
| 154 | + assert request.value.post_body == request_post_data |
154 | 155 | assert response.status == 200 |
155 | 156 | assert response.url == server.PREFIX + "/simple.json" |
156 | 157 | assert request.value.getHeader("Content-Length") == str( |
157 | | - len(request.value.post_body) # type: ignore |
| 158 | + len(must(request.value.post_body)) |
158 | 159 | ) |
159 | 160 |
|
160 | 161 | support_post_data("My request", "My request".encode()) |
@@ -182,9 +183,9 @@ def test_should_support_application_x_www_form_urlencoded( |
182 | 183 | server_req.value.getHeader("Content-Type") |
183 | 184 | == "application/x-www-form-urlencoded" |
184 | 185 | ) |
185 | | - body = server_req.value.post_body.decode() # type: ignore |
| 186 | + body = must(server_req.value.post_body).decode() |
186 | 187 | assert server_req.value.getHeader("Content-Length") == str(len(body)) |
187 | | - params: Dict[bytes, List[bytes]] = parse_qs(server_req.value.post_body) # type: ignore |
| 188 | + params: Dict[bytes, List[bytes]] = parse_qs(server_req.value.post_body) |
188 | 189 | assert params[b"firstName"] == [b"John"] |
189 | 190 | assert params[b"lastName"] == [b"Doe"] |
190 | 191 | assert params[b"file"] == [b"f.js"] |
@@ -212,7 +213,7 @@ def test_should_support_multipart_form_data( |
212 | 213 | assert content_type |
213 | 214 | assert content_type.startswith("multipart/form-data; ") |
214 | 215 | assert server_req.value.getHeader("Content-Length") == str( |
215 | | - len(server_req.value.post_body) # type: ignore |
| 216 | + len(must(server_req.value.post_body)) |
216 | 217 | ) |
217 | 218 | assert server_req.value.args[b"firstName"] == [b"John"] |
218 | 219 | assert server_req.value.args[b"lastName"] == [b"Doe"] |
|
0 commit comments