forked from mtusi2026/mtusi2026lab7
fix(pki-test): recognize explicit cert-auth chain rejection without accepting unrelated errors
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user