vella-backend / tests /bubble_integrations /test_obter_arquivo.py
luanpoppe
feat: começandoa a adicionar testes com pytest
39fc36b
import pytest
from _utils.bubble_integrations.obter_arquivo import get_pdf_from_bubble
from langchain_core.documents import Document
pdf_file_url = "https://vella.app.br/version-test/fileupload/f1736298232170x993758712541722200/0002269-86.2009.8.05.0032%20processo%20teste.pdf"
class TestObterArquivo:
@pytest.mark.asyncio
async def test_get_pdf_from_bubble_No_llama_parse(self):
should_use_llama_parse = False
result = await get_pdf_from_bubble(pdf_file_url, should_use_llama_parse)
assert isinstance(result, list)
assert len(result) > 0
print("\n\nresult", result)
assert all(isinstance(item, Document) for item in result)
# Teste abaixo não funciona com arquivos grandes -> O Llama Parse dá erro de timeout
# @pytest.mark.asyncio
# async def test_get_pdf_from_bubble_With_llama_parse(self):
# should_use_llama_parse = True
# result = await get_pdf_from_bubble(pdf_file_url, should_use_llama_parse)
# assert isinstance(result, list)
# assert len(result) > 0
# print("\n\nresult", result)
# assert all(isinstance(item, Document) for item in result)