Remove everything for the performance platform

We no longer will send them any stats so therefore don't need the code
- the code to work out the nightly stats
- the performance platform client
- any configuration for the client
- any nightly tasks that kick off the sending off the stats

We will require a change in cronitor as we no longer will have this task
run meaning we need to delete the cronitor check.
This commit is contained in:
David McDonald
2021-03-11 18:53:43 +00:00
parent 8325431462
commit 41d95378ea
16 changed files with 9 additions and 570 deletions

View File

@@ -1,5 +1,5 @@
from datetime import date, datetime, timedelta
from unittest.mock import PropertyMock, call, patch
from unittest.mock import call
import pytest
import pytz
@@ -20,21 +20,15 @@ from app.celery.nightly_tasks import (
remove_sms_email_csv_files,
s3,
save_daily_notification_processing_time,
send_daily_performance_platform_stats,
send_total_sent_notifications_to_performance_platform,
timeout_notifications,
)
from app.celery.service_callback_tasks import (
create_delivery_status_callback_data,
)
from app.clients.performance_platform.performance_platform_client import (
PerformancePlatformClient,
)
from app.config import QueueNames
from app.exceptions import NotificationTechnicalFailureException
from app.models import EMAIL_TYPE, LETTER_TYPE, SMS_TYPE, FactProcessingTime
from tests.app.db import (
create_ft_notification_status,
create_job,
create_notification,
create_service,
@@ -232,55 +226,6 @@ def test_timeout_notifications_sends_status_update_to_service(client, sample_tem
mocked.assert_called_once_with([str(notification.id), encrypted_data], queue=QueueNames.CALLBACKS)
def test_send_daily_performance_stats_calls_does_not_send_if_inactive(client, mocker):
send_mock = mocker.patch(
'app.celery.nightly_tasks.total_sent_notifications.send_total_notifications_sent_for_day_stats') # noqa
with patch.object(
PerformancePlatformClient,
'active',
new_callable=PropertyMock
) as mock_active:
mock_active.return_value = False
send_daily_performance_platform_stats()
assert send_mock.call_count == 0
@freeze_time("2016-06-11 02:00:00")
def test_send_total_sent_notifications_to_performance_platform_calls_with_correct_totals(
notify_db_session,
sample_template,
sample_email_template,
mocker
):
perf_mock = mocker.patch(
'app.celery.nightly_tasks.total_sent_notifications.send_total_notifications_sent_for_day_stats') # noqa
today = date(2016, 6, 11)
create_ft_notification_status(bst_date=today, template=sample_template)
create_ft_notification_status(bst_date=today, template=sample_email_template)
# Create some notifications for the day before
yesterday = date(2016, 6, 10)
create_ft_notification_status(bst_date=yesterday, template=sample_template, count=2)
create_ft_notification_status(bst_date=yesterday, template=sample_email_template, count=3)
with patch.object(
PerformancePlatformClient,
'active',
new_callable=PropertyMock
) as mock_active:
mock_active.return_value = True
send_total_sent_notifications_to_performance_platform(yesterday)
perf_mock.assert_has_calls([
call(datetime(2016, 6, 9, 23, 0), 'sms', 2),
call(datetime(2016, 6, 9, 23, 0), 'email', 3),
call(datetime(2016, 6, 9, 23, 0), 'letter', 0)
])
def test_should_call_delete_inbound_sms(notify_api, mocker):
mocker.patch('app.celery.nightly_tasks.delete_inbound_sms_older_than_retention')
delete_inbound_sms()