mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
@@ -129,7 +129,7 @@ def test_create_service_data_retention_returns_400_when_notification_type_is_inv
|
|||||||
assert json_resp["errors"][0]["error"] == "ValidationError"
|
assert json_resp["errors"][0]["error"] == "ValidationError"
|
||||||
assert (
|
assert (
|
||||||
json_resp["errors"][0]["message"]
|
json_resp["errors"][0]["message"]
|
||||||
== "notification_type unknown is not one of [sms, email]"
|
== f"notification_type unknown is not one of [{', '.join([f'<{type(e).__name__}.{e.name}: {e.value}>'for e in (NotificationType.SMS, NotificationType.EMAIL)])}]"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from unittest.mock import Mock
|
|||||||
import pytest
|
import pytest
|
||||||
from freezegun import freeze_time
|
from freezegun import freeze_time
|
||||||
|
|
||||||
from app.enums import KeyType, NotificationStatus, NotificationType
|
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,
|
||||||
create_empty_monthly_notification_status_stats_dict,
|
create_empty_monthly_notification_status_stats_dict,
|
||||||
@@ -84,9 +84,9 @@ def test_format_statistics(stats, email_counts, sms_counts):
|
|||||||
status: count
|
status: count
|
||||||
for status, count in zip(
|
for status, count in zip(
|
||||||
[
|
[
|
||||||
NotificationStatus.REQUESTED,
|
StatisticsType.REQUESTED,
|
||||||
NotificationStatus.DELIVERED,
|
StatisticsType.DELIVERED,
|
||||||
NotificationStatus.FAILED,
|
StatisticsType.FAILURE,
|
||||||
],
|
],
|
||||||
email_counts,
|
email_counts,
|
||||||
)
|
)
|
||||||
@@ -96,9 +96,9 @@ def test_format_statistics(stats, email_counts, sms_counts):
|
|||||||
status: count
|
status: count
|
||||||
for status, count in zip(
|
for status, count in zip(
|
||||||
[
|
[
|
||||||
NotificationStatus.REQUESTED,
|
StatisticsType.REQUESTED,
|
||||||
NotificationStatus.DELIVERED,
|
StatisticsType.DELIVERED,
|
||||||
NotificationStatus.FAILED,
|
StatisticsType.FAILURE,
|
||||||
],
|
],
|
||||||
sms_counts,
|
sms_counts,
|
||||||
)
|
)
|
||||||
@@ -108,14 +108,14 @@ def test_format_statistics(stats, email_counts, sms_counts):
|
|||||||
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: {
|
||||||
NotificationStatus.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
NotificationStatus.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
NotificationStatus.FAILED: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
},
|
},
|
||||||
NotificationType.EMAIL: {
|
NotificationType.EMAIL: {
|
||||||
NotificationStatus.REQUESTED: 0,
|
StatisticsType.REQUESTED: 0,
|
||||||
NotificationStatus.DELIVERED: 0,
|
StatisticsType.DELIVERED: 0,
|
||||||
NotificationStatus.FAILED: 0,
|
StatisticsType.FAILURE: 0,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ def test_format_admin_stats_only_includes_test_key_notifications_in_test_key_sec
|
|||||||
3,
|
3,
|
||||||
),
|
),
|
||||||
NewStatsRow(
|
NewStatsRow(
|
||||||
NotificationType.SMS, NotificationType.PERMANENT_FAILURE, KeyType.TEST, 4
|
NotificationType.SMS, NotificationStatus.PERMANENT_FAILURE, KeyType.TEST, 4
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
stats_dict = format_admin_stats(rows)
|
stats_dict = format_admin_stats(rows)
|
||||||
@@ -226,9 +226,9 @@ def test_format_admin_stats_counts_non_test_key_notifications_correctly():
|
|||||||
|
|
||||||
def _stats(requested, delivered, failed):
|
def _stats(requested, delivered, failed):
|
||||||
return {
|
return {
|
||||||
NotificationStatus.REQUESTED: requested,
|
StatisticsType.REQUESTED: requested,
|
||||||
NotificationStatus.DELIVERED: delivered,
|
StatisticsType.DELIVERED: delivered,
|
||||||
NotificationStatus.FAILED: failed,
|
StatisticsType.FAILURE: failed,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user