Merge "Use status_code instead of status in requests"

This commit is contained in:
Zuul 2019-01-19 00:32:43 +00:00 committed by Gerrit Code Review
commit a7a4cf0453
2 changed files with 3 additions and 1 deletions

View File

@ -231,7 +231,8 @@ class MetadataProxyHandler(object):
explanation = six.text_type(msg)
return webob.exc.HTTPInternalServerError(explanation=explanation)
else:
raise Exception(_('Unexpected response code: %s') % resp.status)
raise Exception(_('Unexpected response code: %s') %
resp.status_code)
def _sign_instance_id(self, instance_id):
secret = self.conf.metadata_proxy_shared_secret

View File

@ -340,6 +340,7 @@ class _TestMetadataProxyHandlerCacheMixin(object):
req = mock.Mock(path_info='/the_path', query_string='', headers=hdrs,
method=method, body=body)
resp = mock.MagicMock(status_code=response_code)
resp.status.__str__.side_effect = AttributeError
resp.content = 'content'
req.response = resp
with mock.patch.object(self.handler, '_sign_instance_id') as sign: