Skip to content

Commit

Permalink
model unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
luciferlinx101 committed Jul 4, 2023
1 parent 5412f63 commit f2c7531
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions tests/unit_tests/models/test_agent_execution_config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import unittest
from unittest.mock import MagicMock, patch
from unittest.mock import MagicMock, patch, call

from distlib.util import AND

from superagi.models.agent_execution_config import AgentExecutionConfiguration

Expand All @@ -11,18 +13,6 @@ def setUp(self):
self.execution = MagicMock()
self.execution.id = 1

def test_add_or_update_agent_execution_config(self):
test_config = {
"goal": "test_goal",
"instruction": "test_instruction"
}

with patch.object(AgentExecutionConfiguration, "__init__", return_value=None):
with patch.object(self.session, "add"):
with patch.object(self.session, "commit"):
AgentExecutionConfiguration.add_or_update_agent_execution_config(self.session, self.execution,
test_config)

def test_fetch_configuration(self):
test_db_response = [MagicMock(key="goal", value="['test_goal']"),
MagicMock(key="instruction", value="['test_instruction']")]
Expand All @@ -40,4 +30,4 @@ def test_eval_agent_config(self):

result = AgentExecutionConfiguration.eval_agent_config(key, value)

self.assertEqual(result, ["test_goal"])
self.assertEqual(result, ["test_goal"])

0 comments on commit f2c7531

Please sign in to comment.