aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/tests/test_views.py3
-rw-r--r--app/views/error_pages.py4
2 files changed, 7 insertions, 0 deletions
diff --git a/app/tests/test_views.py b/app/tests/test_views.py
index da0d94b..f4ae4d8 100644
--- a/app/tests/test_views.py
+++ b/app/tests/test_views.py
@@ -59,6 +59,9 @@ def test_user_auth_flow(app, client):
assert res.status_code == 200
assert b"Hi John" in res.data
+ res = client.get("/admin/user/")
+ assert res.status_code == 403
+
res = client.get("/logout")
res = client.post("/signin",data=dict(
email="testtest@example.com",
diff --git a/app/views/error_pages.py b/app/views/error_pages.py
index 108e91e..5d995fc 100644
--- a/app/views/error_pages.py
+++ b/app/views/error_pages.py
@@ -5,6 +5,10 @@ from flask import render_template
def simulate_500():
return 500
+@app.errorhandler(403)
+def page_forbidden(e):
+ return render_template("message.html",code=403,message="Forbidden. You shall not pass"), 403
+
@app.errorhandler(404)
def page_not_found(e):
return render_template('message.html',code=404,message="Whoops! Page Not Found"), 404