test(regulatory-info-package): 覆盖材料包主链路
This commit is contained in:
48
tests/test_regulatory_info_package_input_select.py
Normal file
48
tests/test_regulatory_info_package_input_select.py
Normal file
@@ -0,0 +1,48 @@
|
||||
import pytest
|
||||
|
||||
from review_agent.models import Conversation, FileAttachment
|
||||
from review_agent.regulatory_info_package.services.input_select import select_instruction_input
|
||||
|
||||
|
||||
pytestmark = pytest.mark.django_db
|
||||
|
||||
|
||||
def test_select_instruction_input_prefers_message_filename(django_user_model):
|
||||
user = django_user_model.objects.create_user(username="owner", password="pass")
|
||||
conversation = Conversation.objects.create(user=user, title="会话")
|
||||
selected = FileAttachment.objects.create(
|
||||
conversation=conversation,
|
||||
user=user,
|
||||
original_name="目标产品说明书.docx",
|
||||
storage_path="uploads/target.docx",
|
||||
)
|
||||
FileAttachment.objects.create(
|
||||
conversation=conversation,
|
||||
user=user,
|
||||
original_name="其他说明书.docx",
|
||||
storage_path="uploads/other.docx",
|
||||
)
|
||||
|
||||
result = select_instruction_input(conversation, "请使用目标产品说明书生成第1章监管信息")
|
||||
|
||||
assert result.status == "selected"
|
||||
assert result.attachment == selected
|
||||
assert result.file_name == "目标产品说明书.docx"
|
||||
|
||||
|
||||
def test_select_instruction_input_waits_on_multiple_candidates(django_user_model):
|
||||
user = django_user_model.objects.create_user(username="owner", password="pass")
|
||||
conversation = Conversation.objects.create(user=user, title="会话")
|
||||
for name in ["A说明书.docx", "B说明书.docx"]:
|
||||
FileAttachment.objects.create(
|
||||
conversation=conversation,
|
||||
user=user,
|
||||
original_name=name,
|
||||
storage_path=f"uploads/{name}",
|
||||
)
|
||||
|
||||
result = select_instruction_input(conversation, "生成第1章监管信息")
|
||||
|
||||
assert result.status == "waiting_user"
|
||||
assert result.candidates == ["A说明书.docx", "B说明书.docx"]
|
||||
|
||||
Reference in New Issue
Block a user