mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-08 06:28:25 -04:00
Merge pull request #1136 from alphagov/sign-in-message
Show a more useful message if you get signed out
This commit is contained in:
@@ -75,10 +75,13 @@ def test_if_existing_user_accepts_twice_they_redirect_to_sign_in(
|
||||
response = client.get(url_for('main.accept_invite', token='thisisnotarealtoken'), follow_redirects=True)
|
||||
assert response.status_code == 200
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
assert page.h1.string.strip() == 'Sign in'
|
||||
flash_banners = page.find_all('div', class_='banner-default')
|
||||
assert len(flash_banners) == 1
|
||||
assert flash_banners[0].text.strip() == 'Please log in to access this page.'
|
||||
assert (
|
||||
page.h1.string,
|
||||
page.select('main p')[0].text.strip(),
|
||||
) == (
|
||||
'You need to sign in again',
|
||||
'We sign you out if you haven’t used Notify for a while.',
|
||||
)
|
||||
|
||||
|
||||
def test_existing_user_of_service_get_redirected_to_signin(
|
||||
@@ -98,10 +101,13 @@ def test_existing_user_of_service_get_redirected_to_signin(
|
||||
response = client.get(url_for('main.accept_invite', token='thisisnotarealtoken'), follow_redirects=True)
|
||||
assert response.status_code == 200
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
assert page.h1.string.strip() == 'Sign in'
|
||||
flash_banners = page.find_all('div', class_='banner-default')
|
||||
assert len(flash_banners) == 1
|
||||
assert flash_banners[0].text.strip() == 'Please log in to access this page.'
|
||||
assert (
|
||||
page.h1.string,
|
||||
page.select('main p')[0].text.strip(),
|
||||
) == (
|
||||
'You need to sign in again',
|
||||
'We sign you out if you haven’t used Notify for a while.',
|
||||
)
|
||||
assert mock_accept_invite.call_count == 1
|
||||
|
||||
|
||||
@@ -130,10 +136,13 @@ def test_existing_signed_out_user_accept_invite_redirects_to_sign_in(
|
||||
|
||||
assert response.status_code == 200
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
assert page.h1.string.strip() == 'Sign in'
|
||||
flash_banners = page.find_all('div', class_='banner-default')
|
||||
assert len(flash_banners) == 1
|
||||
assert flash_banners[0].text.strip() == 'Please log in to access this page.'
|
||||
assert (
|
||||
page.h1.string,
|
||||
page.select('main p')[0].text.strip(),
|
||||
) == (
|
||||
'You need to sign in again',
|
||||
'We sign you out if you haven’t used Notify for a while.',
|
||||
)
|
||||
|
||||
|
||||
def test_new_user_accept_invite_calls_api_and_redirects_to_registration(
|
||||
|
||||
@@ -15,7 +15,7 @@ def test_should_redirect_if_not_logged_in(
|
||||
):
|
||||
response = client.get(url_for('main.platform_admin'))
|
||||
assert response.status_code == 302
|
||||
assert url_for('main.index', _external=True) in response.location
|
||||
assert response.location == url_for('main.sign_in', next=url_for('main.platform_admin'), _external=True)
|
||||
|
||||
|
||||
def test_should_403_if_not_platform_admin(
|
||||
|
||||
Reference in New Issue
Block a user