mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Canned query writes support JSON POST body, refs #880
This commit is contained in:
parent
1552ac931e
commit
896fce228f
3 changed files with 31 additions and 5 deletions
|
|
@ -1,4 +1,5 @@
|
|||
from bs4 import BeautifulSoup as Soup
|
||||
import json
|
||||
import pytest
|
||||
import re
|
||||
from .fixtures import make_app_client, app_client
|
||||
|
|
@ -163,6 +164,16 @@ def test_vary_header(canned_write_client):
|
|||
assert "Cookie" == canned_write_client.get("/data/update_name").headers["vary"]
|
||||
|
||||
|
||||
def test_json_post_body(canned_write_client):
|
||||
response = canned_write_client.post(
|
||||
"/data/add_name",
|
||||
body=json.dumps({"name": "Hello"}),
|
||||
allow_redirects=False,
|
||||
)
|
||||
assert 302 == response.status
|
||||
assert "/data/add_name?success" == response.headers["Location"]
|
||||
|
||||
|
||||
def test_canned_query_permissions_on_database_page(canned_write_client):
|
||||
# Without auth only shows three queries
|
||||
query_names = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue