Address PrefixedUrlString bug in #1075

This commit is contained in:
Simon Willison 2020-10-31 13:35:47 -07:00
commit a4ca26a265
6 changed files with 16 additions and 2 deletions

View file

@ -274,6 +274,7 @@ METADATA = {
"source_url": "https://github.com/simonw/datasette/blob/master/tests/fixtures.py",
"about": "About Datasette",
"about_url": "https://github.com/simonw/datasette",
"extra_css_urls": ["/static/extra-css-urls.css"],
"plugins": {
"name-of-plugin": {"depth": "root"},
"env-plugin": {"foo": {"$env": "FOO_ENV"}},

View file

@ -1852,6 +1852,7 @@ def test_paginate_using_link_header(app_client, qs):
num_pages = 0
while path:
response = app_client.get(path)
assert response.status == 200
num_pages += 1
link = response.headers.get("link")
if link:

View file

@ -61,6 +61,7 @@ def test_serve_with_get_exit_code_for_error(tmp_path_factory):
"--get",
"/this-is-404",
],
catch_exceptions=False,
)
assert result.exit_code == 1
assert "404" in result.output

View file

@ -1466,6 +1466,11 @@ def test_base_url_config(app_client_base_url_prefix, path):
}
def test_base_url_affects_metadata_extra_css_urls(app_client_base_url_prefix):
html = app_client_base_url_prefix.get("/").text
assert '<link rel="stylesheet" href="/prefix/static/extra-css-urls.css">' in html
@pytest.mark.parametrize(
"path,expected",
[