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 <jth@kernel.org>
pull/18/head
Johannes Thumshirn 4 years ago
parent 376efe2d3a
commit 69408017ce

@ -7,17 +7,14 @@ import sys
import pytest import pytest
import pytest_cov.embed import pytest_cov.embed
def test_static_pages(): def test_static_pages(app, client):
for f in os.listdir('templates'): for f in os.listdir('templates'):
if f == "template.html" or f == "page.html": if f == "template.html" or f == "page.html":
continue continue
static_file = f.split('.',1)[0] static_file = f.split('.',1)[0]
page = "/" + static_file + ".html"
print("Checking presence of method: ", static_file) print("Checking presence of: ", page)
try: res = client.get(page)
method = getattr(app, static_file) assert res.status_code == 200
assert True
except NotImplementedError:
assert False

Loading…
Cancel
Save