mirror of
https://github.com/Cccc-owo/CheckInApp.git
synced 2026-06-17 14:06:28 +00:00
d811c20932
BREAKING CHANGE: backend now requires Python 3.12 or newer.
38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
from __future__ import annotations
|
|
|
|
from backend.workers.browser_automation import (
|
|
PlaywrightLaunchConfig,
|
|
extract_cookie_value,
|
|
extract_payload_header,
|
|
)
|
|
|
|
|
|
def test_payload_header_extraction_is_case_insensitive() -> None:
|
|
headers = {
|
|
"Accept": "application/json",
|
|
"X-API-Request-Payload": "live-signature",
|
|
}
|
|
|
|
assert extract_payload_header(headers) == "live-signature"
|
|
|
|
|
|
def test_payload_header_extraction_ignores_blank_values() -> None:
|
|
headers = {"x-api-request-payload": " "}
|
|
|
|
assert extract_payload_header(headers) is None
|
|
|
|
|
|
def test_cookie_value_extraction_finds_named_cookie() -> None:
|
|
cookies = [
|
|
{"name": "other", "value": "unused"},
|
|
{"name": "token", "value": "qq-token"},
|
|
]
|
|
|
|
assert extract_cookie_value(cookies, "token") == "qq-token"
|
|
|
|
|
|
def test_launch_config_uses_optional_executable_path() -> None:
|
|
config = PlaywrightLaunchConfig(executable_path="/usr/bin/chromium")
|
|
|
|
assert config.to_launch_kwargs()["executable_path"] == "/usr/bin/chromium"
|