mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-08-27 14:17:10 -04:00
- Restore build_provider_section() to headroom/providers/codex/install.py without requires_openai_auth (was removed entirely; pre-existing test test_provider_codex_install.py imports it and would fail to collect) - Flip test_codex_provider_section_preserves_openai_oauth to assert requires_openai_auth is ABSENT, not present (old behavior was wrong) - Fix test_provider_codex_runtime.py:337 same way — init config must NOT contain requires_openai_auth - Fix Ruff B023 lint error in test_providers.py:492 — capture loop variable config_path in lambda default arg (_p=config_path) - Fix e2e/init/run.py _verify_codex_local and _verify_codex_global to assert requires_openai_auth is absent, not present - Fix e2e/wrap/run.py verify_codex_wrap same way All unit tests pass locally (82 affected tests green). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
35 lines
1.4 KiB
Python
35 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
from headroom.providers.codex.install import build_provider_section
|
|
|
|
|
|
def test_codex_provider_section_no_requires_openai_auth() -> None:
|
|
"""Bug 3 (#406): build_provider_section must NOT include requires_openai_auth.
|
|
|
|
Setting requires_openai_auth on a custom [model_providers.headroom] block
|
|
forces codex to demand OpenAI OAuth login for every headroom-routed request.
|
|
Headroom is a local proxy — it must never carry this flag.
|
|
"""
|
|
section = build_provider_section(port=8787, name="OpenAI via Headroom proxy")
|
|
|
|
assert 'name = "OpenAI via Headroom proxy"' in section
|
|
assert 'base_url = "http://127.0.0.1:8787/v1"' in section
|
|
assert "requires_openai_auth" not in section, (
|
|
f"requires_openai_auth must be absent from the headroom provider section; got:\n{section}"
|
|
)
|
|
assert "supports_websockets = true" in section
|
|
assert 'env_key = "OPENAI_API_KEY"' not in section
|
|
|
|
|
|
def test_codex_provider_section_supports_custom_markers() -> None:
|
|
section = build_provider_section(
|
|
port=9100,
|
|
name="Headroom init proxy",
|
|
marker_start="# --- start ---",
|
|
marker_end="# --- end ---",
|
|
)
|
|
|
|
assert section.startswith("# --- start ---\n")
|
|
assert section.endswith("# --- end ---\n")
|
|
assert 'base_url = "http://127.0.0.1:9100/v1"' in section
|
|
assert 'env_key = "OPENAI_API_KEY"' not in section
|