mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Default to _labels=on on JSON/CSV links with foreign keys, refs #266
This commit is contained in:
parent
6a32684ebb
commit
0d7ba1ba67
3 changed files with 34 additions and 11 deletions
|
|
@ -289,6 +289,21 @@ def test_table_csv_json_export_links(app_client):
|
|||
assert expected == actual
|
||||
|
||||
|
||||
def test_csv_json_export_links_include_labels_if_foreign_keys(app_client):
|
||||
response = app_client.get('/fixtures/facetable')
|
||||
assert response.status == 200
|
||||
links = Soup(response.body, "html.parser").find("p", {
|
||||
"class": "export-links"
|
||||
}).findAll("a")
|
||||
actual = [l["href"].split("/")[-1] for l in links]
|
||||
expected = [
|
||||
"facetable.json?_labels=on",
|
||||
"facetable.csv?_labels=on&_size=max",
|
||||
"facetable.csv?_dl=1&_labels=on&_size=max"
|
||||
]
|
||||
assert expected == actual
|
||||
|
||||
|
||||
def test_row_html_simple_primary_key(app_client):
|
||||
response = app_client.get('/fixtures/simple_primary_key/1')
|
||||
assert response.status == 200
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue