use debug controller for test raise error api method per jakub suggestion

This commit is contained in:
burnettk 2023-04-27 11:13:11 -04:00
parent 4c64c466ae
commit 05d3184e19
4 changed files with 26 additions and 22 deletions

View File

@ -148,9 +148,9 @@ paths:
schema: schema:
$ref: "#/components/schemas/OkTrue" $ref: "#/components/schemas/OkTrue"
/status/test-raise-error: /debug/test-raise-error:
get: 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 summary: Returns an unhandled exception that should notify sentry, if sentry is configured
tags: tags:
- Status - Status

View File

@ -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.")

View File

@ -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

View File

@ -2,34 +2,15 @@ from flask.app import Flask
from flask.testing import FlaskClient from flask.testing import FlaskClient
from tests.spiffworkflow_backend.helpers.base_test import BaseTest from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from spiffworkflow_backend.models.user import UserModel
class TestHealthController(BaseTest): class TestHealthController(BaseTest):
"""TestUsersController."""
def test_status( def test_status(
self, self,
app: Flask, app: Flask,
client: FlaskClient, client: FlaskClient,
with_db_and_bpmn_file_cleanup: None, with_db_and_bpmn_file_cleanup: None,
with_super_admin_user: UserModel,
) -> None: ) -> None:
"""Test_user_search_returns_a_user."""
response = client.get( response = client.get(
f"/v1.0/status", "/v1.0/status",
) )
assert response.status_code == 200 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