mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Add /-/actions endpoint to list registered actions
This adds a new endpoint at /-/actions that lists all registered actions in the permission system. The endpoint supports both JSON and HTML output. Changes: - Added _actions() method to Datasette class to return action list - Added route for /-/actions with JsonDataView - Created actions.html template for nice HTML display - Added template parameter to JsonDataView for custom templates - Moved respond_json_or_html from BaseView to JsonDataView - Added test for the new endpoint The endpoint requires view-instance permission and provides details about each action including name, abbreviation, description, resource class, and parent/child requirements. Closes #2547 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
5c537e0a3e
commit
b3721eaf50
6 changed files with 121 additions and 19 deletions
|
|
@ -1176,3 +1176,13 @@ async def test_custom_csrf_error(ds_client):
|
|||
assert response.status_code == 403
|
||||
assert response.headers["content-type"] == "text/html; charset=utf-8"
|
||||
assert "Error code is FORM_URLENCODED_MISMATCH." in response.text
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_actions_page(ds_client):
|
||||
response = await ds_client.get("/-/actions")
|
||||
assert response.status_code == 200
|
||||
assert "Registered Actions" in response.text
|
||||
assert "<th>Name</th>" in response.text
|
||||
assert "view-instance" in response.text
|
||||
assert "view-database" in response.text
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue