-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
0 additions
and
377 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from unittest import mock | ||
|
||
import pytest | ||
from django.db.utils import IntegrityError | ||
|
||
|
@@ -156,56 +154,6 @@ def test_has_organisation_permission_is_false_when_user_does_not_have_permission | |
) | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_creating_a_user_calls_mailer_lite_subscribe(mocker): | ||
# Given | ||
mailer_lite_mock = mocker.patch("users.models.mailer_lite") | ||
# When | ||
user = FFAdminUser.objects.create( | ||
email="[email protected]", | ||
) | ||
# Then | ||
mailer_lite_mock.subscribe.assert_called_with(user) | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_user_add_organisation_does_not_call_mailer_lite_subscribe_for_unpaid_organisation( | ||
mocker, | ||
): | ||
user = FFAdminUser.objects.create(email="[email protected]") | ||
organisation = Organisation.objects.create(name="Test Organisation") | ||
mailer_lite_mock = mocker.patch("users.models.mailer_lite") | ||
mocker.patch( | ||
"organisations.models.Organisation.is_paid", | ||
new_callable=mock.PropertyMock, | ||
return_value=False, | ||
) | ||
# When | ||
user.add_organisation(organisation, OrganisationRole.USER) | ||
|
||
# Then | ||
mailer_lite_mock.subscribe.assert_not_called() | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_user_add_organisation_calls_mailer_lite_subscribe_for_paid_organisation( | ||
mocker, | ||
): | ||
mailer_lite_mock = mocker.patch("users.models.mailer_lite") | ||
user = FFAdminUser.objects.create(email="[email protected]") | ||
organisation = Organisation.objects.create(name="Test Organisation") | ||
mocker.patch( | ||
"organisations.models.Organisation.is_paid", | ||
new_callable=mock.PropertyMock, | ||
return_value=True, | ||
) | ||
# When | ||
user.add_organisation(organisation, OrganisationRole.USER) | ||
|
||
# Then | ||
mailer_lite_mock.subscribe.assert_called_with(user) | ||
|
||
|
||
def test_user_add_organisation_adds_user_to_the_default_user_permission_group( | ||
test_user, organisation, default_user_permission_group, user_permission_group | ||
): | ||
|
140 changes: 0 additions & 140 deletions
140
api/tests/unit/users/utils/test_unit_users_mailer_lite.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.