From 20bd059a6ca5e04afe0a1fa406818abcb4488999 Mon Sep 17 00:00:00 2001 From: hjlarry Date: Thu, 30 Oct 2025 17:58:59 +0800 Subject: [PATCH] fix CI --- .../services/test_webhook_service.py | 1 + .../services/test_workflow_service.py | 38 +++++++++++++++++-- .../tools/test_tools_transform_service.py | 17 ++++----- 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/api/tests/test_containers_integration_tests/services/test_webhook_service.py b/api/tests/test_containers_integration_tests/services/test_webhook_service.py index f4e6d8447f..6c31e002bb 100644 --- a/api/tests/test_containers_integration_tests/services/test_webhook_service.py +++ b/api/tests/test_containers_integration_tests/services/test_webhook_service.py @@ -9,6 +9,7 @@ from werkzeug.datastructures import FileStorage from models.model import App from models.trigger import WorkflowWebhookTrigger +from models.workflow import Workflow from services.account_service import AccountService, TenantService from services.trigger.webhook_service import WebhookService diff --git a/api/tests/test_containers_integration_tests/services/test_workflow_service.py b/api/tests/test_containers_integration_tests/services/test_workflow_service.py index 4741eba1f5..5dfd1b367e 100644 --- a/api/tests/test_containers_integration_tests/services/test_workflow_service.py +++ b/api/tests/test_containers_integration_tests/services/test_workflow_service.py @@ -584,7 +584,16 @@ class TestWorkflowService: account = self._create_test_account(db_session_with_containers, fake) app = self._create_test_app(db_session_with_containers, fake) - graph = {"nodes": [{"id": "start", "type": "start"}], "edges": []} + graph = { + "nodes": [ + { + "id": "start", + "type": "start", + "data": {"type": "start", "title": "Start"}, + } + ], + "edges": [], + } features = {"features": ["feature1", "feature2"]} # Don't pre-calculate hash, let the service generate it unique_hash = None @@ -632,7 +641,21 @@ class TestWorkflowService: # Get the actual hash that was generated original_hash = existing_workflow.unique_hash - new_graph = {"nodes": [{"id": "start", "type": "start"}, {"id": "end", "type": "end"}], "edges": []} + new_graph = { + "nodes": [ + { + "id": "start", + "type": "start", + "data": {"type": "start", "title": "Start"}, + }, + { + "id": "end", + "type": "end", + "data": {"type": "end", "title": "End"}, + }, + ], + "edges": [], + } new_features = {"features": ["feature1", "feature2", "feature3"]} environment_variables = [] @@ -679,7 +702,16 @@ class TestWorkflowService: # Get the actual hash that was generated original_hash = existing_workflow.unique_hash - new_graph = {"nodes": [{"id": "start", "type": "start"}], "edges": []} + new_graph = { + "nodes": [ + { + "id": "start", + "type": "start", + "data": {"type": "start", "title": "Start"}, + } + ], + "edges": [], + } new_features = {"features": ["feature1"]} # Use a different hash to trigger the error mismatched_hash = "different_hash_12345" diff --git a/api/tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py b/api/tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py index 08c7d07620..9b86671954 100644 --- a/api/tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py +++ b/api/tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py @@ -18,15 +18,14 @@ class TestToolTransformService: @pytest.fixture def mock_external_service_dependencies(self): """Mock setup for external service dependencies.""" - with ( - patch("services.tools.tools_transform_service.dify_config") as mock_dify_config, - ): - # Setup default mock returns - mock_dify_config.CONSOLE_API_URL = "https://console.example.com" + with patch("services.tools.tools_transform_service.dify_config") as mock_dify_config: + with patch("services.plugin.plugin_service.dify_config", new=mock_dify_config): + # Setup default mock returns + mock_dify_config.CONSOLE_API_URL = "https://console.example.com" - yield { - "dify_config": mock_dify_config, - } + yield { + "dify_config": mock_dify_config, + } def _create_test_tool_provider( self, db_session_with_containers, mock_external_service_dependencies, provider_type="api" @@ -522,7 +521,7 @@ class TestToolTransformService: with patch("services.tools.tools_transform_service.create_provider_encrypter") as mock_encrypter: mock_encrypter_instance = Mock() mock_encrypter_instance.decrypt.return_value = {"api_key": "decrypted_key"} - mock_encrypter_instance.mask_tool_credentials.return_value = {"api_key": ""} + mock_encrypter_instance.mask_plugin_credentials.return_value = {"api_key": ""} mock_encrypter.return_value = (mock_encrypter_instance, None) # Act: Execute the method under test