Rename variables and functions in tests

To reflect the new name of the feature.
This commit is contained in:
Chris Hill-Scott
2020-07-28 11:22:19 +01:00
parent 716eb67bfd
commit 65346852ed
9 changed files with 66 additions and 66 deletions

View File

@@ -25,7 +25,7 @@ from tests.app.db import (
create_api_key,
create_notification,
create_service,
create_service_whitelist,
create_service_guest_list,
create_template,
create_reply_to_email,
)
@@ -776,23 +776,23 @@ def test_should_not_persist_notification_or_send_sms_if_simulated_number(
])
@pytest.mark.parametrize('notification_type, to', [
(SMS_TYPE, '07827992635'),
(EMAIL_TYPE, 'non_whitelist_recipient@mail.com')]
(EMAIL_TYPE, 'non_guest_list_recipient@mail.com')]
)
def test_should_not_send_notification_to_non_whitelist_recipient_in_trial_mode(
def test_should_not_send_notification_to_non_guest_list_recipient_in_trial_mode(
client,
sample_service_whitelist,
sample_service_guest_list,
notification_type,
to,
key_type,
mocker
):
service = sample_service_whitelist.service
service = sample_service_guest_list.service
service.restricted = True
service.message_limit = 2
apply_async = mocker.patch('app.celery.provider_tasks.deliver_{}.apply_async'.format(notification_type))
template = create_template(service, template_type=notification_type)
assert sample_service_whitelist.service_id == service.id
assert sample_service_guest_list.service_id == service.id
assert to not in [member.recipient for member in service.guest_list]
create_notification(template=template)
@@ -830,9 +830,9 @@ def test_should_not_send_notification_to_non_whitelist_recipient_in_trial_mode(
])
@pytest.mark.parametrize('notification_type, to', [
(SMS_TYPE, '07123123123'),
(EMAIL_TYPE, 'whitelist_recipient@mail.com')]
(EMAIL_TYPE, 'guest_list_recipient@mail.com')]
)
def test_should_send_notification_to_whitelist_recipient(
def test_should_send_notification_to_guest_list_recipient(
client,
sample_service,
notification_type,
@@ -847,11 +847,11 @@ def test_should_send_notification_to_whitelist_recipient(
apply_async = mocker.patch('app.celery.provider_tasks.deliver_{}.apply_async'.format(notification_type))
template = create_template(sample_service, template_type=notification_type)
if notification_type == SMS_TYPE:
service_whitelist = create_service_whitelist(sample_service, mobile_number=to)
service_guest_list = create_service_guest_list(sample_service, mobile_number=to)
elif notification_type == EMAIL_TYPE:
service_whitelist = create_service_whitelist(sample_service, email_address=to)
service_guest_list = create_service_guest_list(sample_service, email_address=to)
assert service_whitelist.service_id == sample_service.id
assert service_guest_list.service_id == sample_service.id
assert to in [member.recipient for member in sample_service.guest_list]
create_notification(template=template)

View File

@@ -39,7 +39,7 @@ from tests.app.db import (
create_reply_to_email,
create_service,
create_service_sms_sender,
create_service_whitelist,
create_service_guest_list,
create_template,
)
from unittest.mock import ANY
@@ -245,12 +245,12 @@ def test_service_can_send_to_recipient_passes_for_live_service_non_team_member(k
serialised_service) is None
def test_service_can_send_to_recipient_passes_for_whitelisted_recipient_passes(sample_service):
create_service_whitelist(sample_service, email_address="some_other_email@test.com")
def test_service_can_send_to_recipient_passes_for_guest_list_recipient_passes(sample_service):
create_service_guest_list(sample_service, email_address="some_other_email@test.com")
assert service_can_send_to_recipient("some_other_email@test.com",
'team',
sample_service) is None
create_service_whitelist(sample_service, mobile_number='07513332413')
create_service_guest_list(sample_service, mobile_number='07513332413')
assert service_can_send_to_recipient('07513332413',
'team',
sample_service) is None
@@ -260,13 +260,13 @@ def test_service_can_send_to_recipient_passes_for_whitelisted_recipient_passes(s
{"email_address": "some_other_email@test.com"},
{"mobile_number": "07513332413"},
])
def test_service_can_send_to_recipient_fails_when_ignoring_whitelist(
def test_service_can_send_to_recipient_fails_when_ignoring_guest_list(
notify_db,
notify_db_session,
sample_service,
recipient,
):
create_service_whitelist(sample_service, **recipient)
create_service_guest_list(sample_service, **recipient)
with pytest.raises(BadRequestError) as exec_info:
service_can_send_to_recipient(
next(iter(recipient.values())),