Run auto-correct on app/ and tests/

This commit is contained in:
Ben Thorner
2021-03-10 13:55:06 +00:00
parent 321b4913ed
commit a91fde2fda
248 changed files with 2026 additions and 1716 deletions

View File

@@ -4,17 +4,20 @@ from functools import partial
import pytest
from freezegun import freeze_time
from sqlalchemy.exc import SQLAlchemyError, IntegrityError
from sqlalchemy.exc import IntegrityError, SQLAlchemyError
from sqlalchemy.orm.exc import NoResultFound
from app.dao.notifications_dao import (
dao_create_notification,
dao_delete_notifications_by_id,
dao_get_last_notification_added_for_job_id,
dao_get_letters_and_sheets_volume_by_postage,
dao_get_notifications_by_recipient_or_reference,
dao_get_letters_to_be_printed,
dao_get_notification_by_reference,
dao_get_notification_count_for_job_id,
dao_get_notification_or_history_by_reference,
dao_get_notifications_by_recipient_or_reference,
dao_get_notifications_by_references,
dao_timeout_notifications,
dao_update_notification,
dao_update_notifications_by_reference,
@@ -24,35 +27,32 @@ from app.dao.notifications_dao import (
get_notifications_for_job,
get_notifications_for_service,
is_delivery_slow_for_providers,
notifications_not_yet_sent,
update_notification_status_by_id,
update_notification_status_by_reference,
dao_get_notification_by_reference,
dao_get_notifications_by_references,
dao_get_notification_or_history_by_reference,
notifications_not_yet_sent,
dao_get_letters_to_be_printed)
)
from app.models import (
Job,
Notification,
NotificationHistory,
NOTIFICATION_STATUS_TYPES,
NOTIFICATION_STATUS_TYPES_FAILED,
NOTIFICATION_TEMPORARY_FAILURE,
NOTIFICATION_SENDING,
NOTIFICATION_PENDING,
NOTIFICATION_SENT,
NOTIFICATION_DELIVERED,
JOB_STATUS_IN_PROGRESS,
KEY_TYPE_NORMAL,
KEY_TYPE_TEAM,
KEY_TYPE_TEST,
JOB_STATUS_IN_PROGRESS
NOTIFICATION_DELIVERED,
NOTIFICATION_PENDING,
NOTIFICATION_SENDING,
NOTIFICATION_SENT,
NOTIFICATION_STATUS_TYPES,
NOTIFICATION_STATUS_TYPES_FAILED,
NOTIFICATION_TEMPORARY_FAILURE,
Job,
Notification,
NotificationHistory,
)
from tests.app.db import (
create_job,
create_notification,
create_notification_history,
create_service,
create_template,
create_notification_history
)

View File

@@ -1,23 +1,21 @@
from datetime import (
datetime,
date,
timedelta
)
from datetime import date, datetime, timedelta
import pytest
from flask import current_app
from freezegun import freeze_time
from app.dao.notifications_dao import (
delete_notifications_older_than_retention_by_type,
insert_notification_history_delete_notifications
insert_notification_history_delete_notifications,
)
from app.models import Notification, NotificationHistory
from tests.app.db import (
create_template,
create_notification,
create_service_data_retention,
create_notification_history,
create_service,
create_notification_history)
create_service_data_retention,
create_template,
)
def create_test_data(notification_type, sample_service, days_of_retention=3):

View File

@@ -2,9 +2,10 @@ from datetime import date, datetime, timedelta
from freezegun import freeze_time
from app.dao.notifications_dao import dao_get_total_notifications_sent_per_day_for_performance_platform
from app.dao.notifications_dao import (
dao_get_total_notifications_sent_per_day_for_performance_platform,
)
from app.models import KEY_TYPE_NORMAL, KEY_TYPE_TEAM, KEY_TYPE_TEST
from tests.app.db import create_notification
BEGINNING_OF_DAY = date(2016, 10, 18)

View File

@@ -1,6 +1,7 @@
from datetime import datetime, timedelta
from app.dao.notifications_dao import dao_get_last_date_template_was_used
from tests.app.db import create_notification, create_ft_notification_status
from tests.app.db import create_ft_notification_status, create_notification
def test_dao_get_last_date_template_was_used_returns_bst_date_from_stats_table(