mirror of
https://github.com/simonw/datasette.git
synced 2026-07-09 00:54:35 +02:00
Convert /-/actions.json from top-level array to object
/-/actions.json now returns {"ok": true, "actions": [...]} instead of a
bare JSON array, so the response can grow additional keys without a
breaking change. The debug_actions.html template reads data.actions,
and the endpoint is now documented in docs/introspection.rst.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GrHZSypDfMnym1tM5XJAFZ
This commit is contained in:
parent
19e54b10d4
commit
23ccdaeffc
7 changed files with 56 additions and 18 deletions
|
|
@ -579,7 +579,7 @@ async def test_actions_json(ds_client):
|
|||
try:
|
||||
ds_client.ds.root_enabled = True
|
||||
response = await ds_client.get("/-/actions.json", actor={"id": "root"})
|
||||
data = response.json()
|
||||
data = response.json()["actions"]
|
||||
finally:
|
||||
ds_client.ds.root_enabled = original_root_enabled
|
||||
assert isinstance(data, list)
|
||||
|
|
|
|||
|
|
@ -101,3 +101,14 @@ async def test_databases_json_is_object(ds_client):
|
|||
assert data["ok"] is True
|
||||
assert isinstance(data["databases"], list)
|
||||
assert "fixtures" in {db["name"] for db in data["databases"]}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_actions_json_is_object(ds_envelope):
|
||||
response = await ds_envelope.client.get("/-/actions.json", actor={"id": "root"})
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert set(data.keys()) == {"ok", "actions"}
|
||||
assert data["ok"] is True
|
||||
assert isinstance(data["actions"], list)
|
||||
assert "view-instance" in {action["name"] for action in data["actions"]}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue