add error handler pages for 400, 404, 500
This commit is contained in:
@@ -10,15 +10,24 @@ def test_page_that_exists(client):
|
||||
|
||||
|
||||
def test_page_that_doesnt_exist(client):
|
||||
"""Test that the app returns 404 for nonsense requests."""
|
||||
"""Test that the app returns 404 for nonsense requests and they use my error page."""
|
||||
response = client.get('/ohuesthaoeusth')
|
||||
assert response.status_code == 404
|
||||
assert b'<b><tt>/ohuesthaoeusth</tt></b> does not seem to exist' in response.data
|
||||
|
||||
|
||||
def test_files_outside_pages_do_not_get_served(client):
|
||||
"""Test that page pathing doesn't break out of the instance/pages/ dir."""
|
||||
"""Test that page pathing doesn't break out of the instance/pages/ dir, and the error uses my error page."""
|
||||
response = client.get('/../unreachable')
|
||||
assert response.status_code == 400
|
||||
assert b'You\'re doing something you\'re not supposed to. Stop it?' in response.data
|
||||
|
||||
|
||||
def test_internal_server_error_serves_error_page(client):
|
||||
"""Test that various exceptions serve up the 500 page."""
|
||||
response = client.get('/actually-a-png')
|
||||
assert response.status_code == 500
|
||||
assert b'INTERNAL SERVER ERROR' in response.data
|
||||
|
||||
|
||||
def test_weird_paths_do_not_get_served(client):
|
||||
|
||||
BIN
tests/instance/pages/actually-a-png.md
Normal file
BIN
tests/instance/pages/actually-a-png.md
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
Reference in New Issue
Block a user