|
|
|
|
@ -7,6 +7,7 @@ load_dotenv()
|
|
|
|
|
from .CodeMonkey import CodeMonkey
|
|
|
|
|
from .Developer import Developer
|
|
|
|
|
from database.models.files import File
|
|
|
|
|
from database.models.development_steps import DevelopmentSteps
|
|
|
|
|
from helpers.Project import Project, update_file, clear_directory
|
|
|
|
|
from helpers.AgentConvo import AgentConvo
|
|
|
|
|
|
|
|
|
|
@ -37,11 +38,14 @@ class TestCodeMonkey:
|
|
|
|
|
self.project.root_path = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
|
|
|
|
'../../../workspace/TestDeveloper'))
|
|
|
|
|
self.project.technologies = []
|
|
|
|
|
last_step = DevelopmentSteps()
|
|
|
|
|
last_step.id = 1
|
|
|
|
|
self.project.checkpoints = {'last_development_step': last_step}
|
|
|
|
|
self.project.app = None
|
|
|
|
|
self.developer = Developer(self.project)
|
|
|
|
|
self.codeMonkey = CodeMonkey(self.project, developer=self.developer)
|
|
|
|
|
|
|
|
|
|
@patch('helpers.AgentConvo.get_development_step_from_hash_id', return_value=None)
|
|
|
|
|
@patch('helpers.AgentConvo.get_saved_development_step', return_value=None)
|
|
|
|
|
@patch('helpers.AgentConvo.save_development_step', return_value=None)
|
|
|
|
|
@patch('os.get_terminal_size', mock_terminal_size)
|
|
|
|
|
@patch.object(File, 'insert')
|
|
|
|
|
@ -54,7 +58,7 @@ class TestCodeMonkey:
|
|
|
|
|
else:
|
|
|
|
|
convo = MagicMock()
|
|
|
|
|
mock_responses = [
|
|
|
|
|
[],
|
|
|
|
|
# [],
|
|
|
|
|
[{
|
|
|
|
|
'content': 'Washington',
|
|
|
|
|
'description': "A new .txt file with the word 'Washington' in it.",
|
|
|
|
|
@ -79,7 +83,7 @@ class TestCodeMonkey:
|
|
|
|
|
assert (called_data['path'] == '/' or called_data['path'] == called_data['name'])
|
|
|
|
|
assert called_data['content'] == 'Washington'
|
|
|
|
|
|
|
|
|
|
@patch('helpers.AgentConvo.get_development_step_from_hash_id', return_value=None)
|
|
|
|
|
@patch('helpers.AgentConvo.get_saved_development_step', return_value=None)
|
|
|
|
|
@patch('helpers.AgentConvo.save_development_step', return_value=None)
|
|
|
|
|
@patch('os.get_terminal_size', mock_terminal_size)
|
|
|
|
|
@patch.object(File, 'insert')
|
|
|
|
|
@ -94,7 +98,7 @@ class TestCodeMonkey:
|
|
|
|
|
else:
|
|
|
|
|
convo = MagicMock()
|
|
|
|
|
mock_responses = [
|
|
|
|
|
['file_to_read.txt', 'output.txt'],
|
|
|
|
|
# ['file_to_read.txt', 'output.txt'],
|
|
|
|
|
[{
|
|
|
|
|
'content': 'Hello World!\n',
|
|
|
|
|
'description': 'This file is the output file. The content of file_to_read.txt is copied into this file.',
|
|
|
|
|
|