mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
row_actions() plugin hook, closes #2299
This commit is contained in:
parent
7339cc51de
commit
b8711988b9
7 changed files with 134 additions and 7 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue