def test_api_call_raises_exception_connection_error(mock_requests,
cloudflare):
for ex in [requests.exceptions.RequestException,
requests.exceptions.HTTPError,
requests.exceptions.ConnectionError,
requests.exceptions.ProxyError,
requests.exceptions.SSLError,
requests.exceptions.Timeout,
requests.exceptions.ConnectTimeout,
requests.exceptions.ReadTimeout,
requests.exceptions.URLRequired,
requests.exceptions.TooManyRedirects,
requests.exceptions.MissingSchema,
requests.exceptions.InvalidSchema,
requests.exceptions.InvalidURL,
requests.exceptions.ChunkedEncodingError,
requests.exceptions.ContentDecodingError,
requests.exceptions.StreamConsumedError,
requests.exceptions.RetryError]:
mock_requests.get.side_effect = ex('Some error')
with pytest.raises(CloudFlareException):
cloudflare._api_call('/foo')
test_twindb_cloudflare.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录