Raise TypeError in manilaclient/common/httpclient.py
object 'HTTPClient' property 'retries' is None for default, when code 'if attempts > self.retries:' is executed at some time, TypeError will raise. Change-Id: I37c6235d30edc3afc5c5e2c88d710b6c60f49311 Closes-Bug: #1664877
This commit is contained in:
@@ -48,7 +48,7 @@ class HTTPClient(object):
|
||||
http_log_debug=False):
|
||||
self.endpoint_url = endpoint_url
|
||||
self.base_url = self._get_base_url(self.endpoint_url)
|
||||
self.retries = retries
|
||||
self.retries = int(retries or 0)
|
||||
self.http_log_debug = http_log_debug
|
||||
|
||||
self.request_options = self._set_request_options(
|
||||
|
@@ -176,6 +176,15 @@ class ClientTest(utils.TestCase):
|
||||
test_get_call()
|
||||
self.assertEqual(self.requests, [])
|
||||
|
||||
def test_get_with_retries_none(self):
|
||||
cl = get_authed_client(retries=None)
|
||||
|
||||
@mock.patch.object(requests, "request", bad_401_request)
|
||||
def test_get_call():
|
||||
resp, body = cl.get("/hi")
|
||||
|
||||
self.assertRaises(exceptions.Unauthorized, test_get_call)
|
||||
|
||||
def test_post(self):
|
||||
cl = get_authed_client()
|
||||
|
||||
|
Reference in New Issue
Block a user