Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/moin/apps/frontend/_tests/test_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ def _test_view(self, viewname, status='200 OK', data=('<html>', '</html>'), cont
assert rv.headers['Content-Type'] in content_types
if method == 'GET':
for item in data:
assert item in rv_data
if item == '<!doctype html': # TODO: remove workaround when Werkzeug >= 2.1.2 is set
assert item in str(rv_data).lower()
else:
assert item in rv_data
return rv

def _test_view_post(self, viewname, status='302 FOUND', content_types=('text/html; charset=utf-8', ), data=('<html>', '</html>'), form=None, viewopts=None):
Expand Down Expand Up @@ -175,7 +178,7 @@ def test_orphaned_items(self):
self._test_view('frontend.orphaned_items')

def test_quicklink_item(self):
self._test_view('frontend.quicklink_item', status='302 FOUND', viewopts=dict(item_name='DoesntExist'), data=['<!DOCTYPE HTML'])
self._test_view('frontend.quicklink_item', status='302 FOUND', viewopts=dict(item_name='DoesntExist'), data=['<!doctype html'])

def test_subscribe_item(self):
self._test_view('frontend.subscribe_item', status='404 NOT FOUND', viewopts=dict(item_name='DoesntExist'))
Expand All @@ -184,7 +187,7 @@ def test_register(self):
self._test_view('frontend.register')

def test_verifyemail(self):
self._test_view('frontend.verifyemail', status='302 FOUND', data=['<!DOCTYPE HTML'])
self._test_view('frontend.verifyemail', status='302 FOUND', data=['<!doctype html'])

def test_lostpass(self):
self._test_view('frontend.lostpass')
Expand All @@ -196,16 +199,16 @@ def test_login(self):
self._test_view('frontend.login')

def test_logout(self):
self._test_view('frontend.logout', status='302 FOUND', data=['<!DOCTYPE HTML'])
self._test_view('frontend.logout', status='302 FOUND', data=['<!doctype html'])

def test_usersettings_notloggedin(self):
# if a anon user visits usersettings view, he'll get redirected to the login view
self._test_view('frontend.usersettings', status='302 FOUND', data=['<!DOCTYPE HTML'])
self._test_view('frontend.usersettings', status='302 FOUND', data=['<!doctype html'])

# TODO: implement test_usersettings_loggedin()

def test_bookmark(self):
self._test_view('frontend.bookmark', status='302 FOUND', data=['<!DOCTYPE HTML'])
self._test_view('frontend.bookmark', status='302 FOUND', data=['<!doctype html'])

def test_diffraw(self):
# TODO another test with valid rev1 and rev2 url args and an existing item is needed
Expand Down
3 changes: 2 additions & 1 deletion src/moin/apps/serve/_tests/test_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ def test_files(self, app):
rv = c.get(url_for('serve.files', name="DoesntExist"))
assert rv.status == '404 NOT FOUND'
assert rv.headers['Content-Type'] == 'text/html; charset=utf-8'
assert b'<!DOCTYPE HTML' in rv.data
# TODO: remove workaround when Werkzeug >= 2.1.2 is set (PR 1325)
assert '<!doctype html' in str(rv.data).lower()