Fixing tests, and resend invites endpoint.

Signed-off-by: Cliff Hill <clifford.hill@gsa.gov>
This commit is contained in:
Cliff Hill
2024-11-01 12:12:04 -04:00
parent fc09e70579
commit b532ce8959
3 changed files with 37 additions and 8 deletions

View File

@@ -1,5 +1,7 @@
from unittest.mock import ANY
from flask import current_app
from app import invite_api_client
@@ -10,7 +12,6 @@ def test_client_creates_invite(
sample_invite,
):
mocker.patch("app.notify_client.current_user")
mocker.patch("flask.request")
mock_post = mocker.patch(
"app.invite_api_client.post",
@@ -38,15 +39,23 @@ def test_client_creates_invite(
fake_state = "0987654321"
mock_token_urlsafe.return_value = fake_nonce
mock_generate_token = mocker.patch("notifications_utils.url_safe_token.generate_token")
mock_generate_token = mocker.patch(
"app.notify_client.invite_api_client.generate_token"
)
mock_generate_token.return_value = fake_state
invite_api_client.create_invite(
"12345", "67890", "test@example.com", {"send_messages"}, "sms_auth", [fake_uuid]
)
with current_app.test_request_context("/whatever"):
invite_api_client.create_invite(
"12345",
"67890",
"test@example.com",
{"send_messages"},
"sms_auth",
[fake_uuid],
)
mock_post.assert_called_once_with(
url="/service/{}/invite".format("67890"),
url=f"/service/{"67890"}/invite",
data={
"auth_type": "sms_auth",
"email_address": "test@example.com",