Fixed test_download_csv_failure test

This commit is contained in:
2025-09-20 20:21:25 +02:00
parent c494c5b5c6
commit b7b98def35

View File

@@ -77,12 +77,13 @@ class TestCSVProcessor:
@patch("requests.get")
def test_download_csv_failure(self, mock_get):
"""Test CSV download failure"""
# Mock failed HTTP response
# Mock failed HTTP response - need to make raise_for_status() raise an exception
mock_response = Mock()
mock_response.status_code = 404
mock_response.raise_for_status.side_effect = requests.exceptions.HTTPError("404 Not Found")
mock_get.return_value = mock_response
with pytest.raises(Exception):
with pytest.raises(requests.exceptions.HTTPError):
self.processor.download_csv("http://example.com/nonexistent.csv")
def test_parse_csv_content(self):