diff --git a/app/main/views/sign_in.py b/app/main/views/sign_in.py index fc8e9b049..eb77ad7a7 100644 --- a/app/main/views/sign_in.py +++ b/app/main/views/sign_in.py @@ -30,8 +30,6 @@ def sign_in(): return redirect(url_for('main.choose_service')) form = LoginForm() - if form.email_address.data: - form.email_address.data = form.email_address.data.strip() if form.validate_on_submit(): diff --git a/tests/app/main/views/test_register.py b/tests/app/main/views/test_register.py index ba5cc3b9e..b5ba1d508 100644 --- a/tests/app/main/views/test_register.py +++ b/tests/app/main/views/test_register.py @@ -39,6 +39,10 @@ def test_logged_in_user_redirects_to_choose_service( '+4407700900460', '+1800-555-555', ]) +@pytest.mark.parametrize('password', [ + 'the quick brown fox', + ' the quick brown fox ', +]) def test_register_creates_new_user_and_redirects_to_continue_page( client, mock_send_verify_code, @@ -48,11 +52,12 @@ def test_register_creates_new_user_and_redirects_to_continue_page( mock_send_verify_email, mock_login, phone_number_to_register_with, + password, ): user_data = {'name': 'Some One Valid', 'email_address': 'notfound@example.gov.uk', 'mobile_number': phone_number_to_register_with, - 'password': 'validPassword!', + 'password': password, 'auth_type': 'sms_auth' } diff --git a/tests/app/main/views/test_sign_in.py b/tests/app/main/views/test_sign_in.py index dc9d4da29..6f44c8d4a 100644 --- a/tests/app/main/views/test_sign_in.py +++ b/tests/app/main/views/test_sign_in.py @@ -77,9 +77,9 @@ def test_logged_in_user_redirects_to_choose_service( assert response.location == url_for('main.choose_service', _external=True) -@pytest.mark.parametrize('email_address', [ - 'valid@example.gov.uk', - ' valid@example.gov.uk ', +@pytest.mark.parametrize('email_address, password', [ + ('valid@example.gov.uk', 'val1dPassw0rd!'), + (' valid@example.gov.uk ', ' val1dPassw0rd! '), ]) def test_process_sms_auth_sign_in_return_2fa_template( client, @@ -89,14 +89,15 @@ def test_process_sms_auth_sign_in_return_2fa_template( mock_get_user_by_email, mock_verify_password, email_address, + password, ): response = client.post( url_for('main.sign_in'), data={ 'email_address': email_address, - 'password': 'val1dPassw0rd!'}) + 'password': password}) assert response.status_code == 302 assert response.location == url_for('.two_factor', _external=True) - mock_verify_password.assert_called_with(api_user_active.id, 'val1dPassw0rd!') + mock_verify_password.assert_called_with(api_user_active.id, password) mock_get_user_by_email.assert_called_with('valid@example.gov.uk')