mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Also improved API explorer to show HTTP status of response, refs #1871
This commit is contained in:
parent
9bec7c38eb
commit
497290beaf
3 changed files with 24 additions and 6 deletions
|
|
@ -156,6 +156,13 @@ async def test_write_rows(ds_write, return_rows):
|
|||
400,
|
||||
["Too many rows, maximum allowed is 100"],
|
||||
),
|
||||
(
|
||||
"/data/docs/-/insert",
|
||||
{"rows": [{"id": 1, "title": "Test"}]},
|
||||
"duplicate_id",
|
||||
400,
|
||||
["UNIQUE constraint failed: docs.id"],
|
||||
),
|
||||
(
|
||||
"/data/docs/-/insert",
|
||||
{"rows": [{"title": "Test"}], "ignore": True, "replace": True},
|
||||
|
|
@ -194,6 +201,10 @@ async def test_write_row_errors(
|
|||
ds_write, path, input, special_case, expected_status, expected_errors
|
||||
):
|
||||
token = write_token(ds_write)
|
||||
if special_case == "duplicate_id":
|
||||
await ds_write.get_database("data").execute_write(
|
||||
"insert into docs (id) values (1)"
|
||||
)
|
||||
if special_case == "bad_token":
|
||||
token += "bad"
|
||||
kwargs = dict(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue