Unit test for _table custom template, refs #521

This commit is contained in:
Simon Willison 2019-07-02 20:06:22 -07:00
commit 13e4f9a676
3 changed files with 18 additions and 0 deletions

View file

@ -964,3 +964,16 @@ def test_metadata_json_html(app_client):
assert response.status == 200
pre = Soup(response.body, "html.parser").find("pre")
assert METADATA == json.loads(pre.text)
def test_custom_table_include():
for client in make_app_client(
template_dir=str(pathlib.Path(__file__).parent / "test_templates")
):
response = client.get("/fixtures/complex_foreign_keys")
assert response.status == 200
assert (
'<div class="custom-table-row">'
'1 - 2 - <a href="/fixtures/simple_primary_key/1">hello</a> <em>1</em>'
"</div>"
) == str(Soup(response.text, "html.parser").select_one("div.custom-table-row"))