def test_perform_retries_on_timeout(self): """When exception is a requests.Timout return True.""" myerror = UrlError(cause=requests.Timeout('something timed out')) self.assertTrue(retry_on_url_exc(msg='', exc=myerror))
def test_perform_retries_on_not_found(self): """When exception is UrlError with a 404 status code return True.""" myerror = UrlError(cause=RuntimeError('something was not found'), code=NOT_FOUND) self.assertTrue(retry_on_url_exc(msg='', exc=myerror))
def test_do_not_retry_non_urlerror(self): """When exception is not UrlError return False.""" myerror = IOError('something unexcpected') self.assertFalse(retry_on_url_exc(msg='', exc=myerror))
def test_perform_retries_on_not_found(self): """When exception is UrlError with a 404 status code return True.""" myerror = UrlError(cause=RuntimeError( 'something was not found'), code=NOT_FOUND) self.assertTrue(retry_on_url_exc(msg='', exc=myerror))