mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-20 23:44:19 +01:00
Feature/basic proxy (#4164)
* basic proxy (#54) * basic proxy (#55) * basic proxy * basic proxy * basic proxy * basic proxy * add back double quotes * add more specific files * write file * basic proxy * Put back double quotes
This commit is contained in:
28
tests/integration/test_commands.py
Normal file
28
tests/integration/test_commands.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""Unit tests for the commands module"""
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from autogpt.app import list_agents, start_agent
|
||||
from tests.utils import requires_api_key
|
||||
|
||||
|
||||
@pytest.mark.vcr
|
||||
@pytest.mark.integration_test
|
||||
@requires_api_key("OPENAI_API_KEY")
|
||||
def test_make_agent(patched_api_requestor) -> None:
|
||||
"""Test that an agent can be created"""
|
||||
# Use the mock agent manager to avoid creating a real agent
|
||||
with patch("openai.ChatCompletion.create") as mock:
|
||||
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?", "gpt-3.5-turbo")
|
||||
agents = list_agents()
|
||||
assert "List of agents:\n0: chat" == agents
|
||||
start_agent("Test Agent 2", "write", "Hello, how are you?", "gpt-3.5-turbo")
|
||||
agents = list_agents()
|
||||
assert "List of agents:\n0: chat\n1: write" == agents
|
||||
Reference in New Issue
Block a user