fix(pki-test): recognize explicit cert-auth chain rejection without accepting unrelated errors

This commit is contained in:
2026-11-20 21:33:47 +03:00
parent 67224e1512
commit d97403b03a
2 changed files with 49 additions and 1 deletions
+34
View File
@@ -0,0 +1,34 @@
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