Browse Source

Merge "Remove get_catalog from manage layer"

changes/76/593476/1
Zuul 3 years ago
committed by Gerrit Code Review
parent
commit
06b024a223
  1. 7
      keystone/catalog/core.py
  2. 23
      keystone/tests/unit/test_backend_sql.py

7
keystone/catalog/core.py

@ -233,13 +233,6 @@ class Manager(manager.Manager):
def list_endpoints(self, hints=None):
return self.driver.list_endpoints(hints or driver_hints.Hints())
@MEMOIZE_COMPUTED_CATALOG
def get_catalog(self, user_id, project_id):
try:
return self.driver.get_catalog(user_id, project_id)
except exception.NotFound:
raise exception.NotFound('Catalog not found for user and tenant')
@MEMOIZE_COMPUTED_CATALOG
def get_v3_catalog(self, user_id, project_id):
return self.driver.get_v3_catalog(user_id, project_id)

23
keystone/tests/unit/test_backend_sql.py

@ -768,7 +768,7 @@ class SqlCatalog(SqlTests, catalog_tests.CatalogTests):
_legacy_endpoint_id_in_endpoint = True
_enabled_default_to_true_when_creating_endpoint = True
def test_catalog_ignored_malformed_urls(self):
def test_get_v3_catalog_project_non_exist(self):
service = unit.new_service_ref()
PROVIDERS.catalog_api.create_service(service['id'], service)
@ -777,12 +777,12 @@ class SqlCatalog(SqlTests, catalog_tests.CatalogTests):
url=malformed_url,
region_id=None)
PROVIDERS.catalog_api.create_endpoint(endpoint['id'], endpoint.copy())
self.assertRaises(exception.ProjectNotFound,
PROVIDERS.catalog_api.get_v3_catalog,
'fake-user',
'fake-tenant')
# NOTE(dstanek): there are no valid URLs, so nothing is in the catalog
catalog = PROVIDERS.catalog_api.get_catalog('fake-user', 'fake-tenant')
self.assertEqual({}, catalog)
def test_get_catalog_with_empty_public_url(self):
def test_get_v3_catalog_with_empty_public_url(self):
service = unit.new_service_ref()
PROVIDERS.catalog_api.create_service(service['id'], service)
@ -790,13 +790,12 @@ class SqlCatalog(SqlTests, catalog_tests.CatalogTests):
region_id=None)
PROVIDERS.catalog_api.create_endpoint(endpoint['id'], endpoint.copy())
catalog = PROVIDERS.catalog_api.get_catalog('user', 'tenant')
catalog_endpoint = catalog[endpoint['region_id']][service['type']]
catalog = PROVIDERS.catalog_api.get_v3_catalog(self.user_foo['id'],
self.tenant_bar['id'])
catalog_endpoint = catalog[0]
self.assertEqual(service['name'], catalog_endpoint['name'])
self.assertEqual(endpoint['id'], catalog_endpoint['id'])
self.assertEqual('', catalog_endpoint['publicURL'])
self.assertIsNone(catalog_endpoint.get('adminURL'))
self.assertIsNone(catalog_endpoint.get('internalURL'))
self.assertEqual(service['id'], catalog_endpoint['id'])
self.assertEqual([], catalog_endpoint['endpoints'])
def test_create_endpoint_region_returns_not_found(self):
service = unit.new_service_ref()

Loading…
Cancel
Save