mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
allow_sql block to control execute-sql upermission in metadata.json, closes #813
Also removed the --config allow_sql:0 mechanism in favour of the new allow_sql block.
This commit is contained in:
parent
e0a4664fba
commit
49d6d2f7b0
16 changed files with 92 additions and 44 deletions
|
|
@ -924,16 +924,8 @@ def test_allow_download_off():
|
|||
assert 403 == response.status
|
||||
|
||||
|
||||
def test_allow_sql_on(app_client):
|
||||
response = app_client.get("/fixtures")
|
||||
soup = Soup(response.body, "html.parser")
|
||||
assert len(soup.findAll("textarea", {"name": "sql"}))
|
||||
response = app_client.get("/fixtures/sortable")
|
||||
assert b"View and edit SQL" in response.body
|
||||
|
||||
|
||||
def test_allow_sql_off():
|
||||
with make_app_client(config={"allow_sql": False}) as client:
|
||||
with make_app_client(metadata={"allow_sql": {}}) as client:
|
||||
response = client.get("/fixtures")
|
||||
soup = Soup(response.body, "html.parser")
|
||||
assert not len(soup.findAll("textarea", {"name": "sql"}))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue