Skip to content

Commit

Permalink
Confirm table actions work on views, closes #1067
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Oct 31, 2020
1 parent d6db47f commit b84cfe1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,20 +784,21 @@ def get_menu_links(html):
]


def test_hook_table_actions(app_client):
@pytest.mark.parametrize("table_or_view", ["facetable", "simple_view"])
def test_hook_table_actions(app_client, table_or_view):
def get_table_actions_links(html):
soup = Soup(html, "html.parser")
details = soup.find("details", {"class": "table-menu-links"})
if details is None:
return []
return [{"label": a.text, "href": a["href"]} for a in details.select("a")]

response = app_client.get("/fixtures/facetable")
response = app_client.get("/fixtures/{}".format(table_or_view))
assert get_table_actions_links(response.text) == []

response_2 = app_client.get("/fixtures/facetable?_bot=1")
response_2 = app_client.get("/fixtures/{}?_bot=1".format(table_or_view))
assert get_table_actions_links(response_2.text) == [
{"label": "From async", "href": "/"},
{"label": "Database: fixtures", "href": "/"},
{"label": "Table: facetable", "href": "/"},
{"label": "Table: {}".format(table_or_view), "href": "/"},
]

0 comments on commit b84cfe1

Please sign in to comment.