mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 10:53:28 -05:00
Merge pull request #264 from alphagov/fix-sign-in-tests
Fix to sign in test and user model
This commit is contained in:
@@ -58,18 +58,6 @@ def test_should_return_locked_out_true_when_user_is_locked(app_,
|
||||
assert 'Username or password is incorrect' in resp.get_data(as_text=True)
|
||||
|
||||
|
||||
def test_should_return_active_user_is_false_if_user_is_inactive(app_, mock_get_user_by_email_inactive):
|
||||
|
||||
with app_.test_request_context():
|
||||
response = app_.test_client().post(
|
||||
url_for('main.sign_in'), data={
|
||||
'email_address': 'inactive_user@example.gov.uk',
|
||||
'password': 'val1dPassw0rd!'})
|
||||
|
||||
assert response.status_code == 200
|
||||
assert 'Username or password is incorrect' in response.get_data(as_text=True)
|
||||
|
||||
|
||||
def test_should_return_200_when_user_does_not_exist(app_, mock_get_user_by_email_not_found):
|
||||
with app_.test_request_context():
|
||||
response = app_.test_client().post(
|
||||
|
||||
@@ -401,12 +401,7 @@ def mock_get_user_by_email_locked(mocker, api_user_locked):
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
def mock_get_user_by_email_inactive(mocker, api_user_pending):
|
||||
|
||||
def _get_user(email_address):
|
||||
api_user_pending._email_address = email_address
|
||||
api_user_pending._is_locked = True
|
||||
return api_user_pending
|
||||
return mocker.patch('app.user_api_client.get_user_by_email', side_effect=_get_user)
|
||||
return mocker.patch('app.user_api_client.get_user_by_email', return_value=api_user_pending)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
|
||||
Reference in New Issue
Block a user