MCPcopy Index your code
hub / github.com/microsoft/playwright-python / test_should_work

Function test_should_work

tests/async/test_fetch_global.py:32–46  ·  view source on GitHub ↗
(playwright: Playwright, method: str, server: Server)

Source from the content-addressed store, hash-verified

30 "method", ["fetch", "delete", "get", "head", "patch", "post", "put"]
31)
32async def test_should_work(playwright: Playwright, method: str, server: Server) -> None:
33 request = await playwright.request.new_context()
34 response: APIResponse = await getattr(request, method)(
35 server.PREFIX + "/simple.json"
36 )
37 assert response.status == 200
38 assert response.status_text == "OK"
39 assert response.ok is True
40 assert response.url == server.PREFIX + "/simple.json"
41 assert response.headers["content-type"] == "application/json"
42 assert {
43 "name": "Content-Type",
44 "value": "application/json",
45 } in response.headers_array
46 assert await response.text() == ("" if method == "head" else '{"foo": "bar"}\n')
47
48
49async def test_should_dispose_global_request(

Callers

nothing calls this directly

Calls 2

new_contextMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected