Refactor TestAuthExternalDomain to not inherit tests

Previously, TestAuthExternalDomain was inheriting from test_v3.RestfulTestCase,
which allowed it to run as part of the keystone test suite. This commit breaks
it into a class that only inherits from `object` and introduces 3 other classes
the inherit the old TestAuthExternalDomain and run the tests according to the
setup needed.

Since the Fernet provider doesn't support bind authentication, there is no test
class to setup Fernet and run the TestAuthExternalDomain behaviors. This change
will make defaulting to Fernet easier.

This fix was originally a part of https://review.openstack.org/#/c/258650 but
this is an attempt to break 258650 into smaller, more reviewable, pieces.

Co-Authored-By: Raildo Mascena <raildo@lsd.ufcg.edu.br>
Co-Authored-By: Adam Young <ayound@redhat.com>

Change-Id: I28e575ddada8492bd4fc17b78cb00651d9d4af07
Partial-Bug: 1561054
This commit is contained in:
Lance Bragstad 2016-07-18 19:57:49 +00:00
parent 6bcc03ff1e
commit 12966b8851
1 changed files with 33 additions and 7 deletions

View File

@ -3592,14 +3592,9 @@ class TestAuthExternalDisabled(test_v3.RestfulTestCase):
auth_context)
class TestAuthExternalDomain(test_v3.RestfulTestCase):
class AuthExternalDomainBehavior(object):
content_type = 'json'
def config_overrides(self):
super(TestAuthExternalDomain, self).config_overrides()
self.kerberos = False
self.auth_plugin_config_override(external='Domain')
def test_remote_user_with_realm(self):
api = auth.controllers.Auth()
remote_user = self.user['name']
@ -3648,6 +3643,37 @@ class TestAuthExternalDomain(test_v3.RestfulTestCase):
self.assertEqual(self.user['name'], token['bind']['kerberos'])
class TestAuthExternalDomainBehaviorWithUUID(AuthExternalDomainBehavior,
test_v3.RestfulTestCase):
def config_overrides(self):
super(TestAuthExternalDomainBehaviorWithUUID, self).config_overrides()
self.kerberos = False
self.auth_plugin_config_override(external='Domain')
self.config_fixture.config(group='token', provider='uuid')
class TestAuthExternalDomainBehaviorWithPKI(AuthExternalDomainBehavior,
test_v3.RestfulTestCase):
def config_overrides(self):
super(TestAuthExternalDomainBehaviorWithPKI, self).config_overrides()
self.kerberos = False
self.auth_plugin_config_override(external='Domain')
self.config_fixture.config(group='token', provider='pki')
class TestAuthExternalDomainBehaviorWithPKIZ(AuthExternalDomainBehavior,
test_v3.RestfulTestCase):
def config_overrides(self):
super(TestAuthExternalDomainBehaviorWithPKIZ, self).config_overrides()
self.kerberos = False
self.auth_plugin_config_override(external='Domain')
self.config_fixture.config(group='token', provider='pkiz')
# NOTE(lbragstad): The Fernet token provider doesn't support bind
# authentication so we don't inhereit TestAuthExternalDomain here to test it.
class TestAuthExternalDefaultDomain(test_v3.RestfulTestCase):
content_type = 'json'
@ -3704,7 +3730,7 @@ class TestAuthExternalDefaultDomain(test_v3.RestfulTestCase):
token['bind']['kerberos'])
class TestAuthKerberos(TestAuthExternalDomain):
class TestAuthKerberos(AuthExternalDomainBehavior, test_v3.RestfulTestCase):
def config_overrides(self):
super(TestAuthKerberos, self).config_overrides()