Update tests to use new allowed() method instead of permission_allowed()

This commit is contained in:
Simon Willison 2025-10-24 14:06:05 -07:00
commit 7aaff5e3d2
5 changed files with 211 additions and 6 deletions

View file

@ -357,10 +357,10 @@ async def test_root_with_root_enabled_gets_all_permissions(ds_client):
# Test instance-level permissions (no resource)
assert (
await ds_client.ds.permission_allowed(root_actor, "permissions-debug", None)
await ds_client.ds.allowed(action="permissions-debug", actor=root_actor)
is True
)
assert await ds_client.ds.permission_allowed(root_actor, "debug-menu", None) is True
assert await ds_client.ds.allowed(action="debug-menu", actor=root_actor) is True
# Test view permissions using the new ds.allowed() method
assert (
@ -478,8 +478,8 @@ async def test_root_without_root_enabled_no_special_permissions(ds_client):
# But restricted permissions should NOT automatically be granted
# Test with instance-level permission (no resource class)
result = await ds_client.ds.permission_allowed(
root_actor, "permissions-debug", None
result = await ds_client.ds.allowed(
action="permissions-debug", actor=root_actor
)
assert (
result is not True