feat(regulatory): 增加法规核查基础服务

This commit is contained in:
2026-06-07 00:36:18 +08:00
parent 44d31d2a14
commit ec89e62661
11 changed files with 327 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import pytest
from review_agent.models import Conversation, FileSummaryBatch, RegulatoryReviewBatch
from review_agent.regulatory_review.storage import save_artifact
pytestmark = pytest.mark.django_db
def test_save_artifact_writes_file_and_records_hash(settings, tmp_path, django_user_model):
settings.MEDIA_ROOT = tmp_path
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")
batch = RegulatoryReviewBatch.objects.create(
conversation=conversation,
user=user,
source_summary_batch=summary,
batch_no="RR-ART",
)
artifact = save_artifact(batch, name="raw.json", content='{"ok": true}', artifact_type="json")
assert artifact.content_hash
assert artifact.storage_path.endswith("raw.json")
assert (tmp_path / "regulatory_review" / "work" / "RR-ART" / "raw.json").exists()