test(harness): pin session list/show json keys + schema alias
- test_list_sessions_required_keys: assert full spec key set (adds summary/updated_at/author) so dropping any goes caught. - test_cli_show_json_valid: assert "schema" in / "db_schema" not in data to pin by_alias=True on the alias-sensitive field. Production code unchanged. 8 passed; full suite 230 passed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -39,7 +39,7 @@ def test_list_sessions_required_keys(tmp_path):
|
|||||||
create_session("qualsiasi domanda", db, tmp_path)
|
create_session("qualsiasi domanda", db, tmp_path)
|
||||||
rows = _list_sessions(tmp_path)
|
rows = _list_sessions(tmp_path)
|
||||||
assert len(rows) >= 1
|
assert len(rows) >= 1
|
||||||
required = {"id", "status", "question", "created_at"}
|
required = {"id", "status", "question", "summary", "created_at", "updated_at", "author"}
|
||||||
assert required.issubset(rows[0].keys())
|
assert required.issubset(rows[0].keys())
|
||||||
|
|
||||||
|
|
||||||
@@ -136,6 +136,9 @@ def test_cli_show_json_valid(tmp_path, monkeypatch):
|
|||||||
assert data["id"] == m.id
|
assert data["id"] == m.id
|
||||||
assert "phase" in data
|
assert "phase" in data
|
||||||
assert "has_schema_linking" in data
|
assert "has_schema_linking" in data
|
||||||
|
# Pin by_alias=True: the alias-sensitive field must serialize as "schema", not "db_schema".
|
||||||
|
assert "schema" in data
|
||||||
|
assert "db_schema" not in data
|
||||||
|
|
||||||
|
|
||||||
def test_cli_show_json_stdout_pristine(tmp_path, monkeypatch):
|
def test_cli_show_json_stdout_pristine(tmp_path, monkeypatch):
|
||||||
|
|||||||
Reference in New Issue
Block a user