mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Move queries to top of database page, refs #1612
This commit is contained in:
parent
d194db4204
commit
68cc1e2dbb
2 changed files with 39 additions and 15 deletions
|
|
@ -110,12 +110,32 @@ def test_database_page_redirects_with_url_hash(app_client_with_hash):
|
|||
|
||||
def test_database_page(app_client):
|
||||
response = app_client.get("/fixtures")
|
||||
assert (
|
||||
b"<p><em>pk, foreign_key_with_label, foreign_key_with_blank_label, "
|
||||
b"foreign_key_with_no_label, foreign_key_compound_pk1, "
|
||||
b"foreign_key_compound_pk2</em></p>"
|
||||
) in response.body
|
||||
soup = Soup(response.body, "html.parser")
|
||||
# Should have a <textarea> for executing SQL
|
||||
assert "<textarea" in response.text
|
||||
|
||||
# And a list of tables
|
||||
for fragment in (
|
||||
'<h2 id="tables">Tables</h2>',
|
||||
'<h3><a href="/fixtures/sortable">sortable</a></h3>',
|
||||
"<p><em>pk, foreign_key_with_label, foreign_key_with_blank_label, ",
|
||||
):
|
||||
assert fragment in response.text
|
||||
|
||||
# And views
|
||||
views_ul = soup.find("h2", text="Views").find_next_sibling("ul")
|
||||
assert views_ul is not None
|
||||
assert [
|
||||
("/fixtures/paginated_view", "paginated_view"),
|
||||
("/fixtures/searchable_view", "searchable_view"),
|
||||
(
|
||||
"/fixtures/searchable_view_configured_by_metadata",
|
||||
"searchable_view_configured_by_metadata",
|
||||
),
|
||||
("/fixtures/simple_view", "simple_view"),
|
||||
] == sorted([(a["href"], a.text) for a in views_ul.find_all("a")])
|
||||
|
||||
# And a list of canned queries
|
||||
queries_ul = soup.find("h2", text="Queries").find_next_sibling("ul")
|
||||
assert queries_ul is not None
|
||||
assert [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue