mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-20 14:29:25 -04:00
Rename to performance_dashboard
Fix totals to return totals for all time rather than for date range. Added more test data
This commit is contained in:
@@ -709,6 +709,19 @@ def test_get_total_notifications_for_date_range(sample_service):
|
||||
template_sms = create_template(service=sample_service, template_type='sms', template_name='a')
|
||||
template_email = create_template(service=sample_service, template_type='email', template_name='b')
|
||||
template_letter = create_template(service=sample_service, template_type='letter', template_name='c')
|
||||
create_ft_notification_status(bst_date=date(2021, 2, 28),
|
||||
service=template_email.service,
|
||||
template=template_email,
|
||||
count=15)
|
||||
create_ft_notification_status(bst_date=date(2021, 2, 28),
|
||||
service=template_sms.service,
|
||||
template=template_sms,
|
||||
count=20)
|
||||
create_ft_notification_status(bst_date=date(2021, 2, 28),
|
||||
service=template_letter.service,
|
||||
template=template_letter,
|
||||
count=3)
|
||||
|
||||
create_ft_notification_status(bst_date=date(2021, 3, 1),
|
||||
service=template_email.service,
|
||||
template=template_email,
|
||||
@@ -725,5 +738,4 @@ def test_get_total_notifications_for_date_range(sample_service):
|
||||
results = get_total_notifications_for_date_range(start_date=datetime(2021, 3, 1), end_date=datetime(2021, 3, 1))
|
||||
|
||||
assert len(results) == 1
|
||||
print(type(results[0].emails))
|
||||
assert results[0] == ("2021-03-01", 15, 20, 3)
|
||||
assert results[0] == ("2021-03-01", 15, 20, 3)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
|
||||
from freezegun import freeze_time
|
||||
|
||||
from app.dao import fact_processing_time_dao
|
||||
from app.dao.fact_processing_time_dao import get_processing_time_percentage_for_date_range
|
||||
from app.models import FactProcessingTime
|
||||
from tests.app.db import create_process_time
|
||||
|
||||
|
||||
def test_insert_update_processing_time(notify_db_session):
|
||||
@@ -45,13 +45,21 @@ def test_insert_update_processing_time(notify_db_session):
|
||||
|
||||
|
||||
def test_get_processing_time_percentage_for_date_range(notify_db_session):
|
||||
data = FactProcessingTime(
|
||||
bst_date=datetime(2021, 2, 22).date(),
|
||||
create_process_time(
|
||||
bst_date='2021-02-21',
|
||||
messages_total=5,
|
||||
messages_within_10_secs=4
|
||||
)
|
||||
create_process_time(
|
||||
bst_date='2021-02-22',
|
||||
messages_total=3,
|
||||
messages_within_10_secs=2
|
||||
)
|
||||
|
||||
fact_processing_time_dao.insert_update_processing_time(data)
|
||||
create_process_time(
|
||||
bst_date='2021-02-23',
|
||||
messages_total=4,
|
||||
messages_within_10_secs=3
|
||||
)
|
||||
|
||||
results = get_processing_time_percentage_for_date_range('2021-02-22', '2021-02-22')
|
||||
|
||||
|
||||
@@ -1178,5 +1178,3 @@ def test_get_live_services_with_organisation(sample_organisation):
|
||||
(live_service_diff_org.name, another_org.name),
|
||||
(live_service.name, sample_organisation.name),
|
||||
(service_without_org.name, None)]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user