pyl
This commit is contained in:
parent
2814550872
commit
29f96ff68d
|
@ -91,7 +91,10 @@ def setup_config(app: Flask) -> None:
|
|||
# This allows config/testing.py or instance/config.py to override the default config
|
||||
if "ENV_IDENTIFIER" in app.config and app.config["ENV_IDENTIFIER"] == "testing":
|
||||
app.config.from_pyfile("config/testing.py", silent=True)
|
||||
elif "ENV_IDENTIFIER" in app.config and app.config["ENV_IDENTIFIER"] == "unit_testing":
|
||||
elif (
|
||||
"ENV_IDENTIFIER" in app.config
|
||||
and app.config["ENV_IDENTIFIER"] == "unit_testing"
|
||||
):
|
||||
app.config.from_pyfile("config/unit_testing.py", silent=True)
|
||||
else:
|
||||
app.config.from_pyfile(f"{app.instance_path}/config.py", silent=True)
|
||||
|
|
|
@ -45,7 +45,7 @@ class ServiceTaskDelegate:
|
|||
|
||||
@staticmethod
|
||||
def get_message_for_status(code: int) -> str:
|
||||
"""Given a code like 404, return a string like 'The requested resource was not found.'"""
|
||||
"""Given a code like 404, return a string like: The requested resource was not found."""
|
||||
msg = f"HTTP Status Code {code}."
|
||||
if code == 301:
|
||||
msg = (
|
||||
|
@ -110,10 +110,10 @@ class ServiceTaskDelegate:
|
|||
parsed_response = {}
|
||||
|
||||
if proxied_response.status_code >= 300:
|
||||
error = f"Received an unexpected response from the service : "
|
||||
error += ServiceTaskDelegate.get_message_for_status(
|
||||
message = ServiceTaskDelegate.get_message_for_status(
|
||||
proxied_response.status_code
|
||||
)
|
||||
error = f"Received an unexpected response from the service : {message}"
|
||||
if "error" in parsed_response:
|
||||
error += parsed_response["error"]
|
||||
if json_parse_error:
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
"""Test_various_bpmn_constructs."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from flask.app import Flask
|
||||
from unittest.mock import Mock, patch
|
||||
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
|
||||
|
||||
from spiffworkflow_backend.services.secret_service import SecretService
|
||||
from spiffworkflow_backend.services.service_task_service import ConnectorProxyError
|
||||
from spiffworkflow_backend.services.service_task_service import ServiceTaskDelegate
|
||||
|
@ -37,7 +39,7 @@ class TestServiceTaskDelegate(BaseTest):
|
|||
def test_invalid_call_returns_good_error_message(
|
||||
self, app: Flask, with_db_and_bpmn_file_cleanup: None
|
||||
) -> None:
|
||||
with patch('requests.post') as mock_post:
|
||||
with patch("requests.post") as mock_post:
|
||||
mock_post.return_value.status_code = 404
|
||||
mock_post.return_value.ok = True
|
||||
mock_post.return_value.json.return_value = ""
|
||||
|
|
Loading…
Reference in New Issue