Esempio n. 1
0
def test_invalid_certificate_response_untrusted(
        untrusted_cert_b64: str) -> None:
    resp = _invalid_certificate_response(
        Headers(headers={"certificate": untrusted_cert_b64}))
    assert resp
    assert resp.status_code == 401
    assert resp.body == b'{"detail":"Client certificate not trusted"}'
Esempio n. 2
0
def test_invalid_certificate_response_malformed() -> None:
    resp = _invalid_certificate_response(Headers(headers={"certificate": "let me in!"}))
    assert resp
    assert resp.status_code == 400
    assert resp.body == b'{"detail":"Client certificate deserialization: base64 decoding failed"}'
Esempio n. 3
0
def test_invalid_certificate_response_missing() -> None:
    resp = _invalid_certificate_response(Headers(headers={}))
    assert resp
    assert resp.status_code == 400
    assert resp.body == b'{"detail":"Client certificate missing in header"}'
Esempio n. 4
0
def test_invalid_certificate_response_ok(trusted_cert_b64: str) -> None:
    assert _invalid_certificate_response(Headers(headers={"certificate": trusted_cert_b64})) is None