blob: 1d904b855f76ee5258e694ae56ed9be1d3d6e631 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import pytest
from autogpt.agents.agent import Agent
from autogpt.commands.web_selenium import BrowsingError, read_webpage
@pytest.mark.vcr
@pytest.mark.requires_openai_api_key
@pytest.mark.asyncio
async def test_browse_website_nonexistent_url(agent: Agent, cached_openai_client: None):
url = "https://auto-gpt-thinks-this-website-does-not-exist.com"
question = "How to execute a barrel roll"
with pytest.raises(BrowsingError, match="NAME_NOT_RESOLVED") as raised:
await read_webpage(url=url, question=question, agent=agent)
# Sanity check that the response is not too long
assert len(raised.exconly()) < 200
|