Fix incorrect signature in federation legacy V8 wrapper

The abstract signature for the create_mapping driver method in the
Liberty V8 driver interface was wrong, which was then inadvertently
used to create the V9 wrapper. This fixes that issue and adds attitional
legacy tests to ensure the federation V8 CRUD operations are covered.

There are numerous other inconsistency in the docstrings of the
federation abstract methods, these are resolved in a follow on patch.

Closes-bug: #1533346

Change-Id: I1d0aa2a652c681512e5268567b994ce3459e8eac
This commit is contained in:
Henry Nash 2016-01-12 20:06:45 +00:00 committed by Steve Martinelli
parent ae87c03813
commit 50986a766e
2 changed files with 42 additions and 17 deletions

View File

@ -226,12 +226,14 @@ class FederationDriverBase(object):
raise exception.NotImplemented() # pragma: no cover
@abc.abstractmethod
def create_mapping(self, mapping_ref):
def create_mapping(self, mapping_id, mapping):
"""Create a mapping.
:param mapping_ref: mapping ref with mapping name
:type mapping_ref: dict
:returns: mapping_ref
:param mapping_id: id of mapping ref
:type mapping_id: string
:param mapping: mapping ref with mapping name
:type mapping: dict
:returns: mapping ref
"""
raise exception.NotImplemented() # pragma: no cover
@ -473,8 +475,8 @@ class V9FederationWrapperForV8Driver(FederationDriverV9):
def delete_protocol(self, idp_id, protocol_id):
self.driver.delete_protocol(idp_id, protocol_id)
def create_mapping(self, mapping_ref):
return self.driver.create_mapping(mapping_ref)
def create_mapping(self, mapping_id, mapping):
return self.driver.create_mapping(mapping_id, mapping)
def delete_mapping(self, mapping_id):
self.driver.delete_mapping(mapping_id)

View File

@ -13,19 +13,42 @@
from keystone.tests.unit import test_v3_federation
class FederatedIdentityProviderTestsV8(
test_v3_federation.FederatedIdentityProviderTests):
"""Test that a V8 driver still passes the same tests.
We use the SQL driver as an example of a V8 legacy driver.
"""
def config_overrides(self):
super(FederatedIdentityProviderTestsV8, self).config_overrides()
# V8 SQL specific driver overrides
class FederatedSetupMixinV8(object):
def useV8driver(self):
# We use the SQL driver as an example V8 driver, so override
# the current driver with that version.
self.config_fixture.config(
group='federation',
driver='keystone.federation.V8_backends.sql.Federation')
self.use_specific_sql_driver_version(
'keystone.federation', 'backends', 'V8_')
class FederatedIdentityProviderTestsV8(
test_v3_federation.FederatedIdentityProviderTests,
FederatedSetupMixinV8):
"""Test that a V8 driver still passes the same tests."""
def config_overrides(self):
super(FederatedIdentityProviderTestsV8, self).config_overrides()
self.useV8driver()
class MappingCRUDTestsV8(
test_v3_federation.MappingCRUDTests,
FederatedSetupMixinV8):
"""Test that a V8 driver still passes the same tests."""
def config_overrides(self):
super(MappingCRUDTestsV8, self).config_overrides()
self.useV8driver()
class ServiceProviderTestsV8(
test_v3_federation.ServiceProviderTests,
FederatedSetupMixinV8):
"""Test that a V8 driver still passes the same tests."""
def config_overrides(self):
super(ServiceProviderTestsV8, self).config_overrides()
self.useV8driver()