MCPcopy Create free account
hub / github.com/0x676e67/wreq-python / test_inherit_client

Function test_inherit_client

tests/client_test.py:8–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6@pytest.mark.asyncio
7@pytest.mark.flaky(reruns=1, reruns_delay=2)
8async def test_inherit_client():
9 class SubClient(rnet.Client):
10 def __init__(self, **kwargs):
11 self.test_var = "test"
12 self.cookie_jar = None
13
14 client = SubClient(impersonate=Impersonate.Chrome133)
15 url = "https://google.com"
16 response = await client.get(url)
17 text = await response.text()
18 assert text is not None
19 assert client.cookie_jar is None
20 assert client.test_var == "test"
21 client.update(
22 impersonate=ImpersonateOption(
23 impersonate=Impersonate.Firefox135,
24 impersonate_os=ImpersonateOS.Windows,
25 skip_headers=False,
26 )
27 )
28 assert (
29 client.user_agent
30 == "Mozilla/5.0 (Windows NT 10.0; rv:135.0) Gecko/20100101 Firefox/135.0"
31 )
32 assert client.test_var == "test"
33
34
35@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 5

SubClientClass · 0.85
ImpersonateOptionClass · 0.85
getMethod · 0.45
textMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected