mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 05:59:44 -04:00
write new tests
This commit is contained in:
@@ -5,6 +5,7 @@ from unittest.mock import ANY
|
||||
import pytest
|
||||
from flask import url_for
|
||||
|
||||
from app.main.views.register import check_invited_user_email_address_matches_expected
|
||||
from app.models.user import User
|
||||
from tests.conftest import normalize_spaces
|
||||
|
||||
@@ -380,6 +381,26 @@ def test_cannot_register_with_sms_auth_and_missing_mobile_number(
|
||||
assert err.attrs["data-error-label"] == "mobile_number"
|
||||
|
||||
|
||||
def test_check_invited_user_email_address_matches_expected(mocker):
|
||||
mock_flash = mocker.patch("app.main.views.register.flash")
|
||||
mock_abort = mocker.patch("app.main.views.register.abort")
|
||||
|
||||
check_invited_user_email_address_matches_expected("fake@fake.gov", "Fake@Fake.GOV")
|
||||
mock_flash.assert_not_called()
|
||||
mock_abort.assert_not_called()
|
||||
|
||||
|
||||
def test_check_invited_user_email_address_doesnt_match_expected(mocker):
|
||||
mock_flash = mocker.patch("app.main.views.register.flash")
|
||||
mock_abort = mocker.patch("app.main.views.register.abort")
|
||||
|
||||
check_invited_user_email_address_matches_expected("real@fake.gov", "Fake@Fake.GOV")
|
||||
mock_flash.assert_called_once_with(
|
||||
"You cannot accept an invite for another person."
|
||||
)
|
||||
mock_abort.assert_called_once_with(403)
|
||||
|
||||
|
||||
# def test_handle_login_dot_gov_invite_bad_email(client_request, mocker):
|
||||
|
||||
# mocker.patch(
|
||||
|
||||
Reference in New Issue
Block a user