Fixed bug loading database called 'test-database (1).sqlite'

Closes #1181.

Also now ensures that database URLs have special characters URL-quoted.
This commit is contained in:
Simon Willison 2021-01-24 21:13:05 -08:00
commit a5ede3cdd4
7 changed files with 55 additions and 27 deletions

View file

@ -30,7 +30,7 @@ def test_homepage(app_client_two_attached_databases):
# Should be two attached databases
assert [
{"href": "/fixtures", "text": "fixtures"},
{"href": "/extra database", "text": "extra database"},
{"href": r"/extra%20database", "text": "extra database"},
] == [{"href": a["href"], "text": a.text.strip()} for a in soup.select("h2 a")]
# The first attached database should show count text and attached tables
h2 = soup.select("h2")[1]
@ -44,8 +44,8 @@ def test_homepage(app_client_two_attached_databases):
{"href": a["href"], "text": a.text.strip()} for a in links_p.findAll("a")
]
assert [
{"href": "/extra database/searchable", "text": "searchable"},
{"href": "/extra database/searchable_view", "text": "searchable_view"},
{"href": r"/extra%20database/searchable", "text": "searchable"},
{"href": r"/extra%20database/searchable_view", "text": "searchable_view"},
] == table_links