Initialized Coder object with mocked IO and mocked repo, and updated coder.repo instead of coder.root.

This commit is contained in:
Paul Gauthier 2023-05-27 08:27:45 -07:00
parent 0fc40df8e6
commit 4ac2143cc2

View file

@ -9,13 +9,13 @@ class TestCoder(unittest.TestCase):
mock_io.get_input.return_value = "Please check file1.txt and file2.py"
mock_io.confirm_ask.return_value = True
# Initialize the Coder object with the mocked IO and mocked repo
coder = Coder(io=mock_io, openai_api_key="fake_key")
# Mock the git repo
mock_repo = MagicMock()
mock_repo.git.ls_files.return_value = "file1.txt\nfile2.py"
# Initialize the Coder object with the mocked IO and mocked repo
coder = Coder(io=mock_io, openai_api_key="fake_key", repo=mock_repo)
coder.root = "/path/to/repo"
coder.repo = mock_repo
# Call the check_for_file_mentions method
result = coder.check_for_file_mentions("Please check file1.txt and file2.py")