Partial json_renderer refactor, part of #2136

This commit is contained in:
Simon Willison 2023-08-09 11:52:51 -07:00
commit f3944608cc
5 changed files with 85 additions and 74 deletions

View file

@ -649,7 +649,6 @@ async def test_custom_sql(ds_client):
{"content": "RENDER_CELL_DEMO"},
{"content": "RENDER_CELL_ASYNC"},
],
"columns": ["content"],
"ok": True,
"truncated": False,
}

View file

@ -35,10 +35,10 @@ def test_serve_with_get(tmp_path_factory):
],
)
assert 0 == result.exit_code, result.output
assert {
"truncated": False,
"columns": ["sqlite_version()"],
}.items() <= json.loads(result.output).items()
data = json.loads(result.output)
# Should have a single row with a single column
assert len(data["rows"]) == 1
assert list(data["rows"][0].keys()) == ["sqlite_version()"]
# The plugin should have created hello.txt
assert (plugins_dir / "hello.txt").read_text() == "hello"