mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-09 19:04:33 -04:00
Localize notification_utils to the admin
This changeset pulls in all of the notification_utils code directly into the admin and removes it as an external dependency. We are doing this to cut down on operational maintenance of the project and will begin removing parts of it no longer needed for the admin. Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
This commit is contained in:
32
tests/notifications_utils/test_request_id.py
Normal file
32
tests/notifications_utils/test_request_id.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from notifications_utils import request_helper
|
||||
|
||||
|
||||
def test_request_id_is_set_on_response(app):
|
||||
request_helper.init_app(app)
|
||||
client = app.test_client()
|
||||
|
||||
with app.app_context():
|
||||
response = client.get(
|
||||
"/", headers={"X-B3-TraceId": "generated", "X-B3-SpanId": "generated"}
|
||||
)
|
||||
assert response.headers["X-B3-TraceId"] == "generated"
|
||||
assert response.headers["X-B3-SpanId"] == "generated"
|
||||
|
||||
|
||||
def test_request_id_is_set_on_error_response(app):
|
||||
request_helper.init_app(app)
|
||||
client = app.test_client()
|
||||
# turn off DEBUG so that the flask default error handler gets triggered
|
||||
app.config["DEBUG"] = False
|
||||
|
||||
@app.route("/")
|
||||
def error_route():
|
||||
raise Exception()
|
||||
|
||||
with app.app_context():
|
||||
response = client.get(
|
||||
"/", headers={"X-B3-TraceId": "generated", "X-B3-SpanId": "generated"}
|
||||
)
|
||||
assert response.status_code == 500
|
||||
assert response.headers["X-B3-TraceId"] == "generated"
|
||||
assert response.headers["X-B3-SpanId"] == "generated"
|
||||
Reference in New Issue
Block a user