mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 02:41:14 -05:00
add new notification status 'sent'
for international text messages, when we may not ever receive callback info, so we need a separate status that doesn't get timed out etc
This commit is contained in:
@@ -187,7 +187,6 @@ class Development(Config):
|
|||||||
NOTIFY_ENVIRONMENT = 'development'
|
NOTIFY_ENVIRONMENT = 'development'
|
||||||
NOTIFICATION_QUEUE_PREFIX = 'development'
|
NOTIFICATION_QUEUE_PREFIX = 'development'
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
SQLALCHEMY_ECHO = False
|
|
||||||
CELERY_QUEUES = Config.CELERY_QUEUES + [
|
CELERY_QUEUES = Config.CELERY_QUEUES + [
|
||||||
Queue('db-sms', Exchange('default'), routing_key='db-sms'),
|
Queue('db-sms', Exchange('default'), routing_key='db-sms'),
|
||||||
Queue('priority', Exchange('default'), routing_key='priority'),
|
Queue('priority', Exchange('default'), routing_key='priority'),
|
||||||
|
|||||||
@@ -572,6 +572,7 @@ class VerifyCode(db.Model):
|
|||||||
|
|
||||||
NOTIFICATION_CREATED = 'created'
|
NOTIFICATION_CREATED = 'created'
|
||||||
NOTIFICATION_SENDING = 'sending'
|
NOTIFICATION_SENDING = 'sending'
|
||||||
|
NOTIFICATION_SENT = 'sent'
|
||||||
NOTIFICATION_DELIVERED = 'delivered'
|
NOTIFICATION_DELIVERED = 'delivered'
|
||||||
NOTIFICATION_PENDING = 'pending'
|
NOTIFICATION_PENDING = 'pending'
|
||||||
NOTIFICATION_FAILED = 'failed'
|
NOTIFICATION_FAILED = 'failed'
|
||||||
@@ -586,6 +587,7 @@ NOTIFICATION_STATUS_TYPES_FAILED = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
NOTIFICATION_STATUS_TYPES_COMPLETED = [
|
NOTIFICATION_STATUS_TYPES_COMPLETED = [
|
||||||
|
NOTIFICATION_SENT,
|
||||||
NOTIFICATION_DELIVERED,
|
NOTIFICATION_DELIVERED,
|
||||||
NOTIFICATION_FAILED,
|
NOTIFICATION_FAILED,
|
||||||
NOTIFICATION_TECHNICAL_FAILURE,
|
NOTIFICATION_TECHNICAL_FAILURE,
|
||||||
@@ -595,6 +597,7 @@ NOTIFICATION_STATUS_TYPES_COMPLETED = [
|
|||||||
|
|
||||||
NOTIFICATION_STATUS_TYPES_BILLABLE = [
|
NOTIFICATION_STATUS_TYPES_BILLABLE = [
|
||||||
NOTIFICATION_SENDING,
|
NOTIFICATION_SENDING,
|
||||||
|
NOTIFICATION_SENT,
|
||||||
NOTIFICATION_DELIVERED,
|
NOTIFICATION_DELIVERED,
|
||||||
NOTIFICATION_FAILED,
|
NOTIFICATION_FAILED,
|
||||||
NOTIFICATION_TECHNICAL_FAILURE,
|
NOTIFICATION_TECHNICAL_FAILURE,
|
||||||
@@ -605,6 +608,7 @@ NOTIFICATION_STATUS_TYPES_BILLABLE = [
|
|||||||
NOTIFICATION_STATUS_TYPES = [
|
NOTIFICATION_STATUS_TYPES = [
|
||||||
NOTIFICATION_CREATED,
|
NOTIFICATION_CREATED,
|
||||||
NOTIFICATION_SENDING,
|
NOTIFICATION_SENDING,
|
||||||
|
NOTIFICATION_SENT,
|
||||||
NOTIFICATION_DELIVERED,
|
NOTIFICATION_DELIVERED,
|
||||||
NOTIFICATION_PENDING,
|
NOTIFICATION_PENDING,
|
||||||
NOTIFICATION_FAILED,
|
NOTIFICATION_FAILED,
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ def test_get_fragment_count_separates_sms_and_email(notify_db, sample_template,
|
|||||||
def test_get_fragment_count_filters_on_status(notify_db, sample_template):
|
def test_get_fragment_count_filters_on_status(notify_db, sample_template):
|
||||||
for status in NOTIFICATION_STATUS_TYPES:
|
for status in NOTIFICATION_STATUS_TYPES:
|
||||||
noti_hist(notify_db, sample_template, status=status)
|
noti_hist(notify_db, sample_template, status=status)
|
||||||
# sending, delivered, failed, technical-failure, temporary-failure, permanent-failure
|
# sending, sent, delivered, failed, technical-failure, temporary-failure, permanent-failure
|
||||||
assert get_fragment_count(sample_template.service_id)['sms_count'] == 6
|
assert get_fragment_count(sample_template.service_id)['sms_count'] == 7
|
||||||
|
|
||||||
|
|
||||||
def test_get_fragment_count_filters_on_service_id(notify_db, sample_template, service_factory):
|
def test_get_fragment_count_filters_on_service_id(notify_db, sample_template, service_factory):
|
||||||
|
|||||||
@@ -307,8 +307,8 @@ def test_get_all_notifications_filter_by_status_invalid_status(client, sample_no
|
|||||||
|
|
||||||
assert json_response['status_code'] == 400
|
assert json_response['status_code'] == 400
|
||||||
assert len(json_response['errors']) == 1
|
assert len(json_response['errors']) == 1
|
||||||
assert json_response['errors'][0]['message'] == "status elephant is not one of [created, sending, delivered, " \
|
assert json_response['errors'][0]['message'] == "status elephant is not one of [created, sending, sent, " \
|
||||||
"pending, failed, technical-failure, temporary-failure, permanent-failure]"
|
"delivered, pending, failed, technical-failure, temporary-failure, permanent-failure]"
|
||||||
|
|
||||||
|
|
||||||
def test_get_all_notifications_filter_by_multiple_statuses(client, notify_db, notify_db_session):
|
def test_get_all_notifications_filter_by_multiple_statuses(client, notify_db, notify_db_session):
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ def test_get_notifications_request_invalid_statuses(
|
|||||||
invalid_statuses, valid_statuses
|
invalid_statuses, valid_statuses
|
||||||
):
|
):
|
||||||
partial_error_status = "is not one of " \
|
partial_error_status = "is not one of " \
|
||||||
"[created, sending, delivered, pending, failed, " \
|
"[created, sending, sent, delivered, pending, failed, " \
|
||||||
"technical-failure, temporary-failure, permanent-failure]"
|
"technical-failure, temporary-failure, permanent-failure]"
|
||||||
|
|
||||||
with pytest.raises(ValidationError) as e:
|
with pytest.raises(ValidationError) as e:
|
||||||
@@ -74,7 +74,7 @@ def test_get_notifications_request_invalid_statuses_and_template_types():
|
|||||||
|
|
||||||
error_messages = [error['message'] for error in errors]
|
error_messages = [error['message'] for error in errors]
|
||||||
for invalid_status in ["elephant", "giraffe"]:
|
for invalid_status in ["elephant", "giraffe"]:
|
||||||
assert "status {} is not one of [created, sending, delivered, " \
|
assert "status {} is not one of [created, sending, sent, delivered, " \
|
||||||
"pending, failed, technical-failure, temporary-failure, permanent-failure]".format(
|
"pending, failed, technical-failure, temporary-failure, permanent-failure]".format(
|
||||||
invalid_status
|
invalid_status
|
||||||
) in error_messages
|
) in error_messages
|
||||||
|
|||||||
Reference in New Issue
Block a user