|
| 1 | +from uuid import UUID |
| 2 | + |
| 3 | +import pytest |
| 4 | + |
| 5 | +from deepset_mcp.api.pipeline_template.models import PipelineTemplate, PipelineTemplateTag |
| 6 | +from deepset_mcp.api.pipeline_template.resource import PipelineTemplateResource |
| 7 | +from deepset_mcp.api.protocols import PipelineTemplateResourceProtocol |
| 8 | +from test.unit.conftest import BaseFakeClient |
| 9 | + |
| 10 | + |
| 11 | +def create_sample_template( |
| 12 | + name: str = "test-template", |
| 13 | + pipeline_type: str = "query", |
| 14 | + author: str = "deepset-ai", |
| 15 | + description: str = "A test template", |
| 16 | + template_id: str = "3fa85f64-5717-4562-b3fc-2c963f66afa6", |
| 17 | +) -> dict: |
| 18 | + """Create a sample pipeline template response dictionary for testing.""" |
| 19 | + return { |
| 20 | + "name": name, |
| 21 | + "pipeline_template_id": template_id, |
| 22 | + "pipeline_type": pipeline_type, |
| 23 | + "author": author, |
| 24 | + "description": description, |
| 25 | + "deepset_cloud_version": "v2", |
| 26 | + "pipeline_name": name, |
| 27 | + "query_yaml": "version: '1.0'\ncomponents: []\npipeline:\n name: test", |
| 28 | + "available_to_all_organization_types": True, |
| 29 | + "best_for": ["quick-start", "testing"], |
| 30 | + "expected_output": ["answers", "documents"], |
| 31 | + "potential_applications": ["testing", "development"], |
| 32 | + "recommended_dataset": ["sample-data"], |
| 33 | + "tags": [ |
| 34 | + { |
| 35 | + "name": "test", |
| 36 | + "tag_id": "d4a85f64-5717-4562-b3fc-2c963f66afa6" |
| 37 | + } |
| 38 | + ] |
| 39 | + } |
| 40 | + |
| 41 | + |
| 42 | +class DummyClient(BaseFakeClient): |
| 43 | + """Dummy client for testing that implements AsyncClientProtocol.""" |
| 44 | + def pipeline_templates(self, workspace: str) -> PipelineTemplateResourceProtocol: |
| 45 | + return PipelineTemplateResource(client=self, workspace=workspace) |
0 commit comments