test(api): verify provider persistence and returned service payloads

This commit is contained in:
huanghuoguoguo
2026-10-17 15:29:54 +08:00
parent bbf517edbc
commit ca997e6faa
4 changed files with 82 additions and 19 deletions
@@ -390,6 +390,7 @@ class TestGetKnowledgeBase:
result = await KnowledgeService(app).get_knowledge_base(CONTEXT, 'kb1')
assert result == {'uuid': 'kb1', 'name': 'KB1'}
app.rag_mgr.get_knowledge_base_details.assert_awaited_once_with(CONTEXT, 'kb1')
@pytest.mark.asyncio
async def test_returns_none_when_not_found(self):
@@ -555,7 +556,11 @@ class TestListParsers:
result = await KnowledgeService(app).list_parsers(CONTEXT)
assert len(result) == 2
assert result == [
{'id': 'parser1', 'supported_mime_types': ['text/plain']},
{'id': 'parser2', 'supported_mime_types': ['application/pdf']},
]
app.plugin_connector.list_parsers.assert_awaited_once_with()
@pytest.mark.asyncio
async def test_filters_by_mime_type(self):
@@ -589,7 +594,8 @@ class TestGetEngineSchemas:
'author/engine',
)
assert 'properties' in result
assert result == {'properties': {'name': {'type': 'string'}}}
app.plugin_connector.get_rag_creation_schema.assert_awaited_once_with('author/engine')
@pytest.mark.asyncio
async def test_returns_retrieval_schema(self):
@@ -601,7 +607,8 @@ class TestGetEngineSchemas:
'author/engine',
)
assert 'properties' in result
assert result == {'properties': {'top_k': {'type': 'integer'}}}
app.plugin_connector.get_rag_retrieval_schema.assert_awaited_once_with('author/engine')
@pytest.mark.asyncio
async def test_reports_schema_runtime_exception(self):