mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
New URL design /db/table/-/insert, refs #1851
This commit is contained in:
parent
a2a5dff709
commit
6e788b49ed
4 changed files with 86 additions and 13 deletions
|
|
@ -24,8 +24,8 @@ async def test_write_row(ds_write):
|
|||
)
|
||||
)
|
||||
response = await ds_write.client.post(
|
||||
"/data/docs",
|
||||
json={"insert": {"title": "Test", "score": 1.0}},
|
||||
"/data/docs/-/insert",
|
||||
json={"row": {"title": "Test", "score": 1.0}},
|
||||
headers={
|
||||
"Authorization": "Bearer {}".format(token),
|
||||
"Content-Type": "application/json",
|
||||
|
|
@ -33,6 +33,6 @@ async def test_write_row(ds_write):
|
|||
)
|
||||
expected_row = {"id": 1, "title": "Test", "score": 1.0}
|
||||
assert response.status_code == 201
|
||||
assert response.json()["inserted_row"] == expected_row
|
||||
assert response.json()["inserted"] == [expected_row]
|
||||
rows = (await ds_write.get_database("data").execute("select * from docs")).rows
|
||||
assert dict(rows[0]) == expected_row
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue