Skip to content

Commit

Permalink
Fix for tests - order was inconsistent, refs #852
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jun 18, 2020
1 parent 0807c42 commit b59b92b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
20 changes: 12 additions & 8 deletions tests/test_canned_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ def test_vary_header(canned_write_client):

def test_canned_query_permissions_on_database_page(canned_write_client):
# Without auth only shows three queries
query_names = [
query_names = {
q["name"] for q in canned_write_client.get("/data.json").json["queries"]
]
assert [
}
assert {
"add_name",
"add_name_specify_id",
"update_name",
"from_async_hook",
"from_hook",
] == query_names
} == query_names

# With auth shows four
response = canned_write_client.get(
Expand All @@ -129,12 +129,16 @@ def test_canned_query_permissions_on_database_page(canned_write_client):
{"name": "add_name", "private": False},
{"name": "add_name_specify_id", "private": False},
{"name": "delete_name", "private": True},
{"name": "update_name", "private": False},
{"name": "from_async_hook", "private": False},
{"name": "from_hook", "private": False},
] == [
{"name": q["name"], "private": q["private"]} for q in response.json["queries"]
]
{"name": "update_name", "private": False},
] == sorted(
[
{"name": q["name"], "private": q["private"]}
for q in response.json["queries"]
],
key=lambda q: q["name"],
)


def test_canned_query_permissions(canned_write_client):
Expand Down
8 changes: 5 additions & 3 deletions tests/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ def test_database_page(app_client):
"/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/pragma_cache_size", "pragma_cache_size"),
("/fixtures/neighborhood_search#fragment-goes-here", "Search neighborhoods"),
("/fixtures/from_async_hook", "from_async_hook"),
("/fixtures/from_hook", "from_hook"),
] == [(a["href"], a.text) for a in queries_ul.find_all("a")]
("/fixtures/neighborhood_search#fragment-goes-here", "Search neighborhoods"),
("/fixtures/pragma_cache_size", "pragma_cache_size"),
] == sorted(
[(a["href"], a.text) for a in queries_ul.find_all("a")], key=lambda p: p[0]
)


def test_invalid_custom_sql(app_client):
Expand Down

0 comments on commit b59b92b

Please sign in to comment.