mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-22 16:34:25 +01:00
* Rearrange tests into unit/integration/challenge categories * Fix linting + `tests.challenges` imports * Fix obscured duplicate test in test_url_validation.py * Move VCR conftest to tests.vcr * Specify tests to run & their order (unit -> integration -> challenges) in CI * Fail Docker CI when tests fail * Fix import & linting errors in tests * Fix `get_text_summary` * Fix linting errors * Clean up pytest args in CI * Remove bogus tests from GoCodeo
25 lines
901 B
Python
25 lines
901 B
Python
from unittest.mock import MagicMock
|
|
|
|
from pytest_mock import MockerFixture
|
|
|
|
from autogpt.app import list_agents, start_agent
|
|
from autogpt.config import Config
|
|
|
|
|
|
def test_make_agent(config: Config, mocker: MockerFixture) -> None:
|
|
"""Test that an agent can be created"""
|
|
mock = mocker.patch("openai.ChatCompletion.create")
|
|
|
|
response = MagicMock()
|
|
# del response.error
|
|
response.choices[0].messages[0].content = "Test message"
|
|
response.usage.prompt_tokens = 1
|
|
response.usage.completion_tokens = 1
|
|
mock.return_value = response
|
|
start_agent("Test Agent", "chat", "Hello, how are you?", config, "gpt-3.5-turbo")
|
|
agents = list_agents(config)
|
|
assert "List of agents:\n0: chat" == agents
|
|
start_agent("Test Agent 2", "write", "Hello, how are you?", config, "gpt-3.5-turbo")
|
|
agents = list_agents(config)
|
|
assert "List of agents:\n0: chat\n1: write" == agents
|