feat(regulatory): 完善复核前端入口

This commit is contained in:
2026-06-07 09:40:18 +08:00
parent d39e3fe2d5
commit 4e46f27c28
5 changed files with 110 additions and 21 deletions

View File

@@ -4,6 +4,8 @@ from django.urls import reverse
from review_agent.models import (
Conversation,
FileSummaryBatch,
RegulatoryArtifact,
RegulatoryNotificationRecord,
RegulatoryReviewBatch,
WorkflowNodeRun,
)
@@ -102,6 +104,49 @@ def test_workspace_renders_condition_confirmation_form(client, django_user_model
assert "甲胎蛋白检测试剂盒" in content
def test_workspace_renders_rectification_actions_and_summaries(client, tmp_path, django_user_model):
user = django_user_model.objects.create_user(username="owner", password="pass")
conversation = Conversation.objects.create(user=user, title="会话")
summary = FileSummaryBatch.objects.create(
conversation=conversation,
user=user,
batch_no="FS-OK",
status=FileSummaryBatch.Status.SUCCESS,
)
regulatory = RegulatoryReviewBatch.objects.create(
conversation=conversation,
user=user,
source_summary_batch=summary,
batch_no="RR-RECTIFY",
status=RegulatoryReviewBatch.Status.SUCCESS,
)
record_path = tmp_path / "review_record.json"
record_path.write_text('{"items":[{"status":"review_passed"}]}', encoding="utf-8")
RegulatoryArtifact.objects.create(
batch=regulatory,
artifact_type=RegulatoryArtifact.ArtifactType.JSON,
name="review_record.json",
storage_path=str(record_path),
metadata={"artifact": "review_record"},
)
RegulatoryNotificationRecord.objects.create(
batch=regulatory,
channel=RegulatoryNotificationRecord.Channel.MOCK,
target="法规整改负责人",
status=RegulatoryNotificationRecord.Status.SENT,
payload={"title": "缺少申请表"},
)
client.force_login(user)
response = client.get(f"{reverse('home')}?conversation={conversation.pk}")
content = response.content.decode("utf-8")
assert "data-rectification-action=\"full-review\"" in content
assert "data-rectification-action=\"issue-review\"" in content
assert "通知 1" in content
assert "复核记录 1" in content
def test_frontend_selects_status_url_by_workflow_type():
script = open("static/js/app.js", encoding="utf-8").read()
@@ -110,3 +155,5 @@ def test_frontend_selects_status_url_by_workflow_type():
assert "statusUrlForWorkflow" in script
assert "bindConditionConfirmForms" in script
assert "data-condition-confirm-form" in script
assert "bindRectificationActionButtons" in script
assert "data-rectification-action" in script