follow sign_in redirect even if you're already signed in

This commit is contained in:
Leo Hemsted
2021-07-14 23:10:49 +01:00
parent 4ead26c806
commit 71d3aa13d7
3 changed files with 29 additions and 4 deletions

View File

@@ -105,6 +105,28 @@ def test_logged_in_user_redirects_to_account(
)
def test_logged_in_user_redirects_to_next_url(
client_request
):
client_request.get(
'main.sign_in',
next='/user-profile',
_expected_status=302,
_expected_redirect=url_for('main.user_profile', _external=True),
)
def test_logged_in_user_doesnt_do_evil_redirect(
client_request
):
client_request.get(
'main.sign_in',
next='http://www.evil.com',
_expected_status=302,
_expected_redirect=url_for('main.show_accounts_or_dashboard', _external=True),
)
@pytest.mark.parametrize('redirect_url', [
None,
f'/services/{SERVICE_ONE_ID}/templates',