mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-01-07 16:24:19 +01:00
Fix execute_command coming from plugins (#4730)
This commit is contained in:
24
tests/unit/test_execute_command.py
Normal file
24
tests/unit/test_execute_command.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from autogpt.agent import Agent
|
||||
from autogpt.app import execute_command
|
||||
|
||||
|
||||
def check_plan():
|
||||
return "hi"
|
||||
|
||||
|
||||
def test_execute_command_plugin(agent: Agent):
|
||||
"""Test that executing a command that came from a plugin works as expected"""
|
||||
agent.ai_config.prompt_generator.add_command(
|
||||
"check_plan",
|
||||
"Read the plan.md with the next goals to achieve",
|
||||
{},
|
||||
check_plan,
|
||||
)
|
||||
command_name = "check_plan"
|
||||
arguments = {}
|
||||
command_result = execute_command(
|
||||
command_name=command_name,
|
||||
arguments=arguments,
|
||||
agent=agent,
|
||||
)
|
||||
assert command_result == "hi"
|
||||
Reference in New Issue
Block a user