def test_download(mock_get, test_url): mock_get.return_value.raw = 'test raw response' result = download(test_url) assert result == 'test raw response' mock_get.assert_called_once_with(test_url, stream=True)
def test_download_raises_error(mock_get, test_url): with pytest.raises(RequestException): download(test_url)