import httpx import pytest from scripts.pki import cert_auth_denied @pytest.mark.parametrize( ("status", "body", "denied"), [ ( 400, { "errors": [ "no chain matching all constraints could be found " "for this login certificate" ] }, True, ), (403, {"errors": ["permission denied"]}, True), (400, {"errors": ["invalid JSON"]}, False), (200, {"auth": {"client_token": "synthetic-token"}}, False), ( 403, { "auth": {"client_token": "synthetic-token"}, "errors": ["permission denied"], }, False, ), ], ) def test_revoked_login_requires_an_actual_denial(status, body, denied): assert cert_auth_denied(httpx.Response(status, json=body)) is denied