write new tests

This commit is contained in:
Kenneth Kehl
2024-05-10 07:51:32 -07:00
parent 11beff2541
commit c578175e53
2 changed files with 73 additions and 25 deletions

View File

@@ -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(