feat(regulatory): 增加法规核查基础服务
This commit is contained in:
26
tests/test_regulatory_storage.py
Normal file
26
tests/test_regulatory_storage.py
Normal 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()
|
||||
Reference in New Issue
Block a user