mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-17 10:42:25 -05:00
add more debug to get e2e tests working
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from flask import current_app, g, request
|
from flask import current_app, g, request
|
||||||
@@ -15,6 +16,7 @@ from notifications_python_client.errors import (
|
|||||||
from sqlalchemy.orm.exc import NoResultFound
|
from sqlalchemy.orm.exc import NoResultFound
|
||||||
|
|
||||||
from app.serialised_models import SerialisedService
|
from app.serialised_models import SerialisedService
|
||||||
|
from app.utils import debug_not_production, hilite
|
||||||
from notifications_utils import request_helper
|
from notifications_utils import request_helper
|
||||||
|
|
||||||
# stvnrlly - this is silly, but bandit has a multiline string bug (https://github.com/PyCQA/bandit/issues/658)
|
# stvnrlly - this is silly, but bandit has a multiline string bug (https://github.com/PyCQA/bandit/issues/658)
|
||||||
@@ -165,6 +167,11 @@ def _decode_jwt_token(auth_token, api_keys, service_id=None):
|
|||||||
|
|
||||||
return api_key
|
return api_key
|
||||||
else:
|
else:
|
||||||
|
# We are hitting this in the e2e tests, debug why
|
||||||
|
debug_not_production(
|
||||||
|
f"auth token {auth_token} keys {api_keys} service_id={service_id}"
|
||||||
|
)
|
||||||
|
|
||||||
# service has API keys, but none matching the one the user provided
|
# service has API keys, but none matching the one the user provided
|
||||||
raise AuthError("Invalid token: API key not found", 403, service_id=service_id)
|
raise AuthError("Invalid token: API key not found", 403, service_id=service_id)
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ from app.user.users_schema import (
|
|||||||
post_verify_code_schema,
|
post_verify_code_schema,
|
||||||
post_verify_webauthn_schema,
|
post_verify_webauthn_schema,
|
||||||
)
|
)
|
||||||
from app.utils import hilite, url_with_token, utc_now
|
from app.utils import debug_not_production, hilite, url_with_token, utc_now
|
||||||
from notifications_utils.recipients import is_us_phone_number, use_numeric_sender
|
from notifications_utils.recipients import is_us_phone_number, use_numeric_sender
|
||||||
|
|
||||||
user_blueprint = Blueprint("user", __name__)
|
user_blueprint = Blueprint("user", __name__)
|
||||||
@@ -589,11 +589,6 @@ def get_user_login_gov_user():
|
|||||||
return jsonify(data=result)
|
return jsonify(data=result)
|
||||||
|
|
||||||
|
|
||||||
def debug_not_production(msg):
|
|
||||||
if os.getenv("NOTIFY_ENVIRONMENT") not in ["production"]:
|
|
||||||
current_app.logger.info(msg)
|
|
||||||
|
|
||||||
|
|
||||||
@user_blueprint.route("/email", methods=["POST"])
|
@user_blueprint.route("/email", methods=["POST"])
|
||||||
def fetch_user_by_email():
|
def fetch_user_by_email():
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
import os
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
|
|
||||||
from flask import url_for
|
from flask import current_app, url_for
|
||||||
from sqlalchemy import func
|
from sqlalchemy import func
|
||||||
|
|
||||||
from notifications_utils.template import HTMLEmailTemplate, SMSMessageTemplate
|
from notifications_utils.template import HTMLEmailTemplate, SMSMessageTemplate
|
||||||
@@ -125,3 +126,8 @@ def naive_utcnow():
|
|||||||
|
|
||||||
def utc_now():
|
def utc_now():
|
||||||
return naive_utcnow()
|
return naive_utcnow()
|
||||||
|
|
||||||
|
|
||||||
|
def debug_not_production(msg):
|
||||||
|
if os.getenv("NOTIFY_ENVIRONMENT") not in ["production"]:
|
||||||
|
current_app.logger.info(msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user