add crawler tests

This commit is contained in:
Daulet Amirkhanov 2025-10-21 15:22:40 +01:00
parent 5035c872a7
commit a7ff188018
2 changed files with 28 additions and 0 deletions

View file

@ -0,0 +1,13 @@
import pytest
from cognee.tasks.web_scraper import BeautifulSoupCrawler
@pytest.mark.asyncio
async def test_fetch():
crawler = BeautifulSoupCrawler()
url = "https://en.wikipedia.org/wiki/Large_language_model"
results = await crawler.fetch_urls(url)
assert len(results) == 1
assert isinstance(results, dict)
html = results[url]
assert isinstance(html, str)

View file

@ -0,0 +1,15 @@
import os
import pytest
from cognee.tasks.web_scraper.config import TavilyConfig
from cognee.tasks.web_scraper.utils import fetch_with_tavily
@pytest.mark.asyncio
async def test_fetch():
url = "https://en.wikipedia.org/wiki/Large_language_model"
tavily_config = TavilyConfig()
results = await fetch_with_tavily(url, tavily_config)
assert len(results) == 1
assert isinstance(results, dict)
html = results[url]
assert isinstance(html, str)