Add register_actions hook to test plugin and improve test

This commit is contained in:
Simon Willison 2025-10-23 15:21:55 -07:00
commit d73b6f169f
3 changed files with 28 additions and 0 deletions

View file

@ -1560,6 +1560,17 @@ async def test_hook_register_events():
assert any(k.__name__ == "OneEvent" for k in datasette.event_classes)
@pytest.mark.asyncio
async def test_hook_register_actions():
datasette = Datasette(memory=True, plugins_dir=PLUGINS_DIR)
await datasette.invoke_startup()
# Check that the custom action from my_plugin.py is registered
assert "view-collection" in datasette.actions
action = datasette.actions["view-collection"]
assert action.abbr == "vc"
assert action.description == "View a collection"
@pytest.mark.skip(reason="TODO")
@pytest.mark.parametrize(
"metadata,config,expected_metadata,expected_config",