mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Dash encoding is now tilde encoding, refs #1657
Still a ton of broken tests though
This commit is contained in:
parent
fd5df04d30
commit
47151c23b4
12 changed files with 84 additions and 140 deletions
|
|
@ -229,7 +229,7 @@ def test_row_page_does_not_truncate():
|
|||
["query", "db-fixtures", "query-neighborhood_search"],
|
||||
),
|
||||
(
|
||||
"/fixtures/table%2Fwith%2Fslashes.csv",
|
||||
"/fixtures/table-2Fwith-2Fslashes-2Ecsv",
|
||||
["table", "db-fixtures", "table-tablewithslashescsv-fa7563"],
|
||||
),
|
||||
(
|
||||
|
|
@ -255,7 +255,7 @@ def test_css_classes_on_body(app_client, path, expected_classes):
|
|||
"table-fixtures-simple_primary_key.html, *table.html",
|
||||
),
|
||||
(
|
||||
"/fixtures/table%2Fwith%2Fslashes.csv",
|
||||
"/fixtures/table-2Fwith-2Fslashes-2Ecsv",
|
||||
"table-fixtures-tablewithslashescsv-fa7563.html, *table.html",
|
||||
),
|
||||
(
|
||||
|
|
@ -816,7 +816,8 @@ def test_base_url_affects_metadata_extra_css_urls(app_client_base_url_prefix):
|
|||
),
|
||||
("/fixtures/pragma_cache_size", None),
|
||||
(
|
||||
"/fixtures/𝐜𝐢𝐭𝐢𝐞𝐬",
|
||||
# /fixtures/𝐜𝐢𝐭𝐢𝐞𝐬
|
||||
"/fixtures/-F0-9D-90-9C-F0-9D-90-A2-F0-9D-90-AD-F0-9D-90-A2-F0-9D-90-9E-F0-9D-90-AC",
|
||||
"/fixtures?sql=select+id%2C+name+from+facet_cities+order+by+id+limit+1%3B",
|
||||
),
|
||||
("/fixtures/magic_parameters", None),
|
||||
|
|
@ -824,6 +825,7 @@ def test_base_url_affects_metadata_extra_css_urls(app_client_base_url_prefix):
|
|||
)
|
||||
def test_edit_sql_link_on_canned_queries(app_client, path, expected):
|
||||
response = app_client.get(path)
|
||||
assert response.status == 200
|
||||
expected_link = f'<a href="{expected}" class="canned-query-edit-sql">Edit SQL</a>'
|
||||
if expected:
|
||||
assert expected_link in response.text
|
||||
|
|
@ -898,8 +900,8 @@ def test_trace_correctly_escaped(app_client):
|
|||
# Table page
|
||||
("/fixtures/facetable", "http://localhost/fixtures/facetable.json"),
|
||||
(
|
||||
"/fixtures/table%2Fwith%2Fslashes.csv",
|
||||
"http://localhost/fixtures/table%2Fwith%2Fslashes.csv?_format=json",
|
||||
"/fixtures/table-2Fwith-2Fslashes-2Ecsv",
|
||||
"http://localhost/fixtures/table-2Fwith-2Fslashes-2Ecsv.json",
|
||||
),
|
||||
# Row page
|
||||
(
|
||||
|
|
@ -959,17 +961,17 @@ def test_no_alternate_url_json(app_client, path):
|
|||
(
|
||||
(
|
||||
"/fivethirtyeight/twitter-ratio%2Fsenators",
|
||||
"/fivethirtyeight/twitter-2Dratio-2Fsenators",
|
||||
"/fivethirtyeight/twitter-ratio~2Fsenators",
|
||||
),
|
||||
(
|
||||
"/fixtures/table%2Fwith%2Fslashes",
|
||||
"/fixtures/table-2Fwith-2Fslashes",
|
||||
"/fixtures/table%2Fwith%2Fslashes.csv",
|
||||
"/fixtures/table~2Fwith~2Fslashes~2Ecsv",
|
||||
),
|
||||
# query string should be preserved
|
||||
("/foo/bar%2Fbaz?id=5", "/foo/bar-2Fbaz?id=5"),
|
||||
("/foo/bar%2Fbaz?id=5", "/foo/bar~2Fbaz?id=5"),
|
||||
),
|
||||
)
|
||||
def test_redirect_percent_encoding_to_dash_encoding(app_client, path, expected):
|
||||
def test_redirect_percent_encoding_to_tilde_encoding(app_client, path, expected):
|
||||
response = app_client.get(path)
|
||||
assert response.status == 302
|
||||
assert response.headers["location"] == expected
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue