test(proxy): cover _has_truthy_permission shapes for codecov

Dict/sequence/invalid cases for the get_spend_routes auth helper so
codecov/patch sees the list/tuple and fallback branches (#47112).
This commit is contained in:
er-s-an 2026-10-19 20:29:37 +08:00
parent 8001e5be17
commit ce4efddad8

View file

@ -2203,6 +2203,28 @@ def test_get_spend_routes_false_permission_denies_internal_user(route):
assert "Only proxy admin" in str(exc_info.value)
@pytest.mark.parametrize(
"permissions, expected",
[
({"get_spend_routes": True}, True),
({"get_spend_routes": False}, False),
({}, False),
(["get_spend_routes"], True),
(("get_spend_routes",), True),
({"get_spend_routes"}, True),
(["other"], False),
(None, False),
("get_spend_routes", False),
],
)
def test_has_truthy_permission_shapes(permissions, expected):
"""Cover dict / sequence / invalid shapes for the shared helper (#47112)."""
assert (
RouteChecks._has_truthy_permission(permissions, "get_spend_routes")
is expected
)
@pytest.mark.parametrize("route", ["/audit", "/audit/some-log-id"])
def test_proxy_admin_viewer_can_access_audit_logs(route):
"""