mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
unauthenticated: true method plus allow block docs, closes #825
This commit is contained in:
parent
70dd14876e
commit
7633b9ab24
6 changed files with 134 additions and 55 deletions
|
|
@ -1,5 +1,4 @@
|
|||
from .fixtures import app_client
|
||||
from bs4 import BeautifulSoup as Soup
|
||||
|
||||
|
||||
def test_auth_token(app_client):
|
||||
|
|
@ -20,26 +19,3 @@ def test_actor_cookie(app_client):
|
|||
cookie = app_client.ds.sign({"id": "test"}, "actor")
|
||||
response = app_client.get("/", cookies={"ds_actor": cookie})
|
||||
assert {"id": "test"} == app_client.ds._last_request.scope["actor"]
|
||||
|
||||
|
||||
def test_permissions_debug(app_client):
|
||||
app_client.ds._permission_checks.clear()
|
||||
assert 403 == app_client.get("/-/permissions").status
|
||||
# With the cookie it should work
|
||||
cookie = app_client.ds.sign({"id": "root"}, "actor")
|
||||
response = app_client.get("/-/permissions", cookies={"ds_actor": cookie})
|
||||
# Should show one failure and one success
|
||||
soup = Soup(response.body, "html.parser")
|
||||
check_divs = soup.findAll("div", {"class": "check"})
|
||||
checks = [
|
||||
{
|
||||
"action": div.select_one(".check-action").text,
|
||||
"result": bool(div.select(".check-result-true")),
|
||||
"used_default": bool(div.select(".check-used-default")),
|
||||
}
|
||||
for div in check_divs
|
||||
]
|
||||
assert [
|
||||
{"action": "permissions-debug", "result": True, "used_default": False},
|
||||
{"action": "permissions-debug", "result": False, "used_default": True},
|
||||
] == checks
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue