diff --git a/tests/app/aws/test_s3.py b/tests/app/aws/test_s3.py index 57673e6b4..e18e31f1b 100644 --- a/tests/app/aws/test_s3.py +++ b/tests/app/aws/test_s3.py @@ -571,9 +571,9 @@ def test_purge_bucket(mocker): mock_s3_resource = MagicMock() mock_bucket = MagicMock() mock_s3_resource.Bucket.return_value = mock_bucket - mocker.patch('app.aws.s3.get_s3_resource', return_value=mock_s3_resource) + mocker.patch("app.aws.s3.get_s3_resource", return_value=mock_s3_resource) - purge_bucket('my-bucket', 'access-key', 'secret-key', 'region') + purge_bucket("my-bucket", "access-key", "secret-key", "region") # Assert that the bucket's objects.all().delete() method was called mock_bucket.objects.all.return_value.delete.assert_called_once() @@ -613,8 +613,7 @@ def test_get_s3_files_handles_exception(mocker): # Make the first call succeed, second call should fail. mock_read_s3_file = mocker.patch( - "app.aws.s3.read_s3_file", - side_effect=[None, Exception("exception here")] + "app.aws.s3.read_s3_file", side_effect=[None, Exception("exception here")] ) mock_thread_pool_executor = mocker.patch("app.aws.s3.ThreadPoolExecutor") diff --git a/tests/app/dao/notification_dao/test_notification_dao.py b/tests/app/dao/notification_dao/test_notification_dao.py index 44d55f1ce..4df57ec07 100644 --- a/tests/app/dao/notification_dao/test_notification_dao.py +++ b/tests/app/dao/notification_dao/test_notification_dao.py @@ -2136,7 +2136,9 @@ def test_sanitize_successful_notification_by_id(): ) -def test_dao_get_notifications_by_recipient_or_reference_covers_sms_search_by_reference(notify_db_session): +def test_dao_get_notifications_by_recipient_or_reference_covers_sms_search_by_reference( + notify_db_session, +): """ This test: 1. Creates a service and an SMS template. @@ -2153,7 +2155,7 @@ def test_dao_get_notifications_by_recipient_or_reference_covers_sms_search_by_re data = { "id": uuid.uuid4(), "to": "1", - "normalised_to": "1", # phone is irrelevant here + "normalised_to": "1", # phone is irrelevant here "service_id": service.id, "service": service, "template_id": template.id, diff --git a/tests/app/dao/test_fact_notification_status_dao.py b/tests/app/dao/test_fact_notification_status_dao.py index 5b9a7d695..083546464 100644 --- a/tests/app/dao/test_fact_notification_status_dao.py +++ b/tests/app/dao/test_fact_notification_status_dao.py @@ -36,7 +36,9 @@ def test_fetch_notification_status_for_service_by_month(notify_db_session): service_2 = create_service(service_name="service_2") create_template(service=service_1) - create_template(service=service_1, template_type=TemplateType.EMAIL) + template_email = create_template( + service=service_1, template_type=TemplateType.EMAIL + ) # not the service being tested create_template(service=service_2) @@ -50,11 +52,15 @@ def test_fetch_notification_status_for_service_by_month(notify_db_session): create_notification( service_1.templates[0], created_at=datetime(2018, 1, 1, 1, 1, 0) ) - create_notification( + questionable_notification = create_notification( service_1.templates[1], created_at=datetime(2018, 1, 1, 1, 1, 0), status=NotificationStatus.DELIVERED, ) + print( + f"QN status = {questionable_notification.status} type = {questionable_notification.notification_type}" + ) + create_notification( service_1.templates[0], created_at=datetime(2018, 2, 1, 1, 1, 0), @@ -85,6 +91,7 @@ def test_fetch_notification_status_for_service_by_month(notify_db_session): assert len(results) == 4 assert results[0].month.date() == date(2018, 1, 1) + assert results[0].template == template_email assert results[0].notification_type == NotificationType.EMAIL assert results[0].notification_status == NotificationStatus.DELIVERED assert results[0].count == 1