Squash Odysseus development history

This commit is contained in:
pewdiepie-archdaemon
2026-09-11 06:04:19 +00:00
parent e5c99a5eee
commit 6ee6502010
2050 changed files with 538359 additions and 57745 deletions
+29
View File
@@ -0,0 +1,29 @@
"""Regression: mcp CLI _serialize must not crash when env JSON is not an object.
`env_obj = json.loads(s.env)` can yield a list (e.g. env stored as "[1,2]").
`if redact_env and env_obj:` then called `env_obj.items()` -> AttributeError.
Guard with isinstance(dict).
"""
from types import SimpleNamespace
from tests.helpers.cli_loader import load_script
from tests.helpers.db_stubs import make_core_db_stub
def _srv(env):
return SimpleNamespace(id="s1", name="n", transport="stdio", command="c", args="[]",
env=env, url=None, is_enabled=1, oauth_config=None, created_at=None)
def test_serialize_handles_list_env(monkeypatch):
make_core_db_stub(monkeypatch, models=["McpServer"])
cli = load_script("odysseus-mcp")
out = cli._serialize(_srv("[1, 2]")) # JSON array, not object
assert out["id"] == "s1"
def test_serialize_redacts_dict_env(monkeypatch):
make_core_db_stub(monkeypatch, models=["McpServer"])
cli = load_script("odysseus-mcp")
out = cli._serialize(_srv('{"API_KEY": "secret"}'))
assert out["env"] == {"API_KEY": "***"}