mirror of https://github.com/langgenius/dify.git
fix CI
This commit is contained in:
parent
f5eb406394
commit
20bd059a6c
|
|
@ -9,6 +9,7 @@ from werkzeug.datastructures import FileStorage
|
||||||
|
|
||||||
from models.model import App
|
from models.model import App
|
||||||
from models.trigger import WorkflowWebhookTrigger
|
from models.trigger import WorkflowWebhookTrigger
|
||||||
|
from models.workflow import Workflow
|
||||||
from services.account_service import AccountService, TenantService
|
from services.account_service import AccountService, TenantService
|
||||||
from services.trigger.webhook_service import WebhookService
|
from services.trigger.webhook_service import WebhookService
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -584,7 +584,16 @@ class TestWorkflowService:
|
||||||
account = self._create_test_account(db_session_with_containers, fake)
|
account = self._create_test_account(db_session_with_containers, fake)
|
||||||
app = self._create_test_app(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"]}
|
features = {"features": ["feature1", "feature2"]}
|
||||||
# Don't pre-calculate hash, let the service generate it
|
# Don't pre-calculate hash, let the service generate it
|
||||||
unique_hash = None
|
unique_hash = None
|
||||||
|
|
@ -632,7 +641,21 @@ class TestWorkflowService:
|
||||||
# Get the actual hash that was generated
|
# Get the actual hash that was generated
|
||||||
original_hash = existing_workflow.unique_hash
|
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"]}
|
new_features = {"features": ["feature1", "feature2", "feature3"]}
|
||||||
|
|
||||||
environment_variables = []
|
environment_variables = []
|
||||||
|
|
@ -679,7 +702,16 @@ class TestWorkflowService:
|
||||||
# Get the actual hash that was generated
|
# Get the actual hash that was generated
|
||||||
original_hash = existing_workflow.unique_hash
|
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"]}
|
new_features = {"features": ["feature1"]}
|
||||||
# Use a different hash to trigger the error
|
# Use a different hash to trigger the error
|
||||||
mismatched_hash = "different_hash_12345"
|
mismatched_hash = "different_hash_12345"
|
||||||
|
|
|
||||||
|
|
@ -18,15 +18,14 @@ class TestToolTransformService:
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_external_service_dependencies(self):
|
def mock_external_service_dependencies(self):
|
||||||
"""Mock setup for external service dependencies."""
|
"""Mock setup for external service dependencies."""
|
||||||
with (
|
with patch("services.tools.tools_transform_service.dify_config") as mock_dify_config:
|
||||||
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
|
||||||
# Setup default mock returns
|
mock_dify_config.CONSOLE_API_URL = "https://console.example.com"
|
||||||
mock_dify_config.CONSOLE_API_URL = "https://console.example.com"
|
|
||||||
|
|
||||||
yield {
|
yield {
|
||||||
"dify_config": mock_dify_config,
|
"dify_config": mock_dify_config,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _create_test_tool_provider(
|
def _create_test_tool_provider(
|
||||||
self, db_session_with_containers, mock_external_service_dependencies, provider_type="api"
|
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:
|
with patch("services.tools.tools_transform_service.create_provider_encrypter") as mock_encrypter:
|
||||||
mock_encrypter_instance = Mock()
|
mock_encrypter_instance = Mock()
|
||||||
mock_encrypter_instance.decrypt.return_value = {"api_key": "decrypted_key"}
|
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)
|
mock_encrypter.return_value = (mock_encrypter_instance, None)
|
||||||
|
|
||||||
# Act: Execute the method under test
|
# Act: Execute the method under test
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue