Refactored alternate_url_json mechanism, refs #1620, #1533

This commit is contained in:
Simon Willison 2022-02-02 13:32:47 -08:00
commit 8d5779acf0
10 changed files with 27 additions and 62 deletions

View file

@ -875,12 +875,14 @@ def test_trace_correctly_escaped(app_client):
@pytest.mark.parametrize(
"path,expected",
(
# Instance index page
("/", "http://localhost/.json"),
# Table page
("/fixtures/facetable", "http://localhost/fixtures/facetable.json"),
(
"/fixtures/table%2Fwith%2Fslashes.csv",
"http://localhost/fixtures/table%2Fwith%2Fslashes.csv?_format=json",
),
("/fixtures/facetable", "http://localhost/fixtures/facetable.json"),
# Row page
(
"/fixtures/no_primary_key/1",
@ -901,6 +903,11 @@ def test_trace_correctly_escaped(app_client):
"/fixtures/neighborhood_search?text=town",
"http://localhost/fixtures/neighborhood_search.json?text=town",
),
# /-/ pages
(
"/-/plugins",
"http://localhost/-/plugins.json",
),
),
)
def test_alternate_url_json(app_client, path, expected):