feat(file-summary): 实现文件处理技能链路
This commit is contained in:
27
tests/test_file_summary_skills.py
Normal file
27
tests/test_file_summary_skills.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import pytest
|
||||
|
||||
from review_agent.file_summary.skills.base import BaseSkill, SkillResult, WorkflowContext
|
||||
from review_agent.file_summary.skills.registry import SkillRegistry
|
||||
|
||||
|
||||
class EchoSkill(BaseSkill):
|
||||
name = "echo"
|
||||
|
||||
def run(self, context):
|
||||
return SkillResult(success=True, data={"batch_id": context.batch.id})
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_skill_registry_executes_registered_skill(django_user_model):
|
||||
from review_agent.models import Conversation, FileSummaryBatch
|
||||
|
||||
user = django_user_model.objects.create_user(username="owner", password="pass")
|
||||
conversation = Conversation.objects.create(user=user, title="会话")
|
||||
batch = FileSummaryBatch.objects.create(conversation=conversation, user=user, batch_no="FS-X")
|
||||
registry = SkillRegistry()
|
||||
registry.register(EchoSkill())
|
||||
|
||||
result = registry.execute("echo", WorkflowContext(batch=batch))
|
||||
|
||||
assert result.success is True
|
||||
assert result.data == {"batch_id": batch.id}
|
||||
Reference in New Issue
Block a user