Files
pyxis/tests/native/test_unknown_source_key_request.py
T
Torlando 2eec34dfe1 test: extract unknown-source key-request policy + host tests
Move the rate-limit/cooldown/cap decision out of the UIManager.cpp
anonymous namespace into a pure, header-only policy
(UI/LXMF/UnknownSourceKeyRequest.h) so it is host-testable without the
ESP/microReticulum stack. UIManager keeps only the side effect
(Transport::request_path).

Adds tests/native/test_unknown_source_key_request.{cpp,py} (24 checks,
ASan+UBSan): new-source request, 5-min cooldown boundary, re-record
resets the window, per-source independence, 64-entry cap with oldest
eviction, and steady-state cost.
2026-09-02 16:22:56 +00:00

22 lines
618 B
Python

"""Compile and execute the unknown-source key-request policy test."""
from pathlib import Path
from native_test import compile_and_run
HERE = Path(__file__).resolve().parent
PYXIS_ROOT = HERE.parent.parent
def test_unknown_source_key_request(tmp_path):
ran = compile_and_run(
tmp_path,
name="test_unknown_source_key_request",
sources=[HERE / "test_unknown_source_key_request.cpp"],
include_dirs=[PYXIS_ROOT / "lib" / "tdeck_ui"],
sanitize=True,
timeout=60,
)
assert "unknown source key request policy:" in ran.stdout
assert "0 failed" in ran.stdout