diff options
author | Zuul <zuul@review.opendev.org> | 2021-08-11 10:11:23 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-08-11 10:11:23 +0000 |
commit | 108947320d835ff10a4e9fd5c0b8f1a36b4675ed (patch) | |
tree | 510ff48390bcd4f6c184bdf275d047bc10e9312c /glance_store/tests | |
parent | c7f3aa991f9f95d166d61463da6aaddbe8d619ab (diff) | |
parent | 16924dbe51c8e3d26c9dda49d6007b73a9869337 (diff) | |
download | glance_store-108947320d835ff10a4e9fd5c0b8f1a36b4675ed.tar.gz |
Merge "swift: Take into account swift_store_endpoint"
Diffstat (limited to 'glance_store/tests')
-rw-r--r-- | glance_store/tests/unit/test_connection_manager.py | 1 | ||||
-rw-r--r-- | glance_store/tests/unit/test_swift_store.py | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/glance_store/tests/unit/test_connection_manager.py b/glance_store/tests/unit/test_connection_manager.py index 20be2fd..ac1ab91 100644 --- a/glance_store/tests/unit/test_connection_manager.py +++ b/glance_store/tests/unit/test_connection_manager.py @@ -46,6 +46,7 @@ class TestConnectionManager(base.StoreBaseTest): auth_version='3') store.backend_group = None + store.conf_endpoint = None store.init_client.return_value = self.client return store diff --git a/glance_store/tests/unit/test_swift_store.py b/glance_store/tests/unit/test_swift_store.py index 809d50e..6b5d659 100644 --- a/glance_store/tests/unit/test_swift_store.py +++ b/glance_store/tests/unit/test_swift_store.py @@ -1534,6 +1534,31 @@ class TestSingleTenantStoreConnections(base.StoreBaseTest): 'endpoint_type': 'publicURL'}, connection.os_options) + @mock.patch("keystoneauth1.session.Session.get_endpoint") + @mock.patch("keystoneauth1.session.Session.get_auth_headers", + new=mock.Mock()) + def _test_connection_manager_authv3_conf_endpoint( + self, mock_ep, expected_endpoint="https://from-catalog.com"): + self.config(swift_store_auth_version='3') + mock_ep.return_value = "https://from-catalog.com" + ctx = mock.MagicMock() + self.store.configure() + connection_manager = manager.SingleTenantConnectionManager( + store=self.store, + store_location=self.location, + context=ctx + ) + conn = connection_manager._init_connection() + self.assertEqual(expected_endpoint, conn.preauthurl) + + def test_connection_manager_authv3_without_conf_endpoint(self): + self._test_connection_manager_authv3_conf_endpoint() + + def test_connection_manager_authv3_with_conf_endpoint(self): + self.config(swift_store_endpoint='http://localhost') + self._test_connection_manager_authv3_conf_endpoint( + expected_endpoint='http://localhost') + def test_connection_with_no_trailing_slash(self): self.location.auth_or_store_url = 'example.com/v2' connection = self.store.get_connection(self.location) |