row_actions() plugin hook, closes #2299

This commit is contained in:
Simon Willison 2024-03-12 16:13:31 -07:00
commit b8711988b9
7 changed files with 134 additions and 7 deletions

View file

@ -1000,6 +1000,24 @@ async def test_hook_query_actions(ds_client, path, expected_url):
]
@pytest.mark.asyncio
async def test_hook_row_actions(ds_client):
response = await ds_client.get("/fixtures/facet_cities/1")
assert get_actions_links(response.text) == []
response_2 = await ds_client.get(
"/fixtures/facet_cities/1",
cookies={"ds_actor": ds_client.actor_cookie({"id": "sam"})},
)
assert get_actions_links(response_2.text) == [
{
"label": "Row details for sam",
"href": "/",
"description": '{"id": 1, "name": "San Francisco"}',
}
]
@pytest.mark.asyncio
async def test_hook_database_actions(ds_client):
response = await ds_client.get("/fixtures")