mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-19 06:54:22 +01:00
* Rearrange tests into unit/integration/challenge categories * Fix linting + `tests.challenges` imports * Fix obscured duplicate test in test_url_validation.py * Move VCR conftest to tests.vcr * Specify tests to run & their order (unit -> integration -> challenges) in CI * Fail Docker CI when tests fail * Fix import & linting errors in tests * Fix `get_text_summary` * Fix linting errors * Clean up pytest args in CI * Remove bogus tests from GoCodeo
46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
from unittest.mock import MagicMock
|
|
|
|
import pytest
|
|
|
|
from autogpt.agent import Agent
|
|
from autogpt.config import AIConfig
|
|
|
|
|
|
@pytest.fixture
|
|
def agent():
|
|
ai_name = "Test AI"
|
|
memory = MagicMock()
|
|
next_action_count = 0
|
|
command_registry = MagicMock()
|
|
config = AIConfig()
|
|
system_prompt = "System prompt"
|
|
triggering_prompt = "Triggering prompt"
|
|
workspace_directory = "workspace_directory"
|
|
|
|
agent = Agent(
|
|
ai_name,
|
|
memory,
|
|
next_action_count,
|
|
command_registry,
|
|
config,
|
|
system_prompt,
|
|
triggering_prompt,
|
|
workspace_directory,
|
|
)
|
|
return agent
|
|
|
|
|
|
def test_agent_initialization(agent: Agent):
|
|
assert agent.ai_name == "Test AI"
|
|
assert agent.memory == agent.memory
|
|
assert agent.history.messages == []
|
|
assert agent.next_action_count == 0
|
|
assert agent.command_registry == agent.command_registry
|
|
assert agent.config == agent.config
|
|
assert agent.system_prompt == "System prompt"
|
|
assert agent.triggering_prompt == "Triggering prompt"
|
|
|
|
|
|
# More test methods can be added for specific agent interactions
|
|
# For example, mocking chat_with_ai and testing the agent's interaction loop
|