Row count fix + sort index page databases alphabetically

Sorting alphabetically should fix a test failure in Python 3.5

Refs #460
This commit is contained in:
Simon Willison 2019-05-15 17:40:10 -07:00
commit 79303163b2
2 changed files with 9 additions and 6 deletions

View file

@ -25,15 +25,15 @@ 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": "/fixtures", "text": "fixtures"},
] == [{"href": a["href"], "text": a.text.strip()} for a in soup.select("h2 a")]
# The second attached database should show count text and attached tables
h2 = soup.select("h2")[1]
# The first attached database should show count text and attached tables
h2 = soup.select("h2")[0]
assert "extra_database" == h2.text.strip()
counts_p, links_p = h2.find_all_next("p")
counts_p, links_p = h2.find_all_next("p")[:2]
assert (
"7 rows in 1 table, 5 rows in 4 hidden tables, 1 view" == counts_p.text.strip()
"2 rows in 1 table, 5 rows in 4 hidden tables, 1 view" == counts_p.text.strip()
)
# We should only show visible, not hidden tables here:
table_links = [