From 6d06001b6f0f2db6cd57d5c996bd3c8fbce2c051 Mon Sep 17 00:00:00 2001 From: b3nw Date: Wed, 1 Jul 2026 20:24:57 +0000 Subject: [PATCH] fix(tests): update _read_profile_model_config callers/assertions for 3-tuple return --- ...est_issue3405_profile_provider_resolution.py | 17 +++++++++-------- tests/test_issue5270_cli_webui_continuity.py | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/test_issue3405_profile_provider_resolution.py b/tests/test_issue3405_profile_provider_resolution.py index 7e6d403b..6f527121 100644 --- a/tests/test_issue3405_profile_provider_resolution.py +++ b/tests/test_issue3405_profile_provider_resolution.py @@ -283,14 +283,14 @@ class TestReadProfileModelConfig: """Tests for the _read_profile_model_config helper.""" def test_returns_none_when_no_profile(self): - """No session profile returns (None, None).""" + """No session profile returns (None, None, None).""" from api.routes import _read_profile_model_config class FakeSession: profile = None result = _read_profile_model_config(FakeSession(), None) - assert result == (None, None) + assert result == (None, None, None) def test_returns_none_when_explicit_provider(self): """Explicit requested_provider skips profile config read.""" @@ -300,7 +300,7 @@ class TestReadProfileModelConfig: profile = "work" result = _read_profile_model_config(FakeSession(), "openai-codex") - assert result == (None, None) + assert result == (None, None, None) def test_reads_profile_config(self, tmp_path): """Reads model.provider and model.default from profile config.yaml.""" @@ -319,10 +319,11 @@ class TestReadProfileModelConfig: with patch("api.profiles.get_hermes_home_for_profile", return_value=tmp_path): result = _read_profile_model_config(FakeSession(), None) - assert result == ("anthropic", "claude-sonnet-4.6") + assert result[:2] == ("anthropic", "claude-sonnet-4.6") + assert result[2] == {"model": {"provider": "anthropic", "default": "claude-sonnet-4.6"}} def test_missing_config_returns_none(self): - """Missing config.yaml returns (None, None).""" + """Missing config.yaml returns (None, None, None).""" from api.routes import _read_profile_model_config import tempfile @@ -333,10 +334,10 @@ class TestReadProfileModelConfig: with patch("api.profiles.get_hermes_home_for_profile", return_value=Path(td)): result = _read_profile_model_config(FakeSession(), None) - assert result == (None, None) + assert result == (None, None, None) def test_empty_provider_returns_none(self, tmp_path): - """Empty model.provider in config returns (None, None).""" + """Empty model.provider in config returns (None, default, config).""" from api.routes import _read_profile_model_config import yaml @@ -352,7 +353,7 @@ class TestReadProfileModelConfig: with patch("api.profiles.get_hermes_home_for_profile", return_value=tmp_path): result = _read_profile_model_config(FakeSession(), None) - assert result == (None, "claude-sonnet-4.6") + assert result == (None, "claude-sonnet-4.6", {"model": {"provider": "", "default": "claude-sonnet-4.6"}}) class TestStreamingWorkerEnrichment: diff --git a/tests/test_issue5270_cli_webui_continuity.py b/tests/test_issue5270_cli_webui_continuity.py index ac06b8c9..dfd40f43 100644 --- a/tests/test_issue5270_cli_webui_continuity.py +++ b/tests/test_issue5270_cli_webui_continuity.py @@ -275,7 +275,7 @@ def test_chat_start_refreshes_cli_messages_before_first_webui_turn(monkeypatch, monkeypatch.setattr(routes, "_get_or_materialize_session", _fake_get_or_materialize_session) monkeypatch.setattr(routes, "_session_visible_to_active_profile", lambda *args, **kwargs: True) monkeypatch.setattr(routes, "_resolve_chat_workspace_with_recovery", lambda *args, **kwargs: str(tmp_path)) - monkeypatch.setattr(routes, "_read_profile_model_config", lambda *args, **kwargs: (None, None)) + monkeypatch.setattr(routes, "_read_profile_model_config", lambda *args, **kwargs: (None, None, None)) monkeypatch.setattr( routes, "_resolve_compatible_session_model_state",