mirror of
https://github.com/simonw/datasette.git
synced 2026-10-07 18:06:59 +02:00
Merge branch 'main' into queries
This commit is contained in:
commit
6033bf8e40
5 changed files with 50 additions and 24 deletions
|
|
@ -382,8 +382,8 @@ def view_actions(datasette, database, view, actor):
|
|||
|
||||
@hookimpl
|
||||
def query_actions(datasette, database, query_name, sql):
|
||||
# Don't explain an explain
|
||||
if sql.lower().startswith("explain"):
|
||||
# Don't explain an explain (or a missing query)
|
||||
if not sql or sql.lower().startswith("explain"):
|
||||
return
|
||||
return [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -239,6 +239,22 @@ def test_query_page_truncates():
|
|||
]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_query_page_with_no_sql(ds_client):
|
||||
# https://github.com/simonw/datasette/issues/2743
|
||||
response = await ds_client.get("/fixtures/-/query")
|
||||
assert response.status_code == 200
|
||||
assert '<textarea id="sql-editor" name="sql"' in response.text
|
||||
assert 'class="rows-and-columns"' not in response.text
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_query_csv_with_no_sql_is_400(ds_client):
|
||||
# https://github.com/simonw/datasette/issues/2743
|
||||
response = await ds_client.get("/fixtures/-/query.csv")
|
||||
assert response.status_code == 400
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize(
|
||||
"path,expected_classes",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue