From 8c5771401a755273af39282c6d7cf0baa8f053c0 Mon Sep 17 00:00:00 2001 From: Richard Chapman Date: Fri, 6 Oct 2017 17:08:06 +0100 Subject: [PATCH] A few code style tweaks to adhere to standard for better maintainable code. --- app/delivery/send_to_providers.py | 5 ++- tests/app/db.py | 35 ++++++++++---------- tests/app/delivery/test_send_to_providers.py | 14 +++++--- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/app/delivery/send_to_providers.py b/app/delivery/send_to_providers.py index 6ef710075..e0202c897 100644 --- a/app/delivery/send_to_providers.py +++ b/app/delivery/send_to_providers.py @@ -8,7 +8,10 @@ from notifications_utils.recipients import ( from notifications_utils.template import HTMLEmailTemplate, PlainTextEmailTemplate, SMSMessageTemplate from app import clients, statsd_client, create_uuid -from app.dao.notifications_dao import dao_update_notification, dao_get_notification_email_reply_for_notification +from app.dao.notifications_dao import ( + dao_update_notification, + dao_get_notification_email_reply_for_notification +) from app.dao.provider_details_dao import ( get_provider_details_by_notification_type, dao_toggle_sms_provider diff --git a/tests/app/db.py b/tests/app/db.py index a2b2b98c3..20eb3b91e 100644 --- a/tests/app/db.py +++ b/tests/app/db.py @@ -1,34 +1,33 @@ from datetime import datetime import uuid -from app import db, create_random_identifier +from app import db from app.dao.jobs_dao import dao_create_job from app.dao.service_inbound_api_dao import save_service_inbound_api from app.models import ( ApiKey, - EMAIL_TYPE, - SMS_TYPE, - KEY_TYPE_NORMAL, - Service, - User, - Template, - MonthlyBilling, - Notification, - ScheduledNotification, - ServicePermission, - Rate, - Job, InboundSms, InboundNumber, + Job, + MonthlyBilling, + Notification, + NotificationEmailReplyTo, Organisation, + Rate, + Service, + ServiceEmailReplyTo, + ServiceInboundApi, + ServiceLetterContact, + ScheduledNotification, + ServicePermission, + ServiceSmsSender, + Template, + User, EMAIL_TYPE, - LETTER_TYPE, SMS_TYPE, INBOUND_SMS_TYPE, - KEY_TYPE_NORMAL, - ServiceInboundApi, - ServiceEmailReplyTo, - ServiceLetterContact, ServiceSmsSender, NotificationEmailReplyTo) + KEY_TYPE_NORMAL +) from app.dao.users_dao import save_model_user from app.dao.notifications_dao import dao_create_notification, dao_created_scheduled_notification from app.dao.templates_dao import dao_create_template diff --git a/tests/app/delivery/test_send_to_providers.py b/tests/app/delivery/test_send_to_providers.py index 7b9c8cd8b..99fffc002 100644 --- a/tests/app/delivery/test_send_to_providers.py +++ b/tests/app/delivery/test_send_to_providers.py @@ -6,7 +6,6 @@ from unittest.mock import ANY, call import pytest from notifications_utils.recipients import validate_and_format_phone_number from flask import current_app -from requests_mock import mock import app from app import mmg_client, firetext_client @@ -22,10 +21,17 @@ from app.models import ( BRANDING_ORG, BRANDING_GOVUK, BRANDING_BOTH, - BRANDING_ORG_BANNER, NotificationEmailReplyTo) + BRANDING_ORG_BANNER +) -from tests.app.db import create_service, create_template, create_notification, create_inbound_number, \ - create_reply_to_email, create_reply_to_email_for_notification +from tests.app.db import ( + create_service, + create_template, + create_notification, + create_inbound_number, + create_reply_to_email, + create_reply_to_email_for_notification +) def test_should_return_highest_priority_active_provider(restore_provider_details):