[eric] tests: mcp-offer suite isolates from the developer's real settings, a live dismissal was failing it

This commit is contained in:
ciregenz
2026-08-03 23:00:51 -07:00
parent eec6e5d7dc
commit 733fcfa4ce
+10
View File
@@ -7,6 +7,8 @@ loudly instead of shipping a silent gate bypass.
"""
import asyncio
import pytest
from types import SimpleNamespace
import backend.apps.agents.core.mcp_preflight as pf
@@ -24,6 +26,14 @@ def p_settings(dismissed=None):
return SimpleNamespace(dismissed_mcp_suggestions=dismissed or {})
@pytest.fixture(autouse=True)
def p_isolated_settings(monkeypatch):
"""run_preflight reads the REAL settings.json; a suggestion the developer dismissed in their
own app silently failed this suite (caught live 2026-08-04, Eric dismissed Google Workspace
mid-evening). Every test starts from empty dismissals; dismissal tests override explicitly."""
monkeypatch.setattr(pf, "load_settings", p_settings)
def test_offer_resolves_both_display_name_and_hotpath_slug(monkeypatch):
# The hot-path passes a sanitized slug ("google-workspace"); the curated id is a display name ("Google Workspace"). Both must resolve, so the wiring isn't a load-bearing string.
monkeypatch.setattr(pf, "load_all_tools", lambda: []) # nothing enabled