def test_get_holidays_timeout(mock_requests): mock_requests.get.side_effect = Timeout with pytest.raises(Timeout): get_holidays() mock_requests.get.assert_called_once()
def test_get_holidays_timeout(): with patch('patch_example.my_calendar.requests') as mock_requests: mock_requests.get.side_effect = Timeout with pytest.raises(Timeout): get_holidays() mock_requests.get.assert_called_once()
def test_get_holidays_timeout(mock_placeholder): with pytest.raises(requests.exceptions.Timeout): get_holidays() # Keep on working as expected r = requests.post("https://jsonplaceholder.typicode.com/posts") print(r.json())
def test_get_holidays_timeout(mock_requests): mock_requests.get.side_effect = Timeout with pytest.raises(Timeout): get_holidays() # Keep on working as expected r = requests.get("https://jsonplaceholder.typicode.com/posts") print(r.json())
def test_get_holidays_timeout(): with patch('patch_example.my_calendar.requests') as mock_requests: mock_requests.get.side_effect = Timeout with pytest.raises(Timeout): get_holidays() mock_requests.get.assert_called_once() r = requests.post("https://jsonplaceholder.typicode.com/posts") print(r.json())