Skip to content

The agent that grows with you

test(auth): the Codex opt-out self-heal test never calls the real token endpoint

Tekniume55c2662f5eb
diff --git a/tests/hermes_cli/test_auth_codex_self_heal.py b/tests/hermes_cli/test_auth_codex_self_heal.py
index 9f653b17b96..8f156c4fb9e 100644
--- a/tests/hermes_cli/test_auth_codex_self_heal.py
+++ b/tests/hermes_cli/test_auth_codex_self_heal.py
@@ -124,6 +124,9 @@ def test_opt_out_never_adopts_codex_cli_login(tmp_path, monkeypatch):
def _rejected(*_a, **_k):
raise AuthError("bad", provider="openai-codex", code="invalid_grant", relogin_required=True)
+ # _refresh_codex_auth_tokens imports it from the hermes_cli.auth facade at call time: patch both, or
+ # the test reaches the real token endpoint and asserts on whatever it answers.
+ monkeypatch.setattr(auth, "refresh_codex_oauth_pure", _rejected)
monkeypatch.setattr(auth_codex, "refresh_codex_oauth_pure", _rejected)
with pytest.raises(AuthError) as info:
_refresh_codex_auth_tokens(dict(STALE), 5.0)