mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-10 18:23:01 -04:00
add testing
This commit is contained in:
@@ -211,3 +211,4 @@ class StatisticsType(StrEnum):
|
|||||||
REQUESTED = "requested"
|
REQUESTED = "requested"
|
||||||
DELIVERED = "delivered"
|
DELIVERED = "delivered"
|
||||||
FAILURE = "failure"
|
FAILURE = "failure"
|
||||||
|
PENDING = "pending"
|
||||||
|
|||||||
@@ -29,15 +29,18 @@ def format_statistics(statistics, total_notifications=None):
|
|||||||
sms_dict = counts[NotificationType.SMS]
|
sms_dict = counts[NotificationType.SMS]
|
||||||
delivered_count = sms_dict[StatisticsType.DELIVERED]
|
delivered_count = sms_dict[StatisticsType.DELIVERED]
|
||||||
failed_count = sms_dict[StatisticsType.FAILURE]
|
failed_count = sms_dict[StatisticsType.FAILURE]
|
||||||
pending_count = total_notifications - (delivered_count + failed_count)
|
sms_dict[StatisticsType.PENDING] = calculate_pending_stats(
|
||||||
|
delivered_count, failed_count, total_notifications
|
||||||
pending_count = max(0, pending_count)
|
)
|
||||||
|
|
||||||
sms_dict[StatisticsType.PENDING] = pending_count
|
|
||||||
|
|
||||||
return counts
|
return counts
|
||||||
|
|
||||||
|
|
||||||
|
def calculate_pending_stats(delivered_count, failed_count, total_notifications):
|
||||||
|
pending_count = total_notifications - (delivered_count + failed_count)
|
||||||
|
return max(0, pending_count)
|
||||||
|
|
||||||
|
|
||||||
def format_admin_stats(statistics):
|
def format_admin_stats(statistics):
|
||||||
counts = create_stats_dict()
|
counts = create_stats_dict()
|
||||||
|
|
||||||
|
|||||||
@@ -1638,11 +1638,13 @@ _this_date = utc_now() - timedelta(days=4)
|
|||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
TemplateType.SMS: {
|
TemplateType.SMS: {
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 2,
|
StatisticsType.REQUESTED: 2,
|
||||||
|
StatisticsType.PENDING: 2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
(_this_date.date() + timedelta(days=1)).strftime("%Y-%m-%d"): {
|
(_this_date.date() + timedelta(days=1)).strftime("%Y-%m-%d"): {
|
||||||
@@ -1650,11 +1652,13 @@ _this_date = utc_now() - timedelta(days=4)
|
|||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
TemplateType.SMS: {
|
TemplateType.SMS: {
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 1,
|
StatisticsType.REQUESTED: 1,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
(_this_date.date() + timedelta(days=2)).strftime("%Y-%m-%d"): {
|
(_this_date.date() + timedelta(days=2)).strftime("%Y-%m-%d"): {
|
||||||
@@ -1662,11 +1666,13 @@ _this_date = utc_now() - timedelta(days=4)
|
|||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
TemplateType.SMS: {
|
TemplateType.SMS: {
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 1,
|
StatisticsType.REQUESTED: 1,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
(_this_date.date() + timedelta(days=3)).strftime("%Y-%m-%d"): {
|
(_this_date.date() + timedelta(days=3)).strftime("%Y-%m-%d"): {
|
||||||
@@ -1674,11 +1680,13 @@ _this_date = utc_now() - timedelta(days=4)
|
|||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
TemplateType.SMS: {
|
TemplateType.SMS: {
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
(_this_date.date() + timedelta(days=4)).strftime("%Y-%m-%d"): {
|
(_this_date.date() + timedelta(days=4)).strftime("%Y-%m-%d"): {
|
||||||
@@ -1686,11 +1694,13 @@ _this_date = utc_now() - timedelta(days=4)
|
|||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
TemplateType.SMS: {
|
TemplateType.SMS: {
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 1,
|
StatisticsType.REQUESTED: 1,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1713,11 +1723,13 @@ _this_date = utc_now() - timedelta(days=4)
|
|||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
TemplateType.SMS: {
|
TemplateType.SMS: {
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 2,
|
StatisticsType.REQUESTED: 2,
|
||||||
|
StatisticsType.PENDING: 2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
(_this_date.date() + timedelta(days=1)).strftime("%Y-%m-%d"): {
|
(_this_date.date() + timedelta(days=1)).strftime("%Y-%m-%d"): {
|
||||||
@@ -1725,11 +1737,13 @@ _this_date = utc_now() - timedelta(days=4)
|
|||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
TemplateType.SMS: {
|
TemplateType.SMS: {
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 1,
|
StatisticsType.REQUESTED: 1,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
(_this_date.date() + timedelta(days=2)).strftime("%Y-%m-%d"): {
|
(_this_date.date() + timedelta(days=2)).strftime("%Y-%m-%d"): {
|
||||||
@@ -1737,11 +1751,13 @@ _this_date = utc_now() - timedelta(days=4)
|
|||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
TemplateType.SMS: {
|
TemplateType.SMS: {
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 1,
|
StatisticsType.REQUESTED: 1,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
(_this_date.date() + timedelta(days=3)).strftime("%Y-%m-%d"): {
|
(_this_date.date() + timedelta(days=3)).strftime("%Y-%m-%d"): {
|
||||||
@@ -1749,11 +1765,13 @@ _this_date = utc_now() - timedelta(days=4)
|
|||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
TemplateType.SMS: {
|
TemplateType.SMS: {
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
(_this_date.date() + timedelta(days=4)).strftime("%Y-%m-%d"): {
|
(_this_date.date() + timedelta(days=4)).strftime("%Y-%m-%d"): {
|
||||||
@@ -1761,11 +1779,13 @@ _this_date = utc_now() - timedelta(days=4)
|
|||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
TemplateType.SMS: {
|
TemplateType.SMS: {
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.REQUESTED: 1,
|
StatisticsType.REQUESTED: 1,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1786,5 +1806,21 @@ def test_get_specific_days(data, start_date, days, end_date, expected, is_error)
|
|||||||
new_line.count = 1
|
new_line.count = 1
|
||||||
new_line.something = line["something"]
|
new_line.something = line["something"]
|
||||||
new_data.append(new_line)
|
new_data.append(new_line)
|
||||||
results = get_specific_days_stats(new_data, start_date, days, end_date)
|
|
||||||
|
total_notifications = None
|
||||||
|
|
||||||
|
date_key = _this_date.date().strftime("%Y-%m-%d")
|
||||||
|
if expected and date_key in expected:
|
||||||
|
sms_stats = expected[date_key].get(TemplateType.SMS, {})
|
||||||
|
requested = sms_stats.get(StatisticsType.REQUESTED, 0)
|
||||||
|
if requested > 0:
|
||||||
|
total_notifications = {_this_date: requested}
|
||||||
|
|
||||||
|
results = get_specific_days_stats(
|
||||||
|
new_data,
|
||||||
|
start_date,
|
||||||
|
days,
|
||||||
|
end_date,
|
||||||
|
total_notifications=total_notifications,
|
||||||
|
)
|
||||||
assert results == expected
|
assert results == expected
|
||||||
|
|||||||
@@ -2463,14 +2463,13 @@ def test_get_detailed_services_only_includes_todays_notifications(sample_templat
|
|||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.PENDING: 0,
|
StatisticsType.PENDING: 0,
|
||||||
StatisticsType.REQUESTED: 0
|
StatisticsType.REQUESTED: 0,
|
||||||
|
|
||||||
},
|
},
|
||||||
NotificationType.SMS: {
|
NotificationType.SMS: {
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
StatisticsType.PENDING: 0,
|
StatisticsType.PENDING: 0,
|
||||||
StatisticsType.REQUESTED: 3
|
StatisticsType.REQUESTED: 3,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from freezegun import freeze_time
|
|||||||
from app.enums import KeyType, NotificationStatus, NotificationType, StatisticsType
|
from app.enums import KeyType, NotificationStatus, NotificationType, StatisticsType
|
||||||
from app.service.statistics import (
|
from app.service.statistics import (
|
||||||
add_monthly_notification_status_stats,
|
add_monthly_notification_status_stats,
|
||||||
|
calculate_pending_stats,
|
||||||
create_empty_monthly_notification_status_stats_dict,
|
create_empty_monthly_notification_status_stats_dict,
|
||||||
create_stats_dict,
|
create_stats_dict,
|
||||||
create_zeroed_stats_dicts,
|
create_zeroed_stats_dicts,
|
||||||
@@ -27,22 +28,22 @@ NewStatsRow = collections.namedtuple(
|
|||||||
@pytest.mark.idparametrize(
|
@pytest.mark.idparametrize(
|
||||||
"stats, email_counts, sms_counts",
|
"stats, email_counts, sms_counts",
|
||||||
{
|
{
|
||||||
"empty": ([], [0, 0, 0], [0, 0, 0]),
|
"empty": ([], [0, 0, 0, 0], [0, 0, 0, 0]),
|
||||||
"always_increment_requested": (
|
"always_increment_requested": (
|
||||||
[
|
[
|
||||||
StatsRow(NotificationType.EMAIL, NotificationStatus.DELIVERED, 1),
|
StatsRow(NotificationType.EMAIL, NotificationStatus.DELIVERED, 1),
|
||||||
StatsRow(NotificationType.EMAIL, NotificationStatus.FAILED, 1),
|
StatsRow(NotificationType.EMAIL, NotificationStatus.FAILED, 1),
|
||||||
],
|
],
|
||||||
[2, 1, 1],
|
[2, 1, 1, 0],
|
||||||
[0, 0, 0],
|
[0, 0, 0, 0],
|
||||||
),
|
),
|
||||||
"dont_mix_template_types": (
|
"dont_mix_template_types": (
|
||||||
[
|
[
|
||||||
StatsRow(NotificationType.EMAIL, NotificationStatus.DELIVERED, 1),
|
StatsRow(NotificationType.EMAIL, NotificationStatus.DELIVERED, 1),
|
||||||
StatsRow(NotificationType.SMS, NotificationStatus.DELIVERED, 1),
|
StatsRow(NotificationType.SMS, NotificationStatus.DELIVERED, 1),
|
||||||
],
|
],
|
||||||
[1, 1, 0],
|
[1, 1, 0, 0],
|
||||||
[1, 1, 0],
|
[1, 1, 0, 0],
|
||||||
),
|
),
|
||||||
"convert_fail_statuses_to_failed": (
|
"convert_fail_statuses_to_failed": (
|
||||||
[
|
[
|
||||||
@@ -57,8 +58,8 @@ NewStatsRow = collections.namedtuple(
|
|||||||
NotificationType.EMAIL, NotificationStatus.PERMANENT_FAILURE, 1
|
NotificationType.EMAIL, NotificationStatus.PERMANENT_FAILURE, 1
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
[4, 0, 4],
|
[4, 0, 4, 0],
|
||||||
[0, 0, 0],
|
[0, 0, 0, 0],
|
||||||
),
|
),
|
||||||
"convert_sent_to_delivered": (
|
"convert_sent_to_delivered": (
|
||||||
[
|
[
|
||||||
@@ -66,16 +67,16 @@ NewStatsRow = collections.namedtuple(
|
|||||||
StatsRow(NotificationType.SMS, NotificationStatus.DELIVERED, 1),
|
StatsRow(NotificationType.SMS, NotificationStatus.DELIVERED, 1),
|
||||||
StatsRow(NotificationType.SMS, NotificationStatus.SENT, 1),
|
StatsRow(NotificationType.SMS, NotificationStatus.SENT, 1),
|
||||||
],
|
],
|
||||||
[0, 0, 0],
|
[0, 0, 0, 0],
|
||||||
[3, 2, 0],
|
[3, 2, 0, 0],
|
||||||
),
|
),
|
||||||
"handles_none_rows": (
|
"handles_none_rows": (
|
||||||
[
|
[
|
||||||
StatsRow(NotificationType.SMS, NotificationStatus.SENDING, 1),
|
StatsRow(NotificationType.SMS, NotificationStatus.SENDING, 1),
|
||||||
StatsRow(None, None, None),
|
StatsRow(None, None, None),
|
||||||
],
|
],
|
||||||
[0, 0, 0],
|
[0, 0, 0, 0],
|
||||||
[1, 0, 0],
|
[1, 0, 0, 0],
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -89,6 +90,7 @@ def test_format_statistics(stats, email_counts, sms_counts):
|
|||||||
StatisticsType.REQUESTED,
|
StatisticsType.REQUESTED,
|
||||||
StatisticsType.DELIVERED,
|
StatisticsType.DELIVERED,
|
||||||
StatisticsType.FAILURE,
|
StatisticsType.FAILURE,
|
||||||
|
StatisticsType.PENDING,
|
||||||
],
|
],
|
||||||
email_counts,
|
email_counts,
|
||||||
)
|
)
|
||||||
@@ -101,23 +103,58 @@ def test_format_statistics(stats, email_counts, sms_counts):
|
|||||||
StatisticsType.REQUESTED,
|
StatisticsType.REQUESTED,
|
||||||
StatisticsType.DELIVERED,
|
StatisticsType.DELIVERED,
|
||||||
StatisticsType.FAILURE,
|
StatisticsType.FAILURE,
|
||||||
|
StatisticsType.PENDING,
|
||||||
],
|
],
|
||||||
sms_counts,
|
sms_counts,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def test_format_statistics_with_pending():
|
||||||
|
stats = [
|
||||||
|
StatsRow(NotificationType.SMS, NotificationStatus.DELIVERED, 10),
|
||||||
|
StatsRow(NotificationType.SMS, NotificationStatus.FAILED, 2),
|
||||||
|
]
|
||||||
|
|
||||||
|
total_notifications_for_sms = 20
|
||||||
|
|
||||||
|
result = format_statistics(stats, total_notifications=total_notifications_for_sms)
|
||||||
|
|
||||||
|
expected_sms_counts = {
|
||||||
|
StatisticsType.REQUESTED: 12,
|
||||||
|
StatisticsType.DELIVERED: 10,
|
||||||
|
StatisticsType.FAILURE: 2,
|
||||||
|
StatisticsType.PENDING: 8,
|
||||||
|
}
|
||||||
|
|
||||||
|
assert result[NotificationType.SMS] == expected_sms_counts
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"delivered, failed, total, expected",
|
||||||
|
[
|
||||||
|
(10, 2, 20, 8),
|
||||||
|
(10, 10, 20, 0),
|
||||||
|
(15, 10, 20, 0),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_calculate_pending(delivered, failed, total, expected):
|
||||||
|
assert calculate_pending_stats(delivered, failed, total) == expected
|
||||||
|
|
||||||
|
|
||||||
def test_create_zeroed_stats_dicts():
|
def test_create_zeroed_stats_dicts():
|
||||||
assert create_zeroed_stats_dicts() == {
|
assert create_zeroed_stats_dicts() == {
|
||||||
NotificationType.SMS: {
|
NotificationType.SMS: {
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
NotificationType.EMAIL: {
|
NotificationType.EMAIL: {
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ def test_get_template_usage_by_month_returns_two_templates(
|
|||||||
StatisticsType.REQUESTED: 2,
|
StatisticsType.REQUESTED: 2,
|
||||||
StatisticsType.DELIVERED: 1,
|
StatisticsType.DELIVERED: 1,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -127,6 +128,7 @@ def test_get_template_usage_by_month_returns_two_templates(
|
|||||||
StatisticsType.REQUESTED: 1,
|
StatisticsType.REQUESTED: 1,
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -163,11 +165,13 @@ def test_get_service_notification_statistics_with_unknown_service(admin_request)
|
|||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
NotificationType.EMAIL: {
|
NotificationType.EMAIL: {
|
||||||
StatisticsType.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
StatisticsType.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
StatisticsType.FAILURE: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
|
StatisticsType.PENDING: 0,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user