mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
/-/allow-debug tool, closes #908
This commit is contained in:
parent
6be5654ffa
commit
12c0bc09cc
5 changed files with 125 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ from .fixtures import app_client, assert_permissions_checked, make_app_client
|
|||
from bs4 import BeautifulSoup as Soup
|
||||
import copy
|
||||
import pytest
|
||||
import urllib
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
@ -312,6 +313,23 @@ def test_permissions_debug(app_client):
|
|||
] == checks
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"actor,allow,expected_fragment",
|
||||
[
|
||||
('{"id":"root"}', "{}", "Result: deny"),
|
||||
('{"id":"root"}', '{"id": "*"}', "Result: allow"),
|
||||
('{"', '{"id": "*"}', "Actor JSON error"),
|
||||
('{"id":"root"}', '"*"}', "Allow JSON error"),
|
||||
],
|
||||
)
|
||||
def test_allow_debug(app_client, actor, allow, expected_fragment):
|
||||
response = app_client.get(
|
||||
"/-/allow-debug?" + urllib.parse.urlencode({"actor": actor, "allow": allow})
|
||||
)
|
||||
assert 200 == response.status
|
||||
assert expected_fragment in response.text
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"allow,expected",
|
||||
[({"id": "root"}, 403), ({"id": "root", "unauthenticated": True}, 200),],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue