mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Update test infrastructure to use register_actions hook
- Consolidated register_permissions and register_actions hooks in my_plugin.py - Added permission_resources_sql hook to provide SQL-based permission rules - Updated conftest.py to reference datasette.actions instead of datasette.permissions - Updated fixtures.py to include permission_resources_sql hook and remove register_permissions - Added backwards compatibility support for old datasette-register-permissions config - Converted test actions (this_is_allowed, this_is_denied, etc.) to use permission_resources_sql 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
59ccf797c4
commit
fe2084df66
3 changed files with 89 additions and 34 deletions
|
|
@ -147,8 +147,8 @@ def check_permission_actions_are_documented():
|
|||
def before(hook_name, hook_impls, kwargs):
|
||||
if hook_name == "permission_allowed":
|
||||
datasette = kwargs["datasette"]
|
||||
assert kwargs["action"] in datasette.permissions, (
|
||||
"'{}' has not been registered with register_permissions()".format(
|
||||
assert kwargs["action"] in datasette.actions, (
|
||||
"'{}' has not been registered with register_actions()".format(
|
||||
kwargs["action"]
|
||||
)
|
||||
+ " (or maybe a test forgot to do await ds.invoke_startup())"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue