mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-10 23:32:27 -05:00
cleaner flake8 cleaning
This commit is contained in:
@@ -52,16 +52,16 @@ def process_ses_results(self, response):
|
|||||||
message_time = iso8601.parse_date(ses_message["mail"]["timestamp"]).replace(tzinfo=None)
|
message_time = iso8601.parse_date(ses_message["mail"]["timestamp"]).replace(tzinfo=None)
|
||||||
if datetime.utcnow() - message_time < timedelta(minutes=5):
|
if datetime.utcnow() - message_time < timedelta(minutes=5):
|
||||||
current_app.logger.info(
|
current_app.logger.info(
|
||||||
f"notification not found for reference: {reference} \
|
f"notification not found for reference: {reference}"
|
||||||
(while attempting update to {notification_status}). "
|
f"(while attempting update to {notification_status}). "
|
||||||
f"Callback may have arrived before notification was \
|
f"Callback may have arrived before notification was"
|
||||||
persisted to the DB. Adding task to retry queue"
|
f"persisted to the DB. Adding task to retry queue"
|
||||||
)
|
)
|
||||||
self.retry(queue=QueueNames.RETRY)
|
self.retry(queue=QueueNames.RETRY)
|
||||||
else:
|
else:
|
||||||
current_app.logger.warning(
|
current_app.logger.warning(
|
||||||
f"notification not found for reference: {reference} \
|
f"notification not found for reference: {reference} "
|
||||||
(while attempting update to {notification_status})"
|
f"(while attempting update to {notification_status})"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ from sqlalchemy.sql.expression import and_, asc, case, func
|
|||||||
from app import db
|
from app import db
|
||||||
from app.dao.dao_utils import VersionOptions, autocommit, version_class
|
from app.dao.dao_utils import VersionOptions, autocommit, version_class
|
||||||
from app.dao.date_util import get_current_financial_year
|
from app.dao.date_util import get_current_financial_year
|
||||||
# from app.dao.email_branding_dao import dao_get_email_branding_by_name
|
|
||||||
# from app.dao.letter_branding_dao import dao_get_letter_branding_by_name
|
|
||||||
from app.dao.organisation_dao import dao_get_organisation_by_email_address
|
from app.dao.organisation_dao import dao_get_organisation_by_email_address
|
||||||
from app.dao.service_sms_sender_dao import insert_service_sms_sender
|
from app.dao.service_sms_sender_dao import insert_service_sms_sender
|
||||||
from app.dao.service_user_dao import dao_get_service_user
|
from app.dao.service_user_dao import dao_get_service_user
|
||||||
@@ -46,7 +44,7 @@ from app.models import (
|
|||||||
User,
|
User,
|
||||||
VerifyCode,
|
VerifyCode,
|
||||||
)
|
)
|
||||||
from app.utils import ( # email_address_is_nhs,
|
from app.utils import (
|
||||||
escape_special_characters,
|
escape_special_characters,
|
||||||
get_archived_db_column_value,
|
get_archived_db_column_value,
|
||||||
get_london_midnight_in_utc,
|
get_london_midnight_in_utc,
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ from app.inbound_sms.inbound_sms_schemas import (
|
|||||||
)
|
)
|
||||||
from app.schema_validation import validate
|
from app.schema_validation import validate
|
||||||
|
|
||||||
# from notifications_utils.recipients import try_validate_and_format_phone_number
|
|
||||||
|
|
||||||
|
|
||||||
inbound_sms = Blueprint(
|
inbound_sms = Blueprint(
|
||||||
'inbound_sms',
|
'inbound_sms',
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
from flask import Blueprint # , json, jsonify, request
|
from flask import Blueprint
|
||||||
|
|
||||||
# from app.celery.process_sms_client_response_tasks import (
|
|
||||||
# process_sms_client_response,
|
|
||||||
# )
|
|
||||||
# from app.config import QueueNames
|
|
||||||
from app.errors import register_errors
|
from app.errors import register_errors
|
||||||
|
|
||||||
sms_callback_blueprint = Blueprint("sms_callback", __name__, url_prefix="/notifications/sms")
|
sms_callback_blueprint = Blueprint("sms_callback", __name__, url_prefix="/notifications/sms")
|
||||||
|
|||||||
@@ -197,11 +197,8 @@ def test_ses_callback_should_log_if_notification_is_missing(client, _notify_db,
|
|||||||
with freeze_time('2017-11-17T12:34:03.646Z'):
|
with freeze_time('2017-11-17T12:34:03.646Z'):
|
||||||
assert process_ses_results(ses_notification_callback(reference='ref')) is None
|
assert process_ses_results(ses_notification_callback(reference='ref')) is None
|
||||||
assert mock_retry.call_count == 0
|
assert mock_retry.call_count == 0
|
||||||
# the multiline indent must be the same as in the application code
|
|
||||||
# for the assertion to completely match
|
|
||||||
mock_logger.assert_called_once_with(
|
mock_logger.assert_called_once_with(
|
||||||
'notification not found for reference: ref \
|
'notification not found for reference: ref (while attempting update to delivered)'
|
||||||
(while attempting update to delivered)'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user