Merge "Fix wrong attribute name used for http status"
This commit is contained in:
commit
5b7b9b343f
@ -83,7 +83,7 @@ class TempestConf(object):
|
||||
msg = _('Error on downloading cirros image, possibly'
|
||||
' no connection to Internet with message %s') % str(err)
|
||||
raise exceptions.TempestConfigCreationFailure(message=msg)
|
||||
if response.http_status == 200:
|
||||
if response.status_code == 200:
|
||||
with open(self.img_path + '.tmp', 'wb') as img_file:
|
||||
for chunk in response.iter_content(chunk_size=1024):
|
||||
if chunk: # filter out keep-alive new chunks
|
||||
@ -91,7 +91,7 @@ class TempestConf(object):
|
||||
img_file.flush()
|
||||
os.rename(self.img_path + '.tmp', self.img_path)
|
||||
else:
|
||||
if response.http_status == 404:
|
||||
if response.status_code == 404:
|
||||
msg = _('Error on downloading cirros image, possibly'
|
||||
'invalid cirros_version or cirros_image in rally.conf')
|
||||
else:
|
||||
@ -227,7 +227,7 @@ class TempestConf(object):
|
||||
str(service in self.available_services))
|
||||
horizon_url = ('http://' +
|
||||
urlparse.urlparse(self.endpoint['auth_url']).hostname)
|
||||
horizon_availability = (requests.get(horizon_url).http_status == 200)
|
||||
horizon_availability = (requests.get(horizon_url).status_code == 200)
|
||||
# convert boolean to string because ConfigParser fails
|
||||
# on attempt to get option with boolean value
|
||||
self.conf.set(section_name, 'horizon', str(horizon_availability))
|
||||
|
@ -55,7 +55,7 @@ class ConfigTestCase(test.TestCase):
|
||||
@mock.patch("six.moves.builtins.open")
|
||||
def test__load_img_success(self, mock_open, mock_rename, mock_requests):
|
||||
mock_result = mock.MagicMock()
|
||||
mock_result.http_status = 200
|
||||
mock_result.status_code = 200
|
||||
mock_requests.get.return_value = mock_result
|
||||
mock_file = mock.MagicMock()
|
||||
mock_open.return_value = mock_file
|
||||
@ -68,7 +68,7 @@ class ConfigTestCase(test.TestCase):
|
||||
@mock.patch("rally.verification.verifiers.tempest.config.requests")
|
||||
def test__load_img_notfound(self, mock_requests):
|
||||
mock_result = mock.MagicMock()
|
||||
mock_result.http_status = 404
|
||||
mock_result.status_code = 404
|
||||
mock_requests.get.return_value = mock_result
|
||||
self.assertRaises(exceptions.TempestConfigCreationFailure,
|
||||
self.conf_generator._load_img)
|
||||
@ -272,7 +272,7 @@ class ConfigTestCase(test.TestCase):
|
||||
@mock.patch("rally.verification.verifiers.tempest.config.requests")
|
||||
def test__set_service_available(self, mock_requests):
|
||||
mock_result = mock.MagicMock()
|
||||
mock_result.http_status = 404
|
||||
mock_result.status_code = 404
|
||||
mock_requests.get.return_value = mock_result
|
||||
available_services = ("nova", "cinder", "glance")
|
||||
self.conf_generator.available_services = available_services
|
||||
@ -288,7 +288,7 @@ class ConfigTestCase(test.TestCase):
|
||||
@mock.patch("rally.verification.verifiers.tempest.config.requests")
|
||||
def test__set_service_available_horizon(self, mock_requests):
|
||||
mock_result = mock.MagicMock()
|
||||
mock_result.http_status = 200
|
||||
mock_result.status_code = 200
|
||||
mock_requests.get.return_value = mock_result
|
||||
self.conf_generator._set_service_available()
|
||||
self.assertEqual(self.conf_generator.conf.get(
|
||||
|
Loading…
Reference in New Issue
Block a user