mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
allow_sql config option to disable custom SQL, closes #284
This commit is contained in:
parent
50920cfe3d
commit
f722b0a730
7 changed files with 53 additions and 7 deletions
|
|
@ -495,6 +495,27 @@ def test_allow_download_off():
|
|||
assert 403 == response.status
|
||||
|
||||
|
||||
def test_allow_sql_on(app_client):
|
||||
response = app_client.get(
|
||||
"/test_tables",
|
||||
gather_request=False
|
||||
)
|
||||
soup = Soup(response.body, 'html.parser')
|
||||
assert len(soup.findAll('textarea', {'name': 'sql'}))
|
||||
|
||||
|
||||
def test_allow_sql_off():
|
||||
for client in app_client(config={
|
||||
'allow_sql': False,
|
||||
}):
|
||||
response = client.get(
|
||||
"/test_tables",
|
||||
gather_request=False
|
||||
)
|
||||
soup = Soup(response.body, 'html.parser')
|
||||
assert not len(soup.findAll('textarea', {'name': 'sql'}))
|
||||
|
||||
|
||||
def assert_querystring_equal(expected, actual):
|
||||
assert sorted(expected.split('&')) == sorted(actual.split('&'))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue