mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
/-/actor.json no longer requires view-instance, closes #1945
This commit is contained in:
parent
3e6a208ba3
commit
c6a811237c
3 changed files with 38 additions and 3 deletions
|
|
@ -8,6 +8,7 @@ from pprint import pprint
|
|||
import pytest_asyncio
|
||||
import pytest
|
||||
import re
|
||||
import time
|
||||
import urllib
|
||||
|
||||
|
||||
|
|
@ -818,3 +819,26 @@ async def test_permissions_in_metadata(
|
|||
assert result == expected_result
|
||||
finally:
|
||||
perms_ds._metadata_local = previous_metadata
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_actor_endpoint_allows_any_token():
|
||||
ds = Datasette()
|
||||
token = ds.sign(
|
||||
{
|
||||
"a": "root",
|
||||
"token": "dstok",
|
||||
"t": int(time.time()),
|
||||
"_r": {"a": ["debug-menu"]},
|
||||
},
|
||||
namespace="token",
|
||||
)
|
||||
response = await ds.client.get(
|
||||
"/-/actor.json", headers={"Authorization": f"Bearer dstok_{token}"}
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert response.json()["actor"] == {
|
||||
"id": "root",
|
||||
"token": "dstok",
|
||||
"_r": {"a": ["debug-menu"]},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue