mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-06 12:18:26 -04:00
Remove catching of exception that is never raised
View functions won’t raise an `Unauthorized` exception, they will return a redirect to the login page instead.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from flask import request
|
from flask import request
|
||||||
from werkzeug.exceptions import Forbidden, Unauthorized
|
from werkzeug.exceptions import Forbidden
|
||||||
|
|
||||||
from app.main.views.index import index
|
from app.main.views.index import index
|
||||||
from app.utils.user import user_has_permissions
|
from app.utils.user import user_has_permissions
|
||||||
@@ -30,7 +30,7 @@ def _test_permissions(
|
|||||||
response.status_code == 302
|
response.status_code == 302
|
||||||
):
|
):
|
||||||
pytest.fail("Failed to throw a forbidden or unauthorised exception")
|
pytest.fail("Failed to throw a forbidden or unauthorised exception")
|
||||||
except (Forbidden, Unauthorized):
|
except Forbidden:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user