From db5d2bcf1e90316f8014723a3136daed87ecf0c4 Mon Sep 17 00:00:00 2001 From: wangxiyuan Date: Fri, 15 Jun 2018 17:23:29 +0800 Subject: [PATCH] Remove get_catalog from manage layer the get_catalog method which is used by V2 now is used nowhere. It's safe to remove it. Change-Id: I709d82868531c4cb59c6a3195b8c9136473217e3 --- keystone/catalog/core.py | 7 ------- keystone/tests/unit/test_backend_sql.py | 23 +++++++++++------------ 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/keystone/catalog/core.py b/keystone/catalog/core.py index 4f096a0183..0de8b6d1a5 100644 --- a/keystone/catalog/core.py +++ b/keystone/catalog/core.py @@ -215,13 +215,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) diff --git a/keystone/tests/unit/test_backend_sql.py b/keystone/tests/unit/test_backend_sql.py index e709cf204c..68b773e974 100644 --- a/keystone/tests/unit/test_backend_sql.py +++ b/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()