def test_ignore_failing_post_request(self, fake): client = Client(raise_for_status=False) for status in (500, 501, 502, 504, 505): with self.mock_request(fake, status): try: client.post('/path') Client().post('path') # test the default version except HTTPError: self.fail('client.post() raises an exception when' '``raise_for_status`` is set to False')
def test_post_request_fails(self, fake): client = Client(raise_for_status=True) for status in (500, 501, 502, 504, 505): with self.mock_request(fake, status): self.assertRaises(HTTPError, lambda: client.post('/path'))