From 8354f23ce365d4e0452178bf82901032e4c6857f Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 27 Apr 2023 09:14:41 -0400 Subject: [PATCH 1/3] Update text on interstitial page --- spiffworkflow-frontend/src/routes/ProcessInterstitial.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spiffworkflow-frontend/src/routes/ProcessInterstitial.tsx b/spiffworkflow-frontend/src/routes/ProcessInterstitial.tsx index 0c18a213..3a74abb5 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInterstitial.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInterstitial.tsx @@ -141,7 +141,7 @@ export default function ProcessInterstitial() {

Waiting on Someone Else

This next task is assigned to a different person or team. There is - no action for you take at this time. + no action for you to take at this time.

); From 4c64c466ae2d14d5df73bae327442d281d10de1b Mon Sep 17 00:00:00 2001 From: burnettk Date: Thu, 27 Apr 2023 11:05:24 -0400 Subject: [PATCH 2/3] add test-raise-error endpoint for sentry testing, etc --- .../src/spiffworkflow_backend/api.yml | 15 ++++++++ .../routes/health_controller.py | 4 +++ .../services/authorization_service.py | 1 + .../integration/test_health_controller.py | 35 +++++++++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_health_controller.py diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml index b1eb5cc4..664b9186 100755 --- a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml @@ -148,6 +148,21 @@ paths: schema: $ref: "#/components/schemas/OkTrue" + /status/test-raise-error: + get: + operationId: spiffworkflow_backend.routes.health_controller.test_raise_error + summary: Returns an unhandled exception that should notify sentry, if sentry is configured + tags: + - Status + responses: + "500": + description: The server raises a test error as expected. + content: + application/json: + schema: + $ref: "#/components/schemas/OkTrue" + + /process-groups: parameters: - name: process_group_identifier diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/health_controller.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/health_controller.py index 2cb4092b..05408a4f 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/health_controller.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/health_controller.py @@ -9,3 +9,7 @@ def status() -> Response: """Status.""" ProcessInstanceModel.query.filter().first() return make_response({"ok": True}, 200) + + +def test_raise_error() -> Response: + raise Exception("This exception was generated by /status/test-raise-error for testing purposes. Please ignore.") diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/authorization_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/authorization_service.py index 85bb6fda..eb2478a5 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/authorization_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/authorization_service.py @@ -310,6 +310,7 @@ class AuthorizationService: swagger_functions = ["get_json_spec"] authentication_exclusion_list = [ "status", + "test_raise_error", "authentication_callback", "github_webhook_receive", ] diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_health_controller.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_health_controller.py new file mode 100644 index 00000000..4958dcdb --- /dev/null +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_health_controller.py @@ -0,0 +1,35 @@ +from flask.app import Flask +from flask.testing import FlaskClient +from tests.spiffworkflow_backend.helpers.base_test import BaseTest + +from spiffworkflow_backend.models.user import UserModel + + +class TestHealthController(BaseTest): + """TestUsersController.""" + + def test_status( + self, + app: Flask, + client: FlaskClient, + with_db_and_bpmn_file_cleanup: None, + with_super_admin_user: UserModel, + ) -> None: + """Test_user_search_returns_a_user.""" + response = client.get( + f"/v1.0/status", + ) + assert response.status_code == 200 + + def test_test_raise_error( + self, + app: Flask, + client: FlaskClient, + with_db_and_bpmn_file_cleanup: None, + with_super_admin_user: UserModel, + ) -> None: + """Test_user_search_returns_a_user.""" + response = client.get( + f"/v1.0/status/test-raise-error", + ) + assert response.status_code == 500 From 05d3184e196061eaf0387d053e1c184ec2314961 Mon Sep 17 00:00:00 2001 From: burnettk Date: Thu, 27 Apr 2023 11:13:11 -0400 Subject: [PATCH 3/3] use debug controller for test raise error api method per jakub suggestion --- .../src/spiffworkflow_backend/api.yml | 4 ++-- .../routes/debug_controller.py | 6 ++++++ .../integration/test_debug_controller.py | 17 +++++++++++++++ .../integration/test_health_controller.py | 21 +------------------ 4 files changed, 26 insertions(+), 22 deletions(-) create mode 100644 spiffworkflow-backend/src/spiffworkflow_backend/routes/debug_controller.py create mode 100644 spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_debug_controller.py diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml index 664b9186..30b5812a 100755 --- a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml @@ -148,9 +148,9 @@ paths: schema: $ref: "#/components/schemas/OkTrue" - /status/test-raise-error: + /debug/test-raise-error: get: - operationId: spiffworkflow_backend.routes.health_controller.test_raise_error + operationId: spiffworkflow_backend.routes.debug_controller.test_raise_error summary: Returns an unhandled exception that should notify sentry, if sentry is configured tags: - Status diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/debug_controller.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/debug_controller.py new file mode 100644 index 00000000..29a81447 --- /dev/null +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/debug_controller.py @@ -0,0 +1,6 @@ +"""APIs for dealing with process groups, process models, and process instances.""" +from flask.wrappers import Response + + +def test_raise_error() -> Response: + raise Exception("This exception was generated by /debug/test-raise-error for testing purposes. Please ignore.") diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_debug_controller.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_debug_controller.py new file mode 100644 index 00000000..84fcafb3 --- /dev/null +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_debug_controller.py @@ -0,0 +1,17 @@ +from flask.app import Flask +from flask.testing import FlaskClient +from tests.spiffworkflow_backend.helpers.base_test import BaseTest + + +class TestDebugController(BaseTest): + + def test_test_raise_error( + self, + app: Flask, + client: FlaskClient, + with_db_and_bpmn_file_cleanup: None, + ) -> None: + response = client.get( + "/v1.0/debug/test-raise-error", + ) + assert response.status_code == 500 diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_health_controller.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_health_controller.py index 4958dcdb..75002867 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_health_controller.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_health_controller.py @@ -2,34 +2,15 @@ from flask.app import Flask from flask.testing import FlaskClient from tests.spiffworkflow_backend.helpers.base_test import BaseTest -from spiffworkflow_backend.models.user import UserModel - class TestHealthController(BaseTest): - """TestUsersController.""" - def test_status( self, app: Flask, client: FlaskClient, with_db_and_bpmn_file_cleanup: None, - with_super_admin_user: UserModel, ) -> None: - """Test_user_search_returns_a_user.""" response = client.get( - f"/v1.0/status", + "/v1.0/status", ) assert response.status_code == 200 - - def test_test_raise_error( - self, - app: Flask, - client: FlaskClient, - with_db_and_bpmn_file_cleanup: None, - with_super_admin_user: UserModel, - ) -> None: - """Test_user_search_returns_a_user.""" - response = client.get( - f"/v1.0/status/test-raise-error", - ) - assert response.status_code == 500