mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-19 06:54:22 +01:00
Add unit test for testing adding a gent
This commit is contained in:
13
tests/unit/test_commands.py
Normal file
13
tests/unit/test_commands.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
from autogpt import commands
|
||||||
|
import unittest
|
||||||
|
from unittest.mock import patch,MagicMock
|
||||||
|
|
||||||
|
class TestCommands(unittest.TestCase):
|
||||||
|
def test_make_agent(self):
|
||||||
|
with patch("openai.ChatCompletion.create") as mock:
|
||||||
|
obj = MagicMock()
|
||||||
|
obj.response.choices[0].messages[0].content = "Test message"
|
||||||
|
mock.return_value = obj
|
||||||
|
commands.start_agent("Test Agent", "chat", "Hello, how are you?", "gpt2")
|
||||||
|
agents = commands.list_agents()
|
||||||
|
self.assertEqual(agents[0], (0,'chat'))
|
||||||
Reference in New Issue
Block a user