From 5baca04e522d051e203657ea45372032516332b8 Mon Sep 17 00:00:00 2001 From: Chandragupt Singh Date: Mon, 6 Apr 2026 04:01:40 +0530 Subject: [PATCH] fix(test_ci): mock requests.get in test_start_ci_empty_token to prevent rate-limit flakiness --- tests/test_ci/test_controllers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_ci/test_controllers.py b/tests/test_ci/test_controllers.py index cf62edd2..8184c56a 100644 --- a/tests/test_ci/test_controllers.py +++ b/tests/test_ci/test_controllers.py @@ -2406,8 +2406,9 @@ def test_blocked_users_empty_token(self): c.post("/blocked_users", data=dict(user_id=999, comment="Test user", add=True)) self.assertIsNotNone(BlockedUsers.query.filter(BlockedUsers.user_id == 999).first()) + @mock.patch('requests.get', side_effect=mock_api_request_github) @mock.patch('run.get_github_config') - def test_start_ci_empty_token(self, mock_get_github_config): + def test_start_ci_empty_token(self, mock_get_github_config, mock_requests): """Test start_ci returns 500 when GitHub token is empty.""" payload = {'ref': 'refs/heads/master', 'after': 'abc123'} headers = self.generate_header(payload, 'push')