37 lines
1.4 KiB
Python
37 lines
1.4 KiB
Python
"""Opt-in live check against published n8n webhooks.
|
|
|
|
This sends a document and a question to a new, isolated collection. It is not
|
|
part of the default test suite because it changes n8n state.
|
|
"""
|
|
|
|
import asyncio
|
|
from uuid import uuid4
|
|
|
|
from config import Settings
|
|
from n8n_client import N8NClient
|
|
|
|
|
|
async def main() -> None:
|
|
marker = f"CODEX-{uuid4().hex[:12].upper()}"
|
|
collection = f"codex-smoke-{uuid4().hex[:12]}"
|
|
document = f"# Проверочная заметка\n\nКонтрольная метка этой заметки: {marker}.\n"
|
|
client = N8NClient(Settings.from_env())
|
|
|
|
print(f"Тестовая коллекция: {collection}")
|
|
await client.upload("codex-smoke.md", document.encode("utf-8"), collection)
|
|
print("Загрузка: HTTP 2xx; индексирование проверяется вопросом.")
|
|
|
|
answer = await client.ask(
|
|
"Какая контрольная метка указана в проверочной заметке? Ответь только меткой.",
|
|
collection,
|
|
uuid4().hex,
|
|
)
|
|
print(f"Ответ: {answer}")
|
|
if marker not in answer:
|
|
raise RuntimeError("Ответ не содержит контрольную метку загруженного файла.")
|
|
print("Сквозная проверка прошла.")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|