diff --git a/tests/hermes_cli/test_auth_commands.py b/tests/hermes_cli/test_auth_commands.py index 22182ba43a8..801b190cd79 100644 --- a/tests/hermes_cli/test_auth_commands.py +++ b/tests/hermes_cli/test_auth_commands.py @@ -1590,20 +1590,16 @@ def test_auth_remove_copilot_suppresses_all_variants(tmp_path, monkeypatch): hermes_home.mkdir(parents=True, exist_ok=True) monkeypatch.setenv("HERMES_HOME", str(hermes_home)) + # The copilot pool entry is no longer persisted directly in auth.json — + # `(copilot, gh_cli)` is borrowed and stripped by + # sanitize_borrowed_credential_payload (PR #31416, May 2026). Tokens are + # hydrated at runtime via resolve_copilot_token(). Mock that path so the + # pool has an entry to remove. _write_auth_store( tmp_path, { "version": 1, - "credential_pool": { - "copilot": [{ - "id": "c1", - "label": "gh auth token", - "auth_type": "api_key", - "priority": 0, - "source": "gh_cli", - "access_token": "ghp_fake", - }] - }, + "credential_pool": {"copilot": []}, }, ) @@ -1611,7 +1607,14 @@ def test_auth_remove_copilot_suppresses_all_variants(tmp_path, monkeypatch): from hermes_cli.auth import is_source_suppressed from hermes_cli.auth_commands import auth_remove_command - auth_remove_command(SimpleNamespace(provider="copilot", target="1")) + with patch( + "hermes_cli.copilot_auth.resolve_copilot_token", + return_value=("ghp_fake", "gh"), + ), patch( + "hermes_cli.copilot_auth.get_copilot_api_token", + return_value="ghu_fake_api", + ): + auth_remove_command(SimpleNamespace(provider="copilot", target="1")) assert is_source_suppressed("copilot", "gh_cli") assert is_source_suppressed("copilot", "env:COPILOT_GITHUB_TOKEN")