mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-11 10:28:55 -04:00
initial
This commit is contained in:
@@ -2,6 +2,9 @@ import os
|
||||
import uuid
|
||||
|
||||
from flask import current_app, g, request
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
|
||||
from app.serialised_models import SerialisedService
|
||||
from notifications_python_client.authentication import (
|
||||
decode_jwt_token,
|
||||
get_token_issuer,
|
||||
@@ -13,9 +16,6 @@ from notifications_python_client.errors import (
|
||||
TokenExpiredError,
|
||||
TokenIssuerError,
|
||||
)
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
|
||||
from app.serialised_models import SerialisedService
|
||||
from notifications_utils import request_helper
|
||||
|
||||
# stvnrlly - this is silly, but bandit has a multiline string bug (https://github.com/PyCQA/bandit/issues/658)
|
||||
|
||||
+1
-1
@@ -11,7 +11,6 @@ import flask
|
||||
from click_datetime import Datetime as click_dt
|
||||
from faker import Faker
|
||||
from flask import current_app, json
|
||||
from notifications_python_client.authentication import create_jwt_token
|
||||
from sqlalchemy import and_, select, text, update
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
@@ -58,6 +57,7 @@ from app.models import (
|
||||
User,
|
||||
)
|
||||
from app.utils import utc_now
|
||||
from notifications_python_client.authentication import create_jwt_token
|
||||
from notifications_utils.recipients import RecipientCSV
|
||||
from notifications_utils.template import SMSMessageTemplate
|
||||
from tests.app.db import (
|
||||
|
||||
@@ -64,7 +64,9 @@ def get_notification_by_id(notification_id):
|
||||
schema = PublicNotificationResponseSchema()
|
||||
schema.context = {
|
||||
"notification_instance": notification,
|
||||
"template_subject": getattr(template, "subject", None) if hasattr(template, "subject") else None
|
||||
"template_subject": (
|
||||
getattr(template, "subject", None) if hasattr(template, "subject") else None
|
||||
),
|
||||
}
|
||||
serialized = schema.dump(notification)
|
||||
|
||||
|
||||
Generated
+4
-28
@@ -1248,17 +1248,6 @@ idna = ["idna (>=3.7)"]
|
||||
trio = ["trio (>=0.23)"]
|
||||
wmi = ["wmi (>=1.5.1)"]
|
||||
|
||||
[[package]]
|
||||
name = "docopt"
|
||||
version = "0.6.2"
|
||||
description = "Pythonic argument parser, that will make you smile"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
groups = ["main"]
|
||||
files = [
|
||||
{file = "docopt-0.6.2.tar.gz", hash = "sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "docutils"
|
||||
version = "0.19"
|
||||
@@ -2428,8 +2417,11 @@ files = [
|
||||
{file = "lxml-5.4.0-cp36-cp36m-win_amd64.whl", hash = "sha256:7ce1a171ec325192c6a636b64c94418e71a1964f56d002cc28122fceff0b6121"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:795f61bcaf8770e1b37eec24edf9771b307df3af74d1d6f27d812e15a9ff3872"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:29f451a4b614a7b5b6c2e043d7b64a15bd8304d7e767055e8ab68387a8cacf4e"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:891f7f991a68d20c75cb13c5c9142b2a3f9eb161f1f12a9489c82172d1f133c0"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4aa412a82e460571fad592d0f93ce9935a20090029ba08eca05c614f99b0cc92"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-manylinux_2_28_aarch64.whl", hash = "sha256:ac7ba71f9561cd7d7b55e1ea5511543c0282e2b6450f122672a2694621d63b7e"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-manylinux_2_28_x86_64.whl", hash = "sha256:c5d32f5284012deaccd37da1e2cd42f081feaa76981f0eaa474351b68df813c5"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:ce31158630a6ac85bddd6b830cffd46085ff90498b397bd0a259f59d27a12188"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:31e63621e073e04697c1b2d23fcb89991790eef370ec37ce4d5d469f40924ed6"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-win32.whl", hash = "sha256:be2ba4c3c5b7900246a8f866580700ef0d538f2ca32535e991027bdaba944063"},
|
||||
{file = "lxml-5.4.0-cp37-cp37m-win_amd64.whl", hash = "sha256:09846782b1ef650b321484ad429217f5154da4d6e786636c38e434fa32e94e49"},
|
||||
@@ -3023,22 +3015,6 @@ files = [
|
||||
{file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notifications-python-client"
|
||||
version = "10.0.1"
|
||||
description = "Python API client for GOV.UK Notify."
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
groups = ["main"]
|
||||
files = [
|
||||
{file = "notifications_python_client-10.0.1-py3-none-any.whl", hash = "sha256:00d88eacb6fd6eb0467d7396a7e23677194cfebe0ebd88de2efa031fb51eb23f"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
docopt = ">=0.3.0"
|
||||
PyJWT = ">=1.5.1"
|
||||
requests = ">=2.0.0"
|
||||
|
||||
[[package]]
|
||||
name = "numpy"
|
||||
version = "2.3.0"
|
||||
@@ -5584,4 +5560,4 @@ cffi = ["cffi (>=1.11)"]
|
||||
[metadata]
|
||||
lock-version = "2.1"
|
||||
python-versions = "^3.12.2"
|
||||
content-hash = "a6dda32f29ef467209d96f03119cad2e6fcae93f9c9835d7129e455767c4932d"
|
||||
content-hash = "12c335252e311800834363ac06d8ed34af3aff9c7e1a0c108239a9e0221cb5fa"
|
||||
|
||||
@@ -39,7 +39,6 @@ lxml = "==5.4.0"
|
||||
marshmallow = "^4.0.0"
|
||||
marshmallow-sqlalchemy = "^1.4.2"
|
||||
newrelic = "*"
|
||||
notifications-python-client = "==10.0.1"
|
||||
packaging = "==25.0"
|
||||
poetry-dotenv-plugin = "==0.2.0"
|
||||
psycopg2-binary = "==2.9.10"
|
||||
|
||||
+1
-1
@@ -1,7 +1,6 @@
|
||||
import uuid
|
||||
|
||||
from flask import current_app
|
||||
from notifications_python_client.authentication import create_jwt_token
|
||||
from sqlalchemy import select
|
||||
|
||||
from app import db
|
||||
@@ -9,6 +8,7 @@ from app.dao.api_key_dao import save_model_api_key
|
||||
from app.dao.services_dao import dao_fetch_service_by_id
|
||||
from app.enums import KeyType
|
||||
from app.models import ApiKey
|
||||
from notifications_python_client.authentication import create_jwt_token
|
||||
|
||||
|
||||
def create_service_authorization_header(service_id, key_type=KeyType.NORMAL):
|
||||
|
||||
@@ -4,7 +4,6 @@ import uuid
|
||||
import jwt
|
||||
import pytest
|
||||
from flask import g, request
|
||||
from notifications_python_client.authentication import create_jwt_token
|
||||
|
||||
from app import db
|
||||
from app.authentication.auth import (
|
||||
@@ -18,6 +17,7 @@ from app.authentication.auth import (
|
||||
)
|
||||
from app.dao.api_key_dao import expire_api_key, get_model_api_keys, get_unsigned_secrets
|
||||
from app.dao.services_dao import dao_fetch_service_by_id
|
||||
from notifications_python_client.authentication import create_jwt_token
|
||||
from tests import create_admin_authorization_header, create_service_authorization_header
|
||||
from tests.conftest import set_config_values
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@ import uuid
|
||||
import pytest
|
||||
from flask import current_app, json
|
||||
from freezegun import freeze_time
|
||||
from notifications_python_client.authentication import create_jwt_token
|
||||
|
||||
from app.dao.api_key_dao import save_model_api_key
|
||||
from app.dao.notifications_dao import dao_update_notification
|
||||
from app.dao.templates_dao import dao_update_template
|
||||
from app.enums import KeyType, NotificationStatus, NotificationType, TemplateType
|
||||
from app.models import ApiKey
|
||||
from notifications_python_client.authentication import create_jwt_token
|
||||
from tests import create_service_authorization_header
|
||||
from tests.app.db import create_api_key, create_notification
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import string
|
||||
import pytest
|
||||
from flask import current_app, json
|
||||
from freezegun import freeze_time
|
||||
from notifications_python_client.authentication import create_jwt_token
|
||||
from sqlalchemy import func, select
|
||||
|
||||
import app
|
||||
@@ -17,6 +16,7 @@ from app.enums import KeyType, NotificationType, TemplateType
|
||||
from app.errors import InvalidRequest
|
||||
from app.models import ApiKey, Notification, NotificationHistory, Template
|
||||
from app.service.send_notification import send_one_off_notification
|
||||
from notifications_python_client.authentication import create_jwt_token
|
||||
from notifications_utils import SMS_CHAR_COUNT_LIMIT
|
||||
from tests import create_service_authorization_header
|
||||
from tests.app.db import (
|
||||
|
||||
Reference in New Issue
Block a user