diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_service_task_delegate.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_service_task_delegate.py index 6de51b8ad..188722fa9 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_service_task_delegate.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_service_task_delegate.py @@ -1,8 +1,8 @@ """Test_various_bpmn_constructs.""" 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,8 +37,12 @@ class TestServiceTaskDelegate(BaseTest): def test_invalid_call_returns_good_error_message( self, app: Flask, with_db_and_bpmn_file_cleanup: None ) -> None: - with pytest.raises(ConnectorProxyError) as ae: - ServiceTaskDelegate.call_connector("my_invalid_operation", {}, {}) + 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 = "" + with pytest.raises(ConnectorProxyError) as ae: + ServiceTaskDelegate.call_connector("my_invalid_operation", {}, {}) assert "404" in str(ae) assert "The service did not find the requested resource." in str(ae) assert (