feat: show feishu notification status
This commit is contained in:
@@ -8,6 +8,7 @@ from review_agent.models import (
|
||||
RegulatoryArtifact,
|
||||
RegulatoryNotificationRecord,
|
||||
RegulatoryReviewBatch,
|
||||
WorkflowNotificationRecord,
|
||||
WorkflowNodeRun,
|
||||
)
|
||||
|
||||
@@ -230,3 +231,35 @@ def test_frontend_keeps_single_condition_confirmation_prompt():
|
||||
assert "data-condition-confirmation-card" in script
|
||||
assert "removeStaleConditionConfirmationCards" in script
|
||||
assert '[data-condition-confirmation-card]' in script
|
||||
|
||||
|
||||
def test_regulatory_status_includes_failed_feishu_notification(client, 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-RR")
|
||||
batch = RegulatoryReviewBatch.objects.create(
|
||||
conversation=conversation,
|
||||
user=user,
|
||||
source_summary_batch=summary,
|
||||
batch_no="RR-FEISHU",
|
||||
)
|
||||
WorkflowNotificationRecord.objects.create(
|
||||
workflow_type="regulatory_review",
|
||||
workflow_batch_id=batch.pk,
|
||||
workflow_batch_no=batch.batch_no,
|
||||
workflow_status=batch.status,
|
||||
dedupe_key=f"regulatory_review:{batch.pk}:{batch.status}",
|
||||
trigger_user=user,
|
||||
channel=WorkflowNotificationRecord.Channel.FEISHU_API,
|
||||
target="负责人",
|
||||
send_status=WorkflowNotificationRecord.SendStatus.FAILED,
|
||||
message_title="法规核查完成",
|
||||
error_message="bad receive_id",
|
||||
)
|
||||
client.force_login(user)
|
||||
|
||||
response = client.get(f"/api/review-agent/regulatory-review/{batch.pk}/status/")
|
||||
|
||||
payload = response.json()
|
||||
assert payload["latest_notification"]["status_label"] == "飞书通知失败"
|
||||
assert payload["latest_notification"]["error_message"] == "bad receive_id"
|
||||
|
||||
Reference in New Issue
Block a user