mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
Adjust tests to new way of querying for notification stats
This commit is contained in:
@@ -48,7 +48,6 @@ from app.dao.services_dao import (
|
||||
dao_fetch_all_services_by_user,
|
||||
dao_fetch_monthly_historical_usage_by_template_for_service,
|
||||
dao_fetch_service_by_id,
|
||||
dao_fetch_stats_for_service,
|
||||
dao_fetch_todays_stats_for_service,
|
||||
dao_fetch_todays_stats_for_all_services,
|
||||
dao_resume_service,
|
||||
|
||||
@@ -34,6 +34,7 @@ from tests.app.conftest import (
|
||||
sample_notification_with_job
|
||||
)
|
||||
from tests.app.db import (
|
||||
create_ft_notification_status,
|
||||
create_service,
|
||||
create_service_with_inbound_number,
|
||||
create_template,
|
||||
@@ -1469,8 +1470,7 @@ def test_set_sms_prefixing_for_service_cant_be_none(
|
||||
], ids=['seven_days', 'today'])
|
||||
def test_get_detailed_service(notify_db, notify_db_session, notify_api, sample_service, today_only, stats):
|
||||
with notify_api.test_request_context(), notify_api.test_client() as client:
|
||||
with freeze_time('2000-01-01T12:00:00'):
|
||||
create_sample_notification(notify_db, notify_db_session, status='delivered')
|
||||
create_ft_notification_status(date(2000, 1, 1), 'sms', sample_service, count=1)
|
||||
with freeze_time('2000-01-02T12:00:00'):
|
||||
create_sample_notification(notify_db, notify_db_session, status='created')
|
||||
resp = client.get(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from datetime import datetime, date
|
||||
|
||||
import pytest
|
||||
from freezegun import freeze_time
|
||||
@@ -133,9 +133,8 @@ def test_get_template_usage_by_month_returns_two_templates(admin_request, sample
|
||||
(False, {'requested': 2, 'delivered': 1, 'failed': 0}),
|
||||
(True, {'requested': 1, 'delivered': 0, 'failed': 0})
|
||||
], ids=['seven_days', 'today'])
|
||||
def test_get_service_notification_statistics(admin_request, sample_template, today_only, stats):
|
||||
with freeze_time('2000-01-01T12:00:00'):
|
||||
create_notification(sample_template, status='delivered')
|
||||
def test_get_service_notification_statistics(admin_request, sample_service, sample_template, today_only, stats):
|
||||
create_ft_notification_status(date(2000, 1, 1), 'sms', sample_service, count=1)
|
||||
with freeze_time('2000-01-02T12:00:00'):
|
||||
create_notification(sample_template, status='created')
|
||||
resp = admin_request.get(
|
||||
|
||||
Reference in New Issue
Block a user