mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Remove permission_allowed hook entirely, refs #2528
The permission_allowed hook has been fully replaced by permission_resources_sql. This commit removes: - hookspec definition from hookspecs.py - 4 implementations from default_permissions.py - implementations from test plugins (my_plugin.py, my_plugin_2.py) - hook monitoring infrastructure from conftest.py - references from fixtures.py - Also fixes test_get_permission to use ds.get_action() instead of ds.get_permission() - Removes 5th column (source_plugin) from PermissionSQL queries This completes the migration to the SQL-based permission system.
This commit is contained in:
parent
60a38cee85
commit
5feb5fcf5d
7 changed files with 23 additions and 159 deletions
|
|
@ -164,14 +164,13 @@ def test_datasette_error_if_string_not_list(tmpdir):
|
|||
async def test_get_permission(ds_client):
|
||||
ds = ds_client.ds
|
||||
for name_or_abbr in ("vi", "view-instance", "vt", "view-table"):
|
||||
permission = ds.get_permission(name_or_abbr)
|
||||
action = ds.get_action(name_or_abbr)
|
||||
if "-" in name_or_abbr:
|
||||
assert permission.name == name_or_abbr
|
||||
assert action.name == name_or_abbr
|
||||
else:
|
||||
assert permission.abbr == name_or_abbr
|
||||
# And test KeyError
|
||||
with pytest.raises(KeyError):
|
||||
ds.get_permission("missing-permission")
|
||||
assert action.abbr == name_or_abbr
|
||||
# And test None return for missing action
|
||||
assert ds.get_action("missing-permission") is None
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue