more tests

This commit is contained in:
Kenneth Kehl
2023-08-11 11:47:57 -07:00
parent 318bb01392
commit 85604e5394
10 changed files with 189 additions and 30 deletions

View File

@@ -3,6 +3,7 @@ from unittest.mock import ANY, call
import pytest
from freezegun import freeze_time
from sqlalchemy.exc import SQLAlchemyError
from app.celery import nightly_tasks
from app.celery.nightly_tasks import (
@@ -148,6 +149,14 @@ def test_delete_inbound_sms_calls_child_task(notify_api, mocker):
assert nightly_tasks.delete_inbound_sms_older_than_retention.call_count == 1
def test_delete_inbound_sms_calls_child_task_db_error(notify_api, mocker):
mock_delete = mocker.patch('app.celery.nightly_tasks.delete_inbound_sms_older_than_retention')
mock_delete.side_effect = SQLAlchemyError
with pytest.raises(expected_exception=SQLAlchemyError):
delete_inbound_sms()
@freeze_time('2021-01-18T02:00')
@pytest.mark.parametrize('date_provided', [None, '2021-1-17'])
def test_save_daily_notification_processing_time(mocker, sample_template, date_provided):
@@ -316,6 +325,10 @@ def test_delete_notifications_task_calls_task_for_services_that_have_sent_notifi
])
def delete_notifications_by_service_and_type(id, param, param1):
pass
def test_cleanup_unfinished_jobs(mocker):
mock_s3 = mocker.patch('app.celery.nightly_tasks.remove_csv_object')
mock_dao_archive = mocker.patch('app.celery.nightly_tasks.dao_archive_job')