diff --git a/tests/app/utils/test_user.py b/tests/app/utils/test_user.py index 266eadfa3..d9811e71c 100644 --- a/tests/app/utils/test_user.py +++ b/tests/app/utils/test_user.py @@ -24,9 +24,10 @@ def _test_permissions( decorated_index() else: try: - if ( - decorated_index().location != '/sign-in?next=%2F' or - decorated_index().status_code != 302 + response = decorated_index() + if not ( + response.location.startswith('/sign-in?next=') and + response.status_code == 302 ): pytest.fail("Failed to throw a forbidden or unauthorised exception") except (Forbidden, Unauthorized):