b4fbd6fe9f
Deploy Site / deploy-vercel (push) Has been skipped
Deploy Site / deploy-docs (push) Has been skipped
Build Skills Index / build-index (push) Has been skipped
CI / Deny unrelated histories (push) Has been skipped
CI / Detect affected areas (push) Successful in 27m35s
CI / OSV scan (push) Failing after 4s
CI / Build&Test Docker image (push) Successful in 9s
CI / Supply-chain scan (push) Has been skipped
CI / Lint Docker scripts (push) Failing after 5m13s
CI / Check contributors (push) Failing after 12m8s
CI / Docs Site (push) Failing after 12m8s
CI / TypeScript (push) Failing after 12m8s
CI / Python lints (push) Failing after 12m9s
CI / Python tests (push) Failing after 12m9s
CI / Check uv.lock (push) Failing after 23m22s
CI / CI timing report (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
CI / All required checks pass (push) Has been cancelled
41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
"""Tests for agent.ssl_verify.resolve_httpx_verify."""
|
|
|
|
import ssl
|
|
|
|
import certifi
|
|
import pytest
|
|
|
|
from agent.ssl_verify import resolve_httpx_verify
|
|
|
|
_CA_ENV_VARS = ("HERMES_CA_BUNDLE", "SSL_CERT_FILE", "REQUESTS_CA_BUNDLE")
|
|
|
|
|
|
@pytest.fixture
|
|
def clean_ca_env(monkeypatch):
|
|
for var in _CA_ENV_VARS:
|
|
monkeypatch.delenv(var, raising=False)
|
|
|
|
|
|
def test_ssl_verify_false_disables_verification(clean_ca_env):
|
|
assert resolve_httpx_verify(ssl_verify=False) is False
|
|
|
|
|
|
def test_hermes_ca_bundle_returns_ssl_context(clean_ca_env, monkeypatch):
|
|
monkeypatch.setenv("HERMES_CA_BUNDLE", certifi.where())
|
|
result = resolve_httpx_verify()
|
|
assert isinstance(result, ssl.SSLContext)
|
|
|
|
|
|
def test_explicit_ca_bundle_param(clean_ca_env):
|
|
result = resolve_httpx_verify(ca_bundle=certifi.where())
|
|
assert isinstance(result, ssl.SSLContext)
|
|
|
|
|
|
def test_missing_ca_bundle_falls_back_to_true(clean_ca_env, monkeypatch):
|
|
monkeypatch.setenv("HERMES_CA_BUNDLE", "/nonexistent/root-ca.pem")
|
|
assert resolve_httpx_verify() is True
|
|
|
|
|
|
def test_default_without_env_is_true(clean_ca_env):
|
|
assert resolve_httpx_verify() is True
|