refactor: inherit AuthWithRemoteUser for other providers

This commit makes it so that the AuthWithRemoteUser class no longer inherits
from other tests cases. Instead it inherits from `object` and I've added
several other classes that setup each token provider to test the cases in
AuthWithRemoteUser.

This helps us move towards making Fernet the default token provider.

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

Change-Id: I3ae63c8ff50a897ef0ae6e8129abc02e5b93747c
Partial-Bug: 1561054
This commit is contained in:
Lance Bragstad 2016-07-20 22:14:49 +00:00
parent 241d33d7a6
commit e9fc581440
1 changed files with 40 additions and 1 deletions

View File

@ -742,7 +742,7 @@ class AuthWithPasswordCredentials(AuthTest):
self.controller.authenticate(self.make_request(), body_dict)
class AuthWithRemoteUser(AuthTest):
class AuthWithRemoteUser(object):
def test_unscoped_remote_authn(self):
"""Verify getting an unscoped token with external authn."""
body_dict = _build_user_auth(
@ -823,6 +823,45 @@ class AuthWithRemoteUser(AuthTest):
self.assertNotIn('bind', token['access']['token'])
class FernetAuthWithRemoteUser(AuthWithRemoteUser, AuthTest):
def config_overrides(self):
super(FernetAuthWithRemoteUser, self).config_overrides()
self.config_fixture.config(group='token', provider='fernet')
self.useFixture(ksfixtures.KeyRepository(self.config_fixture))
def test_bind_with_kerberos(self):
self.config_fixture.config(group='token', bind=['kerberos'])
body_dict = _build_user_auth(tenant_name="BAR")
# NOTE(lbragstad): Bind authentication is not supported by the Fernet
# provider.
self.assertRaises(exception.NotImplemented,
self.controller.authenticate,
self.request_with_remote_user,
body_dict)
class UUIDAuthWithRemoteUser(AuthWithRemoteUser, AuthTest):
def config_overrides(self):
super(UUIDAuthWithRemoteUser, self).config_overrides()
self.config_fixture.config(group='token', provider='uuid')
class PKIAuthWithRemoteUser(AuthWithRemoteUser, AuthTest):
def config_overrides(self):
super(PKIAuthWithRemoteUser, self).config_overrides()
self.config_fixture.config(group='token', provider='pki')
class PKIZAuthWithRemoteUser(AuthWithRemoteUser, AuthTest):
def config_overrides(self):
super(PKIZAuthWithRemoteUser, self).config_overrides()
self.config_fixture.config(group='token', provider='pkiz')
class AuthWithTrust(AuthTest):
def setUp(self):
super(AuthWithTrust, self).setUp()