feat: qualify native Hermes research and private conversation exports

This commit is contained in:
snowspeeder committed 2026-10-03 08:56:18 -04:00
1 parent fb3178d34b
commit e048793b02
5 files changed
+206 -6

No files matched your search

+28
View File
@@ -310,3 +310,31 @@ def test_pdf_subprocess_limits_and_admission(env, monkeypatch):
finally:
env.store.upload_admission.release()
env.store.upload_admission.release()
def test_research_exact_tool_manifest_and_status_projection(env):
import httpx
manifest = {'object': 'list', 'platform': 'api_server', 'data': [
{'name': 'web', 'enabled': True, 'configured': True, 'tools': ['web_search', 'web_extract'], 'secret': 'never expose'}]}
requests = []
def handle(request):
requests.append(request)
assert request.url.path == '/v1/toolsets'
return httpx.Response(200, json=manifest)
http = httpx.AsyncClient(transport=httpx.MockTransport(handle))
env.accounts.update(env.users[0]['id'], hermes_url='http://127.0.0.1:20000', hermes_api_key='private')
provider = FeatureProvider(env.accounts, http_client=http)
assert asyncio.run(provider.research_status(env.users[0]['id'])) == {'available': True, 'mode': 'hermes_tools', 'reason': None}
instruction = asyncio.run(provider.research_instruction(env.users[0]['id']))
assert 'same Hermes run' in instruction and 'cite source URLs' in instruction
assert requests[-1].headers['authorization'] == 'Bearer private'
assert 'secret' not in str(asyncio.run(provider.toolset_status(env.users[0]['id'])))
manifest['data'][0]['configured'] = False
assert not asyncio.run(provider.research_status(env.users[0]['id']))['available']
with pytest.raises(HTTPException) as error:
asyncio.run(provider.research_instruction(env.users[0]['id']))
assert error.value.status_code == 409
manifest['data'][0]['configured'] = True
manifest['data'][0]['tools'] = ['web_search']
assert not asyncio.run(provider.research_status(env.users[0]['id']))['available']
asyncio.run(http.aclose())