mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-06 18:08:25 -04:00
Ensure users are authenticated for most pages (#586)
* Ensure users are authenticated for most pages This changeset makes sure that users must be authenticated and logged in to view most pages of the Notify service. We are moving to a model where only the home page and a select few others will be publicly accessible for the time being. Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
This commit is contained in:
@@ -71,7 +71,6 @@ def test_robots(client_request):
|
||||
('bat_phone', {}),
|
||||
('thanks', {}),
|
||||
('register', {}),
|
||||
('features_email', {}),
|
||||
pytest.param('index', {}, marks=pytest.mark.xfail(raises=AssertionError)),
|
||||
))
|
||||
@freeze_time('2012-12-12 12:12') # So we don’t go out of business hours
|
||||
@@ -116,12 +115,17 @@ def test_static_pages(
|
||||
session['service_id'] = None
|
||||
request()
|
||||
|
||||
# Check it still works when they sign out
|
||||
# Check it redirects to the login screen when they sign out
|
||||
client_request.logout()
|
||||
with client_request.session_transaction() as session:
|
||||
session['service_id'] = None
|
||||
session['user_id'] = None
|
||||
request()
|
||||
request(
|
||||
_expected_status=302,
|
||||
_expected_redirect='/sign-in?next={}'.format(
|
||||
url_for('main.{}'.format(view))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def test_guidance_pages_link_to_service_pages_when_signed_in(
|
||||
@@ -143,12 +147,12 @@ def test_guidance_pages_link_to_service_pages_when_signed_in(
|
||||
page = request()
|
||||
assert not page.select_one(selector)
|
||||
|
||||
# Check it still works when they sign out
|
||||
# Check it redirects to the login screen when they sign out
|
||||
client_request.logout()
|
||||
with client_request.session_transaction() as session:
|
||||
session['service_id'] = None
|
||||
session['user_id'] = None
|
||||
page = request()
|
||||
page = request(_expected_status=302)
|
||||
assert not page.select_one(selector)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user