diff options
author | Zuul <zuul@review.openstack.org> | 2018-07-23 22:08:33 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2018-07-23 22:08:33 +0000 |
commit | fcc20884091874beb03f99b63db3fcb11d052aa4 (patch) | |
tree | d78b788dab2c85825e71faca313b61d76c4d32d3 /ironic/tests/unit/common/test_glance_service.py | |
parent | bf76dd4fdcb6fbb506253344a6df20f1ead0e420 (diff) | |
parent | e9e4d8870c0b9f46bf4d1bb29df9394cd4144f83 (diff) | |
download | ironic-fcc20884091874beb03f99b63db3fcb11d052aa4.tar.gz |
Merge "Remove endpoint_type from configuration"
Diffstat (limited to 'ironic/tests/unit/common/test_glance_service.py')
-rw-r--r-- | ironic/tests/unit/common/test_glance_service.py | 74 |
1 files changed, 1 insertions, 73 deletions
diff --git a/ironic/tests/unit/common/test_glance_service.py b/ironic/tests/unit/common/test_glance_service.py index 0e8344b06..782c4423b 100644 --- a/ironic/tests/unit/common/test_glance_service.py +++ b/ironic/tests/unit/common/test_glance_service.py @@ -23,7 +23,6 @@ from keystoneauth1 import loading as kaloading import mock from oslo_config import cfg from oslo_utils import uuidutils -from six.moves.urllib import parse as urlparse import testtools from ironic.common import context @@ -686,65 +685,6 @@ class TestGlanceSwiftTempURL(base.TestCase): self.assertFalse(tempurl_mock.called) @mock.patch('swiftclient.utils.generate_temp_url', autospec=True) - def test_swift_temp_url_radosgw(self, tempurl_mock): - self.config(object_store_endpoint_type='radosgw', group='deploy') - path = ('/v1' - '/glance' - '/757274c4-2856-4bd2-bb20-9a4a231e187b') - tempurl_mock.return_value = ( - path + '?temp_url_sig=hmacsig&temp_url_expires=1400001200') - - self.service._validate_temp_url_config = mock.Mock() - - temp_url = self.service.swift_temp_url(image_info=self.fake_image) - - self.assertEqual( - (urlparse.urljoin(CONF.glance.swift_endpoint_url, 'swift') - + tempurl_mock.return_value), - temp_url) - tempurl_mock.assert_called_with( - path=path, - seconds=CONF.glance.swift_temp_url_duration, - key=CONF.glance.swift_temp_url_key, - method='GET') - - @mock.patch('swiftclient.utils.generate_temp_url', autospec=True) - def test_swift_temp_url_radosgw_endpoint_with_swift(self, tempurl_mock): - self.config(swift_endpoint_url='https://swift.radosgw.com/swift', - group='glance') - self.config(object_store_endpoint_type='radosgw', group='deploy') - path = ('/v1' - '/glance' - '/757274c4-2856-4bd2-bb20-9a4a231e187b') - tempurl_mock.return_value = ( - path + '?temp_url_sig=hmacsig&temp_url_expires=1400001200') - - self.service._validate_temp_url_config = mock.Mock() - - temp_url = self.service.swift_temp_url(image_info=self.fake_image) - - self.assertEqual( - CONF.glance.swift_endpoint_url + tempurl_mock.return_value, - temp_url) - tempurl_mock.assert_called_with( - path=path, - seconds=CONF.glance.swift_temp_url_duration, - key=CONF.glance.swift_temp_url_key, - method='GET') - - @mock.patch('swiftclient.utils.generate_temp_url', autospec=True) - def test_swift_temp_url_radosgw_endpoint_invalid(self, tempurl_mock): - self.config(swift_endpoint_url='https://swift.radosgw.com/eggs/', - group='glance') - self.config(object_store_endpoint_type='radosgw', group='deploy') - self.service._validate_temp_url_config = mock.Mock() - - self.assertRaises(exception.InvalidParameterValue, - self.service.swift_temp_url, - self.fake_image) - self.assertFalse(tempurl_mock.called) - - @mock.patch('swiftclient.utils.generate_temp_url', autospec=True) def test_swift_temp_url_multiple_containers(self, tempurl_mock): self.config(swift_store_multiple_containers_seed=8, @@ -777,20 +717,8 @@ class TestGlanceSwiftTempURL(base.TestCase): def test__validate_temp_url_config(self): self.service._validate_temp_url_config() - def test__validate_temp_url_key_no_exception(self): + def test__validate_temp_url_no_key_no_exception(self): self.config(swift_temp_url_key=None, group='glance') - self.config(object_store_endpoint_type='swift', group='deploy') - self.service._validate_temp_url_config() - - def test__validate_temp_url_key_exception(self): - self.config(swift_temp_url_key=None, group='glance') - self.config(object_store_endpoint_type='radosgw', group='deploy') - self.assertRaises(exception.MissingParameterValue, - self.service._validate_temp_url_config) - - def test__validate_temp_url_no_account_exception_radosgw(self): - self.config(swift_account=None, group='glance') - self.config(object_store_endpoint_type='radosgw', group='deploy') self.service._validate_temp_url_config() def test__validate_temp_url_endpoint_less_than_download_delay(self): |