Run AuthWithToken against all token providers

This makes AuthWithToken inherit directly from `object` and introduces other
test classes with specific test setup for each format to inherit AuthWithToken.
This will make the switch to Fernet as default provider 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: I87a12160e31b2467af01dc8e7b01cc59d5907675
Partial-Bug: 1561054
This commit is contained in:
Lance Bragstad 2016-07-18 21:49:53 +00:00
parent e8cd48fa48
commit 241d33d7a6
1 changed files with 20 additions and 2 deletions

View File

@ -256,7 +256,7 @@ class AuthBadRequests(AuthTest):
empty_request, body_dict)
class AuthWithToken(AuthTest):
class AuthWithToken(object):
def test_unscoped_token(self):
"""Verify getting an unscoped token with password creds."""
body_dict = _build_user_auth(username='FOO',
@ -614,7 +614,13 @@ class AuthWithToken(AuthTest):
return [None, None]
class FernetAuthWithToken(AuthWithToken):
class UUIDAuthWithToken(AuthWithToken, AuthTest):
def config_overrides(self):
super(UUIDAuthWithToken, self).config_overrides()
self.config_fixture.config(group='token', provider='uuid')
class FernetAuthWithToken(AuthWithToken, AuthTest):
def config_overrides(self):
super(FernetAuthWithToken, self).config_overrides()
self.config_fixture.config(group='token', provider='fernet')
@ -632,6 +638,18 @@ class FernetAuthWithToken(AuthWithToken):
self.skip_test_overrides('Fernet with v2.0 and revocation is broken')
class PKIAuthWithToken(AuthWithToken, AuthTest):
def config_overrides(self):
super(PKIAuthWithToken, self).config_overrides()
self.config_fixture.config(group='token', provider='pki')
class PKIZAuthWithToken(AuthWithToken, AuthTest):
def config_overrides(self):
super(PKIZAuthWithToken, self).config_overrides()
self.config_fixture.config(group='token', provider='pkiz')
class AuthWithPasswordCredentials(AuthTest):
def test_auth_invalid_user(self):
"""Verify exception is raised if invalid user."""