From fa01dd77fb86f421fbdedcc3065b84135b1b167d Mon Sep 17 00:00:00 2001 From: sascha Date: Sat, 5 Sep 2026 13:06:08 +0200 Subject: [PATCH] feat: benchmark direct media path (tests/test_app.py) --- tests/test_app.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/test_app.py b/tests/test_app.py index 4552a81..a98a293 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -43,7 +43,7 @@ def test_health_exposes_current_version(): with TestClient(app.app) as client: response = client.get("/health") assert response.status_code == 200 - assert response.json()["version"] == app.VERSION == "2.3.9" + assert response.json()["version"] == app.VERSION == "2.4.0" def test_media_handoff_proxies_strict_category_contract(monkeypatch): @@ -1355,3 +1355,18 @@ def test_sascha_media_tunnel_candidate_uses_valid_wireguard_interface_name(): script = base64.b64decode(encoded).decode() assert 'root / "wgmtest.conf"' in script assert len("wgmtest") <= 15 + + +def test_sascha_media_path_benchmark_returns_both_fixed_routes(monkeypatch): + monkeypatch.setattr(app, "_benchmark_sascha_media_paths", lambda: { + "legacy_node6": {"bytes": 268435456, "seconds": 4.0, "mbit_s": 536.9}, + "direct_wg_media": {"bytes": 268435456, "seconds": 3.0, "mbit_s": 715.8}, + }) + with TestClient(app.app) as client: + response = client.post( + "/network/media-tunnel/sascha/benchmark", + headers={"Authorization": "Bearer test-token"}, + ) + assert response.status_code == 200 + assert response.json()["direction"] == "emby-sascha_to_hetzner" + assert set(response.json()["results"]) == {"legacy_node6", "direct_wg_media"}