mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-23 07:46:06 -04:00
notify-api-433b remove research mode
This commit is contained in:
@@ -602,7 +602,7 @@ def test_should_send_sms_to_anyone_with_test_key(
|
||||
headers=[('Content-Type', 'application/json'), ('Authorization', 'Bearer {}'.format(auth_header))]
|
||||
)
|
||||
app.celery.provider_tasks.deliver_sms.apply_async.assert_called_once_with(
|
||||
[fake_uuid], queue='research-mode-tasks'
|
||||
[fake_uuid], queue='send-sms-tasks'
|
||||
)
|
||||
assert response.status_code == 201
|
||||
|
||||
@@ -637,7 +637,7 @@ def test_should_send_email_to_anyone_with_test_key(
|
||||
)
|
||||
|
||||
app.celery.provider_tasks.deliver_email.apply_async.assert_called_once_with(
|
||||
[fake_uuid], queue='research-mode-tasks'
|
||||
[fake_uuid], queue='send-email-tasks'
|
||||
)
|
||||
assert response.status_code == 201
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@ def test_send_one_off_notification_calls_celery_correctly(persist_mock, celery_m
|
||||
|
||||
celery_mock.assert_called_once_with(
|
||||
notification=persist_mock.return_value,
|
||||
research_mode=False,
|
||||
queue=None
|
||||
)
|
||||
|
||||
@@ -163,21 +162,6 @@ def test_send_one_off_notification_calls_persist_correctly_for_email(
|
||||
)
|
||||
|
||||
|
||||
def test_send_one_off_notification_honors_research_mode(notify_db_session, persist_mock, celery_mock):
|
||||
service = create_service(research_mode=True)
|
||||
template = create_template(service=service)
|
||||
|
||||
post_data = {
|
||||
'template_id': str(template.id),
|
||||
'to': '202-867-5309',
|
||||
'created_by': str(service.created_by_id)
|
||||
}
|
||||
|
||||
send_one_off_notification(service.id, post_data)
|
||||
|
||||
assert celery_mock.call_args[1]['research_mode'] is True
|
||||
|
||||
|
||||
def test_send_one_off_notification_honors_priority(notify_db_session, persist_mock, celery_mock):
|
||||
service = create_service()
|
||||
template = create_template(service=service)
|
||||
@@ -282,7 +266,6 @@ def test_send_one_off_notification_should_add_email_reply_to_text_for_notificati
|
||||
notification = Notification.query.get(notification_id['id'])
|
||||
celery_mock.assert_called_once_with(
|
||||
notification=notification,
|
||||
research_mode=False,
|
||||
queue=None
|
||||
)
|
||||
assert notification.reply_to_text == reply_to_email.email_address
|
||||
@@ -307,7 +290,6 @@ def test_send_one_off_sms_notification_should_use_sms_sender_reply_to_text(sampl
|
||||
notification = Notification.query.get(notification_id['id'])
|
||||
celery_mock.assert_called_once_with(
|
||||
notification=notification,
|
||||
research_mode=False,
|
||||
queue=None
|
||||
)
|
||||
|
||||
@@ -333,7 +315,6 @@ def test_send_one_off_sms_notification_should_use_default_service_reply_to_text(
|
||||
notification = Notification.query.get(notification_id['id'])
|
||||
celery_mock.assert_called_once_with(
|
||||
notification=notification,
|
||||
research_mode=False,
|
||||
queue=None
|
||||
)
|
||||
|
||||
|
||||
@@ -229,7 +229,6 @@ def test_get_service_by_id(admin_request, sample_service):
|
||||
json_resp = admin_request.get('service.get_service_by_id', service_id=sample_service.id)
|
||||
assert json_resp['data']['name'] == sample_service.name
|
||||
assert json_resp['data']['id'] == str(sample_service.id)
|
||||
assert not json_resp['data']['research_mode']
|
||||
assert json_resp['data']['email_branding'] is None
|
||||
assert json_resp['data']['prefix_sms'] is True
|
||||
|
||||
@@ -257,7 +256,6 @@ def test_get_service_by_id(admin_request, sample_service):
|
||||
'prefix_sms',
|
||||
'purchase_order_number',
|
||||
'rate_limit',
|
||||
'research_mode',
|
||||
'restricted',
|
||||
'service_callback_api',
|
||||
'volume_email',
|
||||
@@ -373,7 +371,6 @@ def test_create_service(
|
||||
assert json_resp['data']['id']
|
||||
assert json_resp['data']['name'] == 'created service'
|
||||
assert json_resp['data']['email_from'] == 'created.service'
|
||||
assert not json_resp['data']['research_mode']
|
||||
assert json_resp['data']['count_as_live'] is expected_count_as_live
|
||||
|
||||
service_db = Service.query.get(json_resp['data']['id'])
|
||||
@@ -386,7 +383,6 @@ def test_create_service(
|
||||
)
|
||||
|
||||
assert json_resp['data']['name'] == 'created service'
|
||||
assert not json_resp['data']['research_mode']
|
||||
|
||||
service_sms_senders = ServiceSmsSender.query.filter_by(service_id=service_db.id).all()
|
||||
assert len(service_sms_senders) == 1
|
||||
@@ -738,10 +734,8 @@ def test_update_service_flags(client, sample_service):
|
||||
json_resp = resp.json
|
||||
assert resp.status_code == 200
|
||||
assert json_resp['data']['name'] == sample_service.name
|
||||
assert json_resp['data']['research_mode'] is False
|
||||
|
||||
data = {
|
||||
'research_mode': True,
|
||||
'permissions': [INTERNATIONAL_SMS_TYPE]
|
||||
}
|
||||
|
||||
@@ -754,7 +748,6 @@ def test_update_service_flags(client, sample_service):
|
||||
)
|
||||
result = resp.json
|
||||
assert resp.status_code == 200
|
||||
assert result['data']['research_mode'] is True
|
||||
assert set(result['data']['permissions']) == set([INTERNATIONAL_SMS_TYPE])
|
||||
|
||||
|
||||
@@ -961,35 +954,6 @@ def test_update_permissions_with_duplicate_permissions_will_raise_error(client,
|
||||
assert "Duplicate Service Permission: ['{}']".format(SMS_TYPE) in result['message']['permissions']
|
||||
|
||||
|
||||
def test_update_service_research_mode_throws_validation_error(notify_api, sample_service):
|
||||
with notify_api.test_request_context():
|
||||
with notify_api.test_client() as client:
|
||||
auth_header = create_admin_authorization_header()
|
||||
resp = client.get(
|
||||
'/service/{}'.format(sample_service.id),
|
||||
headers=[auth_header]
|
||||
)
|
||||
json_resp = resp.json
|
||||
assert resp.status_code == 200
|
||||
assert json_resp['data']['name'] == sample_service.name
|
||||
assert not json_resp['data']['research_mode']
|
||||
|
||||
data = {
|
||||
'research_mode': "dedede"
|
||||
}
|
||||
|
||||
auth_header = create_admin_authorization_header()
|
||||
|
||||
resp = client.post(
|
||||
'/service/{}'.format(sample_service.id),
|
||||
data=json.dumps(data),
|
||||
headers=[('Content-Type', 'application/json'), auth_header]
|
||||
)
|
||||
result = resp.json
|
||||
assert result['message']['research_mode'][0] == "Not a valid boolean."
|
||||
assert resp.status_code == 400
|
||||
|
||||
|
||||
def test_should_not_update_service_with_duplicate_name(notify_api,
|
||||
notify_db_session,
|
||||
sample_user,
|
||||
|
||||
Reference in New Issue
Block a user