Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Add unit test for testing adding a gent

Gershon Bialer0b4f0f56226a
diff --git a/tests/unit/test_commands.py b/tests/unit/test_commands.py
new file mode 100644
index 0000000000..b7bddcec11
--- /dev/null
+++ b/tests/unit/test_commands.py
@@ -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'))
\ No newline at end of file