mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-12 03:42:08 +00:00
fix(auth): keep Spotify logout from resetting model config
This commit is contained in:
parent
2021c18655
commit
8dcdc3cbc2
2 changed files with 61 additions and 5 deletions
|
|
@ -88,6 +88,51 @@ def test_auth_spotify_status_command_reports_logged_in(capsys, monkeypatch: pyte
|
|||
assert "client_id: spotify-client" in output
|
||||
|
||||
|
||||
def test_spotify_logout_does_not_reset_model_provider(
|
||||
tmp_path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
capsys,
|
||||
) -> None:
|
||||
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
|
||||
config_path = tmp_path / "config.yaml"
|
||||
config_path.write_text(
|
||||
"model:\n"
|
||||
" default: gemini-3-flash\n"
|
||||
" provider: custom:local\n"
|
||||
" base_url: http://localhost:11434/v1\n"
|
||||
" api_key: ${LOCAL_API_KEY}\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
with auth_mod._auth_store_lock():
|
||||
store = auth_mod._load_auth_store()
|
||||
auth_mod._store_provider_state(
|
||||
store,
|
||||
"spotify",
|
||||
{
|
||||
"client_id": "spotify-client",
|
||||
"access_token": "access-token",
|
||||
"refresh_token": "refresh-token",
|
||||
"expires_at": "2099-01-01T00:00:00+00:00",
|
||||
},
|
||||
set_active=False,
|
||||
)
|
||||
auth_mod._save_auth_store(store)
|
||||
|
||||
auth_mod.logout_command(SimpleNamespace(provider="spotify"))
|
||||
|
||||
output = capsys.readouterr().out
|
||||
assert "Logged out of Spotify." in output
|
||||
assert "Model provider configuration was unchanged." in output
|
||||
assert auth_mod.get_provider_auth_state("spotify") is None
|
||||
assert config_path.read_text(encoding="utf-8") == (
|
||||
"model:\n"
|
||||
" default: gemini-3-flash\n"
|
||||
" provider: custom:local\n"
|
||||
" base_url: http://localhost:11434/v1\n"
|
||||
" api_key: ${LOCAL_API_KEY}\n"
|
||||
)
|
||||
|
||||
|
||||
def test_spotify_interactive_setup_persists_client_id(
|
||||
tmp_path,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue