feat: wire feishu notifications into workflows
This commit is contained in:
@@ -13,7 +13,7 @@ from review_agent.models import (
|
||||
pytestmark = pytest.mark.django_db
|
||||
|
||||
|
||||
def test_notify_completion_records_success(django_user_model):
|
||||
def test_notify_completion_records_success(django_user_model, monkeypatch):
|
||||
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-NOTIFY")
|
||||
@@ -33,6 +33,16 @@ def test_notify_completion_records_success(django_user_model):
|
||||
file_name="filled.docx",
|
||||
storage_path="filled.docx",
|
||||
)
|
||||
calls = []
|
||||
fake_record = type(
|
||||
"Record",
|
||||
(),
|
||||
{"send_status": "success", "SendStatus": type("SendStatus", (), {"FAILED": "failed"}), "error_message": ""},
|
||||
)()
|
||||
monkeypatch.setattr(
|
||||
"review_agent.application_form_fill.services.notifier.dispatch_workflow_notification",
|
||||
lambda context: calls.append(context) or fake_record,
|
||||
)
|
||||
|
||||
record = notify_completion(batch, [exported])
|
||||
|
||||
@@ -40,6 +50,7 @@ def test_notify_completion_records_success(django_user_model):
|
||||
assert record.export_ids == [exported.pk]
|
||||
assert record.template_codes == ["registration_certificate"]
|
||||
assert record.sent_at is not None
|
||||
assert calls[0].workflow_type == "application_form_fill"
|
||||
|
||||
|
||||
def test_notify_completion_records_failure_without_raising(django_user_model):
|
||||
|
||||
Reference in New Issue
Block a user