added passing headers

This commit is contained in:
TPV committed 2026-07-30 14:29:58 -07:00
1 parent 8903be2685
commit 2e6e7ebc69
2 files changed
+18 -4

No files matched your search

+15 -3
View File
@@ -35,10 +35,15 @@ def stub_session(monkeypatch) -> dict:
"""Fake get_default_session, recording each call's kwargs and session."""
calls = []
def fake(proxies, timeout=None, max_clients=None):
def fake(proxies, headers=None, timeout=None, max_clients=None):
session = FakeSession()
calls.append(
{"timeout": timeout, "max_clients": max_clients, "session": session}
{
"headers": headers,
"timeout": timeout,
"max_clients": max_clients,
"session": session,
}
)
return session
@@ -66,10 +71,17 @@ def test_session_params_reach_the_factory(monkeypatch):
asyncio.run(
run_bounded_cycle(
["a"], task, None, None, session_timeout=8, max_clients=81
["a"],
task,
None,
None,
headers={"referer": "https://x/"},
session_timeout=8,
max_clients=81,
)
)
assert calls[0]["headers"] == {"referer": "https://x/"}
assert calls[0]["timeout"] == 8
assert calls[0]["max_clients"] == 81