mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
parent
e981ac7d4d
commit
0cfd7ce59d
3 changed files with 18 additions and 6 deletions
|
|
@ -181,14 +181,14 @@ def test_invalid_custom_sql(app_client):
|
|||
gather_request=False
|
||||
)
|
||||
assert response.status == 400
|
||||
assert 'Statement must begin with SELECT' in response.text
|
||||
assert 'Statement must be a SELECT' in response.text
|
||||
response = app_client.get(
|
||||
'/test_tables.json?sql=.schema',
|
||||
gather_request=False
|
||||
)
|
||||
assert response.status == 400
|
||||
assert response.json['ok'] is False
|
||||
assert 'Statement must begin with SELECT' == response.json['error']
|
||||
assert 'Statement must be a SELECT' == response.json['error']
|
||||
|
||||
|
||||
def test_table_page(app_client):
|
||||
|
|
|
|||
|
|
@ -123,6 +123,8 @@ def test_validate_sql_select_bad(bad_sql):
|
|||
'select count(*) from airports',
|
||||
'select foo from bar',
|
||||
'select 1 + 1',
|
||||
'SELECT\nblah FROM foo',
|
||||
'WITH RECURSIVE cnt(x) AS (SELECT 1 UNION ALL SELECT x+1 FROM cnt LIMIT 10) SELECT x FROM cnt;'
|
||||
])
|
||||
def test_validate_sql_select_good(good_sql):
|
||||
utils.validate_sql_select(good_sql)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue