Skip to content

Commit

Permalink
Enabling SQL Catalog tests (bug 958950)
Browse files Browse the repository at this point in the history
Change-Id: I9d33d95ffa357b88f099a5a37aa4a139d93fd82f
  • Loading branch information
dolph committed Aug 1, 2012
1 parent 2b2d0a1 commit f82c7c2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 27 deletions.
2 changes: 2 additions & 0 deletions keystone/catalog/backends/sql.py
Expand Up @@ -127,6 +127,8 @@ def get_endpoint(self, endpoint_id):
session = self.get_session()
endpoint_ref = session.query(Endpoint)
endpoint_ref = endpoint_ref.filter_by(id=endpoint_id).first()
if not endpoint_ref:
raise exception.EndpointNotFound(endpoint_id=endpoint_id)
return endpoint_ref.to_dict()

def list_endpoints(self):
Expand Down
12 changes: 7 additions & 5 deletions tests/test_backend.py
Expand Up @@ -651,12 +651,14 @@ def test_null_expires_token(self):
class CatalogTests(object):
def test_service_crud(self):
new_service = {
'id': 'MY_SERVICE',
'type': 'myservice',
'name': 'My Service',
'description': 'My description'
'id': uuid.uuid4().hex,
'type': uuid.uuid4().hex,
'name': uuid.uuid4().hex,
'description': uuid.uuid4().hex,
}
res = self.catalog_api.create_service(new_service['id'], new_service)
res = self.catalog_api.create_service(
new_service['id'],
new_service.copy())
self.assertDictEqual(res, new_service)

service_id = new_service['id']
Expand Down
34 changes: 12 additions & 22 deletions tests/test_backend_sql.py
Expand Up @@ -16,6 +16,8 @@

import uuid

from keystone import catalog
from keystone.catalog.backends import sql as catalog_sql
from keystone.common.sql import util as sql_util
from keystone import config
from keystone import exception
Expand Down Expand Up @@ -142,25 +144,13 @@ def setUp(self):
self.token_api = token_sql.Token()


#class SqlCatalog(test_backend_kvs.KvsCatalog):
# def setUp(self):
# super(SqlCatalog, self).setUp()
# self.catalog_api = sql.SqlCatalog()
# self._load_fixtures()

# def _load_fixtures(self):
# self.catalog_foobar = self.catalog_api._create_catalog(
# 'foo', 'bar',
# {'RegionFoo': {'service_bar': {'foo': 'bar'}}})

# def test_get_catalog_bad_user(self):
# catalog_ref = self.catalog_api.get_catalog('foo' + 'WRONG', 'bar')
# self.assert_(catalog_ref is None)

# def test_get_catalog_bad_tenant(self):
# catalog_ref = self.catalog_api.get_catalog('foo', 'bar' + 'WRONG')
# self.assert_(catalog_ref is None)

# def test_get_catalog(self):
# catalog_ref = self.catalog_api.get_catalog('foo', 'bar')
# self.assertDictEqual(catalog_ref, self.catalog_foobar)
class SqlCatalog(test.TestCase, test_backend.CatalogTests):
def setUp(self):
super(SqlCatalog, self).setUp()
self.config([test.etcdir('keystone.conf.sample'),
test.testsdir('test_overrides.conf'),
test.testsdir('backend_sql.conf')])
sql_util.setup_test_database()
self.catalog_api = catalog_sql.Catalog()
self.catalog_man = catalog.Manager()
self.load_fixtures(default_fixtures)

0 comments on commit f82c7c2

Please sign in to comment.