diff --git a/app/authentication/auth.py b/app/authentication/auth.py index 7201ad56f..7a744c039 100644 --- a/app/authentication/auth.py +++ b/app/authentication/auth.py @@ -63,6 +63,7 @@ class InternalApiKey(): def requires_no_auth(): pass + def requires_admin_auth(): requires_internal_auth(current_app.config.get('ADMIN_CLIENT_ID')) diff --git a/app/celery/scheduled_tasks.py b/app/celery/scheduled_tasks.py index be09f3a74..15e5cff3d 100644 --- a/app/celery/scheduled_tasks.py +++ b/app/celery/scheduled_tasks.py @@ -7,7 +7,7 @@ from notifications_utils.clients.zendesk.zendesk_client import ( from sqlalchemy import between from sqlalchemy.exc import SQLAlchemyError -from app import db, notify_celery, zendesk_client +from app import notify_celery, zendesk_client from app.aws import s3 from app.celery.letters_pdf_tasks import get_pdf_for_templated_letter from app.celery.tasks import ( diff --git a/app/models.py b/app/models.py index d5e0d9e14..61f345b66 100644 --- a/app/models.py +++ b/app/models.py @@ -34,7 +34,6 @@ from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy.orm.collections import attribute_mapped_collection -from sqlalchemy.schema import Sequence from app import db, encryption from app.hashing import check_hash, hashpw @@ -43,7 +42,6 @@ from app.utils import ( DATETIME_FORMAT, DATETIME_FORMAT_NO_TIMEZONE, get_dt_string_or_none, - get_uuid_string_or_none, ) SMS_TYPE = 'sms' diff --git a/app/schemas.py b/app/schemas.py index 1317ab33d..b83382350 100644 --- a/app/schemas.py +++ b/app/schemas.py @@ -234,7 +234,7 @@ class ServiceSchema(BaseSchema, UUIDsAsStringsMixin): email_branding = field_for(models.Service, 'email_branding') organisation = field_for(models.Service, 'organisation') go_live_at = field_for(models.Service, 'go_live_at', format=DATETIME_FORMAT_NO_TIMEZONE) - + def get_letter_logo_filename(self, service): return service.letter_branding and service.letter_branding.filename diff --git a/app/utils.py b/app/utils.py index c04e37793..cc3368a67 100644 --- a/app/utils.py +++ b/app/utils.py @@ -95,7 +95,7 @@ def get_public_notify_type_text(notify_type, plural=False): notify_type_text = 'document' elif notify_type == PRECOMPILED_LETTER: notify_type_text = 'precompiled letter' - + return '{}{}'.format(notify_type_text, 's' if plural else '') diff --git a/tests/app/authentication/test_authentication.py b/tests/app/authentication/test_authentication.py index 55bc59fc3..fe9a6cd1d 100644 --- a/tests/app/authentication/test_authentication.py +++ b/tests/app/authentication/test_authentication.py @@ -3,7 +3,7 @@ import uuid import jwt import pytest -from flask import current_app, g, request +from flask import g, request from notifications_python_client.authentication import create_jwt_token from app import db @@ -24,7 +24,6 @@ from app.dao.api_key_dao import ( from app.dao.services_dao import dao_fetch_service_by_id from tests import ( create_admin_authorization_header, - create_internal_authorization_header, create_service_authorization_header, ) from tests.conftest import set_config_values diff --git a/tests/app/celery/test_scheduled_tasks.py b/tests/app/celery/test_scheduled_tasks.py index 652f79148..3b5c51ce8 100644 --- a/tests/app/celery/test_scheduled_tasks.py +++ b/tests/app/celery/test_scheduled_tasks.py @@ -35,7 +35,6 @@ from app.models import ( ) from tests.app import load_example_csv from tests.app.db import create_job, create_notification, create_template -from tests.conftest import set_config def _create_slow_delivery_notification(template, provider='mmg'): diff --git a/tests/app/db.py b/tests/app/db.py index 383a5019e..53c6f43fe 100644 --- a/tests/app/db.py +++ b/tests/app/db.py @@ -2,8 +2,6 @@ import random import uuid from datetime import date, datetime, timedelta -import pytest - from app import db from app.dao import fact_processing_time_dao from app.dao.email_branding_dao import dao_create_email_branding diff --git a/tests/app/service/test_rest.py b/tests/app/service/test_rest.py index 2236a4f29..13fe54dbe 100644 --- a/tests/app/service/test_rest.py +++ b/tests/app/service/test_rest.py @@ -28,7 +28,6 @@ from app.models import ( KEY_TYPE_TEST, LETTER_TYPE, NOTIFICATION_RETURNED_LETTER, - SERVICE_PERMISSION_TYPES, SMS_TYPE, UPLOAD_LETTERS, AnnualBilling, diff --git a/tests/conftest.py b/tests/conftest.py index 5678bfa3a..dabd3eb33 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,7 +5,7 @@ import pytest import sqlalchemy from alembic.command import upgrade from alembic.config import Config -from flask import Flask, current_app +from flask import Flask from app import create_app, db from app.dao.provider_details_dao import get_provider_details_by_identifier