Files
Auto-GPT/autogpts/autogpt/tests/integration/test_web_selenium.py
Reinier van der Leer 7720f6af24 AutoGPT: replace autogpt.llm.* with LLM infrastructure of autogpt.core;
* Removed `autogpt.llm.base` and `autogpt.llm.utils`
* `core` does things async, so `Agent.think()` and `Agent.execute()` are now also async
* Renamed `dump()` and `parse()` on `JSONSchema` to `to_dict()` and `from_dict()`
* Removed `MessageHistory`

* Also, some typo's and linting fixes here and there
2023-09-21 16:38:41 +02:00

20 lines
637 B
Python

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
async def test_browse_website_nonexistent_url(
agent: Agent, patched_api_requestor: None
):
url = "https://auto-gpt-thinks-this-website-does-not-exist.com"
question = "How to execute a barrel roll"
with pytest.raises(BrowsingError, match=r"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