Team Ai
Apppublic

coding-alt/AutoGPT

sourceHugging Facemitupdated 3y agoView on Hugging Face
0likes
test_commands.py23 linesDownload Raw Back to unit
1"""Unit tests for the commands module"""2from unittest.mock import MagicMock, patch3 4import pytest5 6import autogpt.agent.agent_manager as agent_manager7from autogpt.app import execute_command, list_agents, start_agent8 9 10@pytest.mark.integration_test11def test_make_agent() -> None:12    """Test the make_agent command"""13    with patch("openai.ChatCompletion.create") as mock:14        obj = MagicMock()15        obj.response.choices[0].messages[0].content = "Test message"16        mock.return_value = obj17        start_agent("Test Agent", "chat", "Hello, how are you?", "gpt2")18        agents = list_agents()19        assert "List of agents:\n0: chat" == agents20        start_agent("Test Agent 2", "write", "Hello, how are you?", "gpt2")21        agents = list_agents()22        assert "List of agents:\n0: chat\n1: write" == agents23