Fixed test_download_csv_failure test
This commit is contained in:
@@ -77,12 +77,13 @@ class TestCSVProcessor:
|
|||||||
@patch("requests.get")
|
@patch("requests.get")
|
||||||
def test_download_csv_failure(self, mock_get):
|
def test_download_csv_failure(self, mock_get):
|
||||||
"""Test CSV download failure"""
|
"""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 = Mock()
|
||||||
mock_response.status_code = 404
|
mock_response.status_code = 404
|
||||||
|
mock_response.raise_for_status.side_effect = requests.exceptions.HTTPError("404 Not Found")
|
||||||
mock_get.return_value = mock_response
|
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")
|
self.processor.download_csv("http://example.com/nonexistent.csv")
|
||||||
|
|
||||||
def test_parse_csv_content(self):
|
def test_parse_csv_content(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user