Fixed test - I had deliberately failed the test as part of debugging and not fixed the assert. Doh.

This commit is contained in:
Martyn Inglis
2017-05-16 12:49:20 +01:00
parent d1aff5bb6e
commit a5dae0bebd
2 changed files with 4 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ from app.models import (
SMS_TYPE,
LETTER_TYPE,
NOTIFICATION_STATUS_TYPES_FAILED,
NOTIFICATION_STATUS_SUCCESS,
NOTIFICATION_DELIVERED,
NOTIFICATION_SENT)
from app.statsd_decorators import statsd
@@ -32,6 +33,7 @@ def timeout_job_counts(notifications_type, timeout_start):
func.count(Notification.status).label('count'),
Notification.status.label('status')
).filter(
Notification.notification_type == notifications_type,
JobStatistics.job_id == Notification.job_id,
JobStatistics.created_at < timeout_start,
sent != failed + delivered
@@ -47,7 +49,7 @@ def timeout_job_counts(notifications_type, timeout_start):
delivered_count = 0
failed_count = 0
for notification_status in job:
if notification_status.status in [NOTIFICATION_DELIVERED, NOTIFICATION_SENT]:
if notification_status.status in NOTIFICATION_STATUS_SUCCESS:
delivered_count += notification_status.count
else:
failed_count += notification_status.count

View File

@@ -780,7 +780,7 @@ def test_timeout_job_sets_all_non_delivered_emails_to_error_and_doesnt_affect_sm
assert sms_stats[0].emails_delivered == 0
assert sms_stats[0].sms_delivered == 0
assert sms_stats[0].sms_failed == 1
assert sms_stats[0].emails_failed == 100
assert sms_stats[0].emails_failed == 0
# this test is as above, but for SMS not email