From 69408017cebf5a90d08eec27e0c57ca8860a9f19 Mon Sep 17 00:00:00 2001 From: Johannes Thumshirn Date: Mon, 8 Mar 2021 14:59:25 +0100 Subject: [PATCH] tests: test static page routing Instead of checking for the presence of methods, check if the web application correctly sets up the routing for the static pages. Signed-off-by: Johannes Thumshirn --- tests/test_static_pages.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/test_static_pages.py b/tests/test_static_pages.py index f5b59b2..8ecab49 100644 --- a/tests/test_static_pages.py +++ b/tests/test_static_pages.py @@ -7,17 +7,14 @@ import sys import pytest import pytest_cov.embed -def test_static_pages(): +def test_static_pages(app, client): for f in os.listdir('templates'): if f == "template.html" or f == "page.html": continue static_file = f.split('.',1)[0] - - print("Checking presence of method: ", static_file) - try: - method = getattr(app, static_file) - assert True - except NotImplementedError: - assert False + page = "/" + static_file + ".html" + print("Checking presence of: ", page) + res = client.get(page) + assert res.status_code == 200