Fix for TableNotFound, refs #2359

This commit is contained in:
Simon Willison 2024-06-21 16:09:20 -07:00
commit 7316dd4ac6
5 changed files with 10 additions and 12 deletions

View file

@ -140,7 +140,7 @@ async def test_insert_rows(ds_write, return_rows):
{},
None,
404,
["Table not found: docs2"],
["Table not found"],
),
(
"/data/docs/-/insert",
@ -274,7 +274,7 @@ async def test_insert_rows(ds_write, return_rows):
{"rows": [{"title": "Test"}]},
None,
404,
["Table not found: badtable"],
["Table not found"],
),
# missing primary key
(
@ -598,7 +598,7 @@ async def test_delete_row_errors(ds_write, scenario):
assert (
response.json()["errors"] == ["Permission denied"]
if scenario == "no_token"
else ["Table not found: bad_table"]
else ["Table not found"]
)
assert len((await ds_write.client.get("/data/docs.json?_shape=array")).json()) == 1
@ -703,7 +703,7 @@ async def test_update_row_check_permission(ds_write, scenario):
assert (
response.json()["errors"] == ["Permission denied"]
if scenario == "no_token"
else ["Table not found: bad_table"]
else ["Table not found"]
)
@ -830,7 +830,7 @@ async def test_drop_table(ds_write, scenario):
assert response.json()["ok"] is False
expected_error = "Permission denied"
if scenario == "bad_table":
expected_error = "Table not found: bad_table"
expected_error = "Table not found"
elif scenario == "immutable":
expected_error = "Database is immutable"
assert response.json()["errors"] == [expected_error]

View file

@ -36,7 +36,7 @@ async def test_table_json(ds_client):
async def test_table_not_exists_json(ds_client):
assert (await ds_client.get("/fixtures/blah.json")).json() == {
"ok": False,
"error": "Table not found: blah",
"error": "Table not found",
"status": 404,
"title": None,
}

View file

@ -535,7 +535,7 @@ async def test_csv_json_export_links_include_labels_if_foreign_keys(ds_client):
@pytest.mark.asyncio
async def test_table_not_exists(ds_client):
assert "Table not found: blah" in (await ds_client.get("/fixtures/blah")).text
assert "Table not found" in (await ds_client.get("/fixtures/blah")).text
@pytest.mark.asyncio