mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 23:18:05 +08:00
test: update unit tests for system message handling and workflow collaboration serices
This commit is contained in:
@ -134,8 +134,8 @@ class TestInitSystemMessage:
|
||||
|
||||
assert result == []
|
||||
|
||||
def test_existing_system_message_not_duplicated(self, mock_runner):
|
||||
"""Test that system message is not duplicated if already present."""
|
||||
def test_existing_system_message_replaced_with_template(self, mock_runner):
|
||||
"""Test that existing system message is replaced with the new template."""
|
||||
existing_messages = [
|
||||
SystemPromptMessage(content="Existing system"),
|
||||
UserPromptMessage(content="User message"),
|
||||
@ -143,9 +143,8 @@ class TestInitSystemMessage:
|
||||
|
||||
result = mock_runner._init_system_message("New template", existing_messages)
|
||||
|
||||
# Should not insert new system message
|
||||
assert len(result) == 2
|
||||
assert result[0].content == "Existing system"
|
||||
assert result[0].content == "New template"
|
||||
|
||||
def test_system_message_inserted_when_missing(self, mock_runner):
|
||||
"""Test that system message is inserted when first message is not system."""
|
||||
|
||||
Reference in New Issue
Block a user