uncommented test_code_changes_manual_test_no()

This commit is contained in:
Nicholas Albion
2023-10-04 14:10:00 +11:00
parent 86724f79f7
commit d65564415b

View File

@@ -98,34 +98,34 @@ class TestDeveloper:
# Then
assert result == {'success': True, 'user_input': 'continue'}
# @patch('helpers.AgentConvo.get_saved_development_step')
# @patch('helpers.AgentConvo.save_development_step')
# @patch('helpers.AgentConvo.create_gpt_chat_completion')
# @patch('utils.questionary.get_saved_user_input')
# # https://github.com/Pythagora-io/gpt-pilot/issues/35
# def test_code_changes_manual_test_no(self, mock_get_saved_user_input, mock_chat_completion, mock_save, mock_get_saved_step):
# # Given
# monkey = None
# convo = AgentConvo(self.developer)
# convo.save_branch = lambda branch_name=None: branch_name
# convo.load_branch = lambda function_uuid=None: function_uuid
# self.project.developer = self.developer
#
# mock_chat_completion.side_effect = [
# {'text': '{"type": "manual_test", "manual_test_description": "Does it look good?"}'},
# {'text': '{"steps": [{"type": "command", "command": {"command": "something scary", "timeout": 3000}, "check_if_fixed": true}]}'},
# {'text': 'do something else scary'},
# ]
#
# mock_questionary = MockQuestionary(['no', 'no'])
#
# with patch('utils.questionary.questionary', mock_questionary):
# # When
# result = self.developer.test_code_changes(monkey, convo)
#
# # Then
# assert result == {'success': True, 'user_input': 'no'}
#
@patch('helpers.AgentConvo.get_saved_development_step')
@patch('helpers.AgentConvo.save_development_step')
@patch('helpers.AgentConvo.create_gpt_chat_completion')
@patch('utils.questionary.get_saved_user_input')
# https://github.com/Pythagora-io/gpt-pilot/issues/35
def test_code_changes_manual_test_no(self, mock_get_saved_user_input, mock_chat_completion, mock_save, mock_get_saved_step):
# Given
monkey = None
convo = AgentConvo(self.developer)
convo.save_branch = lambda branch_name=None: branch_name
convo.load_branch = lambda function_uuid=None: function_uuid
self.project.developer = self.developer
mock_chat_completion.side_effect = [
{'text': '{"type": "manual_test", "manual_test_description": "Does it look good?"}'},
{'text': '{"steps": [{"type": "command", "command": {"command": "something scary", "timeout": 3000}, "check_if_fixed": true}]}'},
{'text': 'do something else scary'},
]
mock_questionary = MockQuestionary(['no', 'no'])
with patch('utils.questionary.questionary', mock_questionary):
# When
result = self.developer.test_code_changes(monkey, convo)
# Then
assert result == {'success': True, 'user_input': 'no'}
# @patch('helpers.cli.execute_command', return_value=('stdout:\n```\n\n```', 'DONE'))
# @patch('helpers.AgentConvo.get_saved_development_step')
# @patch('helpers.AgentConvo.save_development_step')