mirror of
https://github.com/simonw/datasette.git
synced 2026-06-06 09:07:00 +02:00
Add /-/debug hub page with debug_menu() plugin hook
Replace the scattered debug tool links in the app menu with a single "Debug" link to a new /-/debug page. This page aggregates all debug tools using a new debug_menu() plugin hook, which plugins can implement to contribute DebugItem(title, description, path) entries. Hook implementations are responsible for their own permission checks, so the page only shows items the current actor can access. Core debug items (databases, plugins, versions, settings, permissions, etc.) are registered via default_debug_menu.py. https://claude.ai/code/session_01QE3BkTNRLvLEpLXy7ZDCeU
This commit is contained in:
parent
8a315f3d7d
commit
4c635a1d99
15 changed files with 238 additions and 32 deletions
|
|
@ -927,6 +927,18 @@ async def test_hook_handle_exception_custom_response(ds_client, param):
|
|||
assert response.text == param
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_hook_debug_menu(ds_client):
|
||||
# Without authentication, no plugin debug items
|
||||
response = await ds_client.get("/-/debug")
|
||||
assert "Test debug item" not in response.text
|
||||
|
||||
# With authentication, plugin debug items appear
|
||||
response_2 = await ds_client.get("/-/debug?_bot=1")
|
||||
assert "Test debug item" in response_2.text
|
||||
assert "From test plugin" in response_2.text
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_hook_menu_links(ds_client):
|
||||
def get_menu_links(html):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue