@@ -94,6 +94,28 @@ def test_fetch_pr_info_success(self, mock_get, sample_pr_info):
9494 assert result .head_branch == "load-3d-nodes"
9595 assert result .mergeable is True
9696
97+ @patch ("requests.get" )
98+ def test_fetch_pr_info_not_found (self , mock_get ):
99+ """Test PR not found (404)"""
100+ mock_response = Mock ()
101+ mock_response .status_code = 404
102+ mock_response .raise_for_status .side_effect = requests .HTTPError ("404 Not Found" )
103+ mock_get .return_value = mock_response
104+
105+ with pytest .raises (Exception , match = "Failed to fetch PR" ):
106+ fetch_pr_info ("comfyanonymous" , "ComfyUI" , 999 )
107+
108+ @patch ("requests.get" )
109+ def test_fetch_pr_info_rate_limit (self , mock_get ):
110+ """Test GitHub API rate limit handling"""
111+ mock_response = Mock ()
112+ mock_response .status_code = 403
113+ mock_response .headers = {"x-ratelimit-remaining" : "0" }
114+ mock_get .return_value = mock_response
115+
116+ with pytest .raises (Exception , match = "Primary rate limit from Github exceeded!" ):
117+ fetch_pr_info ("comfyanonymous" , "ComfyUI" , 123 )
118+
97119 @patch ("requests.get" )
98120 def test_find_pr_by_branch_success (self , mock_get ):
99121 """Test successful PR search by branch"""
@@ -140,28 +162,6 @@ def test_find_pr_by_branch_error(self, mock_get):
140162 result = find_pr_by_branch ("comfyanonymous" , "ComfyUI" , "testuser" , "test-branch" )
141163 assert result is None
142164
143- @patch ("requests.get" )
144- def test_fetch_pr_info_not_found (self , mock_get ):
145- """Test PR not found (404)"""
146- mock_response = Mock ()
147- mock_response .status_code = 404
148- mock_response .raise_for_status .side_effect = requests .HTTPError ("404 Not Found" )
149- mock_get .return_value = mock_response
150-
151- with pytest .raises (Exception , match = "Failed to fetch PR" ):
152- fetch_pr_info ("comfyanonymous" , "ComfyUI" , 999 )
153-
154- @patch ("requests.get" )
155- def test_fetch_pr_info_rate_limit (self , mock_get ):
156- """Test GitHub API rate limit handling"""
157- mock_response = Mock ()
158- mock_response .status_code = 403
159- mock_response .headers = {"x-ratelimit-remaining" : "0" }
160- mock_get .return_value = mock_response
161-
162- with pytest .raises (Exception , match = "Primary rate limit from Github exceeded!" ):
163- fetch_pr_info ("comfyanonymous" , "ComfyUI" , 123 )
164-
165165
166166class TestGitOperations :
167167 """Test Git operations for PR checkout"""
0 commit comments