Working on fixing the tests.

This commit is contained in:
Cliff Hill
2024-10-30 09:03:23 -04:00
parent a090c90ed6
commit fc09e70579

View File

@@ -10,6 +10,7 @@ def test_client_creates_invite(
sample_invite, sample_invite,
): ):
mocker.patch("app.notify_client.current_user") mocker.patch("app.notify_client.current_user")
mocker.patch("flask.request")
mock_post = mocker.patch( mock_post = mocker.patch(
"app.invite_api_client.post", "app.invite_api_client.post",
@@ -26,6 +27,7 @@ def test_client_creates_invite(
"auth_type", "auth_type",
"folder_permissions", "folder_permissions",
"nonce", "nonce",
"state",
} }
) )
}, },
@@ -33,8 +35,12 @@ def test_client_creates_invite(
mock_token_urlsafe = mocker.patch("secrets.token_urlsafe") mock_token_urlsafe = mocker.patch("secrets.token_urlsafe")
fake_nonce = "1234567890" fake_nonce = "1234567890"
fake_state = "0987654321"
mock_token_urlsafe.return_value = fake_nonce mock_token_urlsafe.return_value = fake_nonce
mock_generate_token = mocker.patch("notifications_utils.url_safe_token.generate_token")
mock_generate_token.return_value = fake_state
invite_api_client.create_invite( invite_api_client.create_invite(
"12345", "67890", "test@example.com", {"send_messages"}, "sms_auth", [fake_uuid] "12345", "67890", "test@example.com", {"send_messages"}, "sms_auth", [fake_uuid]
) )
@@ -51,6 +57,7 @@ def test_client_creates_invite(
"invite_link_host": "http://localhost:6012", "invite_link_host": "http://localhost:6012",
"folder_permissions": [fake_uuid], "folder_permissions": [fake_uuid],
"nonce": fake_nonce, "nonce": fake_nonce,
"state": fake_state,
}, },
) )