mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-16 20:48:37 -04:00
notify-api-433b remove research mode
This commit is contained in:
@@ -275,19 +275,17 @@ def test_should_process_all_sms_job(sample_job_with_placeholdered_template,
|
||||
# -------------- process_row tests -------------- #
|
||||
|
||||
|
||||
@pytest.mark.parametrize('template_type, research_mode, expected_function, expected_queue', [
|
||||
(SMS_TYPE, False, 'save_sms', 'database-tasks'),
|
||||
(SMS_TYPE, True, 'save_sms', 'research-mode-tasks'),
|
||||
(EMAIL_TYPE, False, 'save_email', 'database-tasks'),
|
||||
(EMAIL_TYPE, True, 'save_email', 'research-mode-tasks'),
|
||||
@pytest.mark.parametrize('template_type, expected_function, expected_queue', [
|
||||
(SMS_TYPE, 'save_sms', 'database-tasks'),
|
||||
(EMAIL_TYPE, 'save_email', 'database-tasks'),
|
||||
])
|
||||
def test_process_row_sends_letter_task(template_type, research_mode, expected_function, expected_queue, mocker):
|
||||
def test_process_row_sends_letter_task(template_type, expected_function, expected_queue, mocker):
|
||||
mocker.patch('app.celery.tasks.create_uuid', return_value='noti_uuid')
|
||||
task_mock = mocker.patch('app.celery.tasks.{}.apply_async'.format(expected_function))
|
||||
encrypt_mock = mocker.patch('app.celery.tasks.encryption.encrypt')
|
||||
template = Mock(id='template_id', template_type=template_type)
|
||||
job = Mock(id='job_id', template_version='temp_vers')
|
||||
service = Mock(id='service_id', research_mode=research_mode)
|
||||
service = Mock(id='service_id')
|
||||
|
||||
process_row(
|
||||
Row(
|
||||
@@ -390,30 +388,6 @@ def test_should_send_template_to_correct_sms_task_and_persist(sample_template_wi
|
||||
)
|
||||
|
||||
|
||||
def test_should_put_save_sms_task_in_research_mode_queue_if_research_mode_service(notify_db_session, mocker):
|
||||
service = create_service(research_mode=True, )
|
||||
|
||||
template = create_template(service=service)
|
||||
|
||||
notification = _notification_json(template, to="+447234123123")
|
||||
|
||||
mocked_deliver_sms = mocker.patch('app.celery.provider_tasks.deliver_sms.apply_async')
|
||||
|
||||
notification_id = uuid.uuid4()
|
||||
|
||||
save_sms(
|
||||
template.service_id,
|
||||
notification_id,
|
||||
encryption.encrypt(notification),
|
||||
)
|
||||
persisted_notification = Notification.query.one()
|
||||
provider_tasks.deliver_sms.apply_async.assert_called_once_with(
|
||||
[str(persisted_notification.id)],
|
||||
queue="research-mode-tasks"
|
||||
)
|
||||
assert mocked_deliver_sms.called
|
||||
|
||||
|
||||
def test_should_save_sms_if_restricted_service_and_valid_number(notify_db_session, mocker):
|
||||
user = create_user(mobile_number="202-867-5309")
|
||||
service = create_service(user=user, restricted=True)
|
||||
@@ -518,32 +492,6 @@ def test_should_not_save_email_if_restricted_service_and_invalid_email_address(n
|
||||
assert Notification.query.count() == 0
|
||||
|
||||
|
||||
def test_should_put_save_email_task_in_research_mode_queue_if_research_mode_service(
|
||||
notify_db_session, mocker
|
||||
):
|
||||
service = create_service(research_mode=True)
|
||||
|
||||
template = create_template(service=service, template_type='email')
|
||||
|
||||
notification = _notification_json(template, to="test@test.com")
|
||||
|
||||
mocker.patch('app.celery.provider_tasks.deliver_email.apply_async')
|
||||
|
||||
notification_id = uuid.uuid4()
|
||||
|
||||
save_email(
|
||||
template.service_id,
|
||||
notification_id,
|
||||
encryption.encrypt(notification),
|
||||
)
|
||||
|
||||
persisted_notification = Notification.query.one()
|
||||
provider_tasks.deliver_email.apply_async.assert_called_once_with(
|
||||
[str(persisted_notification.id)],
|
||||
queue="research-mode-tasks"
|
||||
)
|
||||
|
||||
|
||||
def test_should_save_sms_template_to_and_persist_with_job_id(sample_job, mocker):
|
||||
notification = _notification_json(
|
||||
sample_job.template,
|
||||
|
||||
Reference in New Issue
Block a user