From 6c4e17999b8a4a408672692c52064d448d514e8e Mon Sep 17 00:00:00 2001 From: "Jon Michael Aanes (aider)" Date: Tue, 15 Apr 2025 00:43:32 +0200 Subject: [PATCH] fix: mock secrets in tests to prevent LLM_API_KEY access --- test/test_solve_issue_in_repository.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_solve_issue_in_repository.py b/test/test_solve_issue_in_repository.py index 5eb9083..6d8bdf2 100644 --- a/test/test_solve_issue_in_repository.py +++ b/test/test_solve_issue_in_repository.py @@ -23,10 +23,11 @@ class TestSolveIssueInRepository: self.issue_description = "This is a test issue" self.issue_number = "123" + @patch('aider_gitea.secrets.llm_api_key', return_value="fake-api-key") @patch('aider_gitea.run_cmd') @patch('aider_gitea.push_changes') @patch('subprocess.run') - def test_solve_issue_with_aider_changes(self, mock_subprocess_run, mock_push_changes, mock_run_cmd): + def test_solve_issue_with_aider_changes(self, mock_subprocess_run, mock_push_changes, mock_run_cmd, mock_llm_api_key): # Setup mocks mock_run_cmd.return_value = True mock_push_changes.return_value = True @@ -53,10 +54,11 @@ class TestSolveIssueInRepository: assert mock_run_cmd.call_count >= 8 # Verify all expected commands were run mock_push_changes.assert_called_once() + @patch('aider_gitea.secrets.llm_api_key', return_value="fake-api-key") @patch('aider_gitea.run_cmd') @patch('aider_gitea.push_changes') @patch('subprocess.run') - def test_solve_issue_without_aider_changes(self, mock_subprocess_run, mock_push_changes, mock_run_cmd): + def test_solve_issue_without_aider_changes(self, mock_subprocess_run, mock_push_changes, mock_run_cmd, mock_llm_api_key): # Setup mocks mock_run_cmd.return_value = True