Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

test: drop redundant created_at/updated_at in unit tests (#42989) (#42990)

Sourav Rajvi725611b2e9a4
diff --git a/api/tests/unit_tests/controllers/console/snippets/test_snippet_workflow.py b/api/tests/unit_tests/controllers/console/snippets/test_snippet_workflow.py
index a7424b2c5a5..1cc40426f48 100644
--- a/api/tests/unit_tests/controllers/console/snippets/test_snippet_workflow.py
+++ b/api/tests/unit_tests/controllers/console/snippets/test_snippet_workflow.py
@@ -1,7 +1,6 @@
from __future__ import annotations
import json
-from datetime import datetime
from inspect import unwrap
from unittest.mock import Mock
@@ -53,8 +52,6 @@ def _workflow(**overrides) -> Workflow:
rag_pipeline_variables=[],
)
workflow.id = "workflow-1"
- workflow.created_at = datetime(2024, 1, 1)
- workflow.updated_at = datetime(2024, 1, 1)
for name, value in overrides.items():
setattr(workflow, name, value)
return workflow
@@ -249,7 +246,7 @@ def test_published_workflow_post_returns_success(
snippet = _snippet()
sqlite_session.add(snippet)
sqlite_session.commit()
- workflow = _workflow(created_at=datetime(2026, 8, 17, 12, 0, 0))
+ workflow = _workflow()
monkeypatch.setattr(snippet_workflow_module.SnippetService, "publish_workflow", Mock(return_value=workflow))
api = snippet_workflow_module.SnippetPublishedWorkflowApi()
diff --git a/api/tests/unit_tests/repositories/test_data_source_api_key_auth_repository.py b/api/tests/unit_tests/repositories/test_data_source_api_key_auth_repository.py
index 09c23b02898..d2a4742aa3e 100644
--- a/api/tests/unit_tests/repositories/test_data_source_api_key_auth_repository.py
+++ b/api/tests/unit_tests/repositories/test_data_source_api_key_auth_repository.py
@@ -1,5 +1,4 @@
import json
-from datetime import datetime
from sqlalchemy import select
from sqlalchemy.orm import Session, sessionmaker
@@ -23,8 +22,6 @@ def _binding(
disabled=disabled,
)
binding.id = binding_id
- binding.created_at = datetime(2026, 1, 1)
- binding.updated_at = datetime(2026, 1, 2)
return binding
diff --git a/api/tests/unit_tests/services/test_conversation_service.py b/api/tests/unit_tests/services/test_conversation_service.py
index bae347f1c1a..0a34f832425 100644
--- a/api/tests/unit_tests/services/test_conversation_service.py
+++ b/api/tests/unit_tests/services/test_conversation_service.py
@@ -556,7 +556,6 @@ class TestConversationServiceHelpers:
"""
# Arrange
conversation = ConversationServiceTestDataFactory.create_conversation()
- conversation.updated_at = naive_utc_now()
# Act
condition = ConversationService._build_filter_condition(
@@ -577,7 +576,6 @@ class TestConversationServiceHelpers:
"""
# Arrange
conversation = ConversationServiceTestDataFactory.create_conversation()
- conversation.created_at = naive_utc_now()
# Act
condition = ConversationService._build_filter_condition(
diff --git a/api/tests/unit_tests/services/test_webhook_service.py b/api/tests/unit_tests/services/test_webhook_service.py
index 8d3257d4905..09954f977b0 100644
--- a/api/tests/unit_tests/services/test_webhook_service.py
+++ b/api/tests/unit_tests/services/test_webhook_service.py
@@ -1,5 +1,4 @@
import logging
-from datetime import UTC, datetime
from io import BytesIO
from types import SimpleNamespace
from unittest.mock import MagicMock, patch
@@ -126,13 +125,11 @@ class TestWebhookServiceLookup:
monkeypatch: pytest.MonkeyPatch,
) -> None:
target_workflow = _workflow()
- target_workflow.created_at = datetime(2025, 1, 1, tzinfo=UTC).replace(tzinfo=None)
tenant_decoy = _workflow(
workflow_id="workflow-decoy",
tenant_id="tenant-other",
app_id="app-123",
)
- tenant_decoy.created_at = datetime(2026, 1, 1, tzinfo=UTC).replace(tzinfo=None)
sqlite_session.add_all([_webhook_trigger(), target_workflow, tenant_decoy])
sqlite_session.commit()
monkeypatch.setattr(webhook_service_module, "db", SimpleNamespace(engine=sqlite_engine))