Seperate Client base test class
Client tests are broadly seperated into v2 and v3. These folders don't distinguish between the tests that are on v2/v3 auth and those that are CRUD related. This means that the base v2 and v3 test class always create a client object for the tests to use, even if they don't need it. Whilst this isn't a big deal now, we want to be able to seperate only those tests that require a client so we can test them with multiple different styles of client. Add a new ClientTestCase class that will construct a client object for the tests that need it. Change-Id: I61f463ac5e878107c1889672f4d4cf5874821363
This commit is contained in:
@@ -17,7 +17,7 @@ from keystoneclient.tests.unit import client_fixtures
|
|||||||
from keystoneclient.tests.unit.v2_0 import utils
|
from keystoneclient.tests.unit.v2_0 import utils
|
||||||
|
|
||||||
|
|
||||||
class CertificateTests(utils.TestCase, testresources.ResourcedTestCase):
|
class CertificateTests(utils.ClientTestCase, testresources.ResourcedTestCase):
|
||||||
|
|
||||||
resources = [('examples', client_fixtures.EXAMPLES_RESOURCE)]
|
resources = [('examples', client_fixtures.EXAMPLES_RESOURCE)]
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ from keystoneclient.tests.unit.v2_0 import utils
|
|||||||
from keystoneclient.v2_0 import ec2
|
from keystoneclient.v2_0 import ec2
|
||||||
|
|
||||||
|
|
||||||
class EC2Tests(utils.TestCase):
|
class EC2Tests(utils.ClientTestCase):
|
||||||
|
|
||||||
def test_create(self):
|
def test_create(self):
|
||||||
user_id = 'usr'
|
user_id = 'usr'
|
||||||
|
@@ -16,7 +16,7 @@ from keystoneclient.tests.unit.v2_0 import utils
|
|||||||
from keystoneclient.v2_0 import endpoints
|
from keystoneclient.v2_0 import endpoints
|
||||||
|
|
||||||
|
|
||||||
class EndpointTests(utils.TestCase):
|
class EndpointTests(utils.ClientTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(EndpointTests, self).setUp()
|
super(EndpointTests, self).setUp()
|
||||||
self.TEST_ENDPOINTS = {
|
self.TEST_ENDPOINTS = {
|
||||||
|
@@ -14,7 +14,7 @@ from keystoneclient.tests.unit.v2_0 import utils
|
|||||||
from keystoneclient.v2_0 import extensions
|
from keystoneclient.v2_0 import extensions
|
||||||
|
|
||||||
|
|
||||||
class ExtensionTests(utils.TestCase):
|
class ExtensionTests(utils.ClientTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ExtensionTests, self).setUp()
|
super(ExtensionTests, self).setUp()
|
||||||
self.TEST_EXTENSIONS = {
|
self.TEST_EXTENSIONS = {
|
||||||
|
@@ -16,7 +16,7 @@ from keystoneclient.tests.unit.v2_0 import utils
|
|||||||
from keystoneclient.v2_0 import roles
|
from keystoneclient.v2_0 import roles
|
||||||
|
|
||||||
|
|
||||||
class RoleTests(utils.TestCase):
|
class RoleTests(utils.ClientTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(RoleTests, self).setUp()
|
super(RoleTests, self).setUp()
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ from keystoneclient.tests.unit.v2_0 import utils
|
|||||||
from keystoneclient.v2_0 import services
|
from keystoneclient.v2_0 import services
|
||||||
|
|
||||||
|
|
||||||
class ServiceTests(utils.TestCase):
|
class ServiceTests(utils.ClientTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ServiceTests, self).setUp()
|
super(ServiceTests, self).setUp()
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ from keystoneclient.v2_0 import tenants
|
|||||||
from keystoneclient.v2_0 import users
|
from keystoneclient.v2_0 import users
|
||||||
|
|
||||||
|
|
||||||
class TenantTests(utils.TestCase):
|
class TenantTests(utils.ClientTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TenantTests, self).setUp()
|
super(TenantTests, self).setUp()
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ from keystoneclient.v2_0 import client
|
|||||||
from keystoneclient.v2_0 import tokens
|
from keystoneclient.v2_0 import tokens
|
||||||
|
|
||||||
|
|
||||||
class TokenTests(utils.TestCase):
|
class TokenTests(utils.ClientTestCase):
|
||||||
|
|
||||||
def test_delete(self):
|
def test_delete(self):
|
||||||
id_ = uuid.uuid4().hex
|
id_ = uuid.uuid4().hex
|
||||||
|
@@ -17,7 +17,7 @@ from keystoneclient.v2_0 import roles
|
|||||||
from keystoneclient.v2_0 import users
|
from keystoneclient.v2_0 import users
|
||||||
|
|
||||||
|
|
||||||
class UserTests(utils.TestCase):
|
class UserTests(utils.ClientTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(UserTests, self).setUp()
|
super(UserTests, self).setUp()
|
||||||
self.ADMIN_USER_ID = uuid.uuid4().hex
|
self.ADMIN_USER_ID = uuid.uuid4().hex
|
||||||
|
@@ -76,14 +76,17 @@ class TestCase(UnauthenticatedTestCase):
|
|||||||
"name": "swift"
|
"name": "swift"
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
def stub_auth(self, **kwargs):
|
||||||
|
self.stub_url('POST', ['tokens'], **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
class ClientTestCase(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestCase, self).setUp()
|
super(ClientTestCase, self).setUp()
|
||||||
|
|
||||||
# Creating a Client not using session is deprecated.
|
# Creating a Client not using session is deprecated.
|
||||||
with self.deprecations.expect_deprecations_here():
|
with self.deprecations.expect_deprecations_here():
|
||||||
self.client = client.Client(token=self.TEST_TOKEN,
|
self.client = client.Client(token=self.TEST_TOKEN,
|
||||||
auth_url=self.TEST_URL,
|
auth_url=self.TEST_URL,
|
||||||
endpoint=self.TEST_URL)
|
endpoint=self.TEST_URL)
|
||||||
|
|
||||||
def stub_auth(self, **kwargs):
|
|
||||||
self.stub_url('POST', ['tokens'], **kwargs)
|
|
||||||
|
@@ -12,15 +12,12 @@
|
|||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from keystoneclient.auth.identity import v3
|
|
||||||
from keystoneclient import fixture
|
from keystoneclient import fixture
|
||||||
from keystoneclient import session
|
|
||||||
from keystoneclient.tests.unit.v3 import utils
|
from keystoneclient.tests.unit.v3 import utils
|
||||||
from keystoneclient.v3 import auth
|
from keystoneclient.v3 import auth
|
||||||
from keystoneclient.v3 import client
|
|
||||||
|
|
||||||
|
|
||||||
class AuthProjectsTest(utils.TestCase):
|
class AuthProjectsTest(utils.ClientTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(AuthProjectsTest, self).setUp()
|
super(AuthProjectsTest, self).setUp()
|
||||||
@@ -32,12 +29,6 @@ class AuthProjectsTest(utils.TestCase):
|
|||||||
[],
|
[],
|
||||||
json={'version': fixture.V3Discovery(self.TEST_URL)})
|
json={'version': fixture.V3Discovery(self.TEST_URL)})
|
||||||
|
|
||||||
self.auth = v3.Password(auth_url=self.TEST_URL,
|
|
||||||
user_id=self.v3token.user_id,
|
|
||||||
password=uuid.uuid4().hex)
|
|
||||||
self.session = session.Session(auth=self.auth)
|
|
||||||
self.client = client.Client(session=self.session)
|
|
||||||
|
|
||||||
def create_resource(self, id=None, name=None, **kwargs):
|
def create_resource(self, id=None, name=None, **kwargs):
|
||||||
kwargs['id'] = id or uuid.uuid4().hex
|
kwargs['id'] = id or uuid.uuid4().hex
|
||||||
kwargs['name'] = name or uuid.uuid4().hex
|
kwargs['name'] = name or uuid.uuid4().hex
|
||||||
|
@@ -655,7 +655,7 @@ class AuthenticateviaADFSTests(utils.TestCase):
|
|||||||
self.assertEqual(saml2_fixtures.UNSCOPED_TOKEN['token'], token_json)
|
self.assertEqual(saml2_fixtures.UNSCOPED_TOKEN['token'], token_json)
|
||||||
|
|
||||||
|
|
||||||
class SAMLGenerationTests(utils.TestCase):
|
class SAMLGenerationTests(utils.ClientTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(SAMLGenerationTests, self).setUp()
|
super(SAMLGenerationTests, self).setUp()
|
||||||
|
@@ -16,7 +16,7 @@ from keystoneclient.tests.unit.v3 import utils
|
|||||||
from keystoneclient.v3 import credentials
|
from keystoneclient.v3 import credentials
|
||||||
|
|
||||||
|
|
||||||
class CredentialTests(utils.TestCase, utils.CrudTests):
|
class CredentialTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(CredentialTests, self).setUp()
|
super(CredentialTests, self).setUp()
|
||||||
self.key = 'credential'
|
self.key = 'credential'
|
||||||
|
@@ -16,7 +16,7 @@ from keystoneclient.tests.unit.v3 import utils
|
|||||||
from keystoneclient.v3 import domains
|
from keystoneclient.v3 import domains
|
||||||
|
|
||||||
|
|
||||||
class DomainTests(utils.TestCase, utils.CrudTests):
|
class DomainTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(DomainTests, self).setUp()
|
super(DomainTests, self).setUp()
|
||||||
self.key = 'domain'
|
self.key = 'domain'
|
||||||
|
@@ -14,7 +14,7 @@ from keystoneclient.tests.unit.v3 import utils
|
|||||||
from keystoneclient.v3 import ec2
|
from keystoneclient.v3 import ec2
|
||||||
|
|
||||||
|
|
||||||
class EC2Tests(utils.TestCase):
|
class EC2Tests(utils.ClientTestCase):
|
||||||
|
|
||||||
def test_create(self):
|
def test_create(self):
|
||||||
user_id = 'usr'
|
user_id = 'usr'
|
||||||
|
@@ -37,7 +37,7 @@ class EndpointTestUtils(object):
|
|||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
|
|
||||||
class EndpointFilterTests(utils.TestCase, EndpointTestUtils):
|
class EndpointFilterTests(utils.ClientTestCase, EndpointTestUtils):
|
||||||
"""Test project-endpoint associations (a.k.a. EndpointFilter Extension).
|
"""Test project-endpoint associations (a.k.a. EndpointFilter Extension).
|
||||||
|
|
||||||
Endpoint filter provides associations between service endpoints and
|
Endpoint filter provides associations between service endpoints and
|
||||||
|
@@ -18,7 +18,7 @@ from keystoneclient.tests.unit.v3 import test_endpoint_filter
|
|||||||
from keystoneclient.tests.unit.v3 import utils
|
from keystoneclient.tests.unit.v3 import utils
|
||||||
|
|
||||||
|
|
||||||
class EndpointPolicyTests(utils.TestCase,
|
class EndpointPolicyTests(utils.ClientTestCase,
|
||||||
test_endpoint_filter.EndpointTestUtils):
|
test_endpoint_filter.EndpointTestUtils):
|
||||||
"""Test policy-endpoint associations (a.k.a. EndpointPolicy Extension)."""
|
"""Test policy-endpoint associations (a.k.a. EndpointPolicy Extension)."""
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ from keystoneclient.tests.unit.v3 import utils
|
|||||||
from keystoneclient.v3 import endpoints
|
from keystoneclient.v3 import endpoints
|
||||||
|
|
||||||
|
|
||||||
class EndpointTests(utils.TestCase, utils.CrudTests):
|
class EndpointTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(EndpointTests, self).setUp()
|
super(EndpointTests, self).setUp()
|
||||||
self.key = 'endpoint'
|
self.key = 'endpoint'
|
||||||
|
@@ -26,7 +26,7 @@ from keystoneclient.v3 import domains
|
|||||||
from keystoneclient.v3 import projects
|
from keystoneclient.v3 import projects
|
||||||
|
|
||||||
|
|
||||||
class IdentityProviderTests(utils.TestCase, utils.CrudTests):
|
class IdentityProviderTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(IdentityProviderTests, self).setUp()
|
super(IdentityProviderTests, self).setUp()
|
||||||
self.key = 'identity_provider'
|
self.key = 'identity_provider'
|
||||||
@@ -88,7 +88,7 @@ class IdentityProviderTests(utils.TestCase, utils.CrudTests):
|
|||||||
self.assertEntityRequestBodyIs(req_ref)
|
self.assertEntityRequestBodyIs(req_ref)
|
||||||
|
|
||||||
|
|
||||||
class MappingTests(utils.TestCase, utils.CrudTests):
|
class MappingTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(MappingTests, self).setUp()
|
super(MappingTests, self).setUp()
|
||||||
self.key = 'mapping'
|
self.key = 'mapping'
|
||||||
@@ -122,7 +122,7 @@ class MappingTests(utils.TestCase, utils.CrudTests):
|
|||||||
self.assertEntityRequestBodyIs(manager_ref)
|
self.assertEntityRequestBodyIs(manager_ref)
|
||||||
|
|
||||||
|
|
||||||
class ProtocolTests(utils.TestCase, utils.CrudTests):
|
class ProtocolTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ProtocolTests, self).setUp()
|
super(ProtocolTests, self).setUp()
|
||||||
self.key = 'protocol'
|
self.key = 'protocol'
|
||||||
@@ -327,14 +327,14 @@ class ProtocolTests(utils.TestCase, utils.CrudTests):
|
|||||||
self.assertEntityRequestBodyIs(request_body)
|
self.assertEntityRequestBodyIs(request_body)
|
||||||
|
|
||||||
|
|
||||||
class EntityManagerTests(utils.TestCase):
|
class EntityManagerTests(utils.ClientTestCase):
|
||||||
def test_create_object_expect_fail(self):
|
def test_create_object_expect_fail(self):
|
||||||
self.assertRaises(TypeError,
|
self.assertRaises(TypeError,
|
||||||
base.EntityManager,
|
base.EntityManager,
|
||||||
self.client)
|
self.client)
|
||||||
|
|
||||||
|
|
||||||
class FederationProjectTests(utils.TestCase):
|
class FederationProjectTests(utils.ClientTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(FederationProjectTests, self).setUp()
|
super(FederationProjectTests, self).setUp()
|
||||||
@@ -364,7 +364,7 @@ class FederationProjectTests(utils.TestCase):
|
|||||||
self.assertIsInstance(project, self.model)
|
self.assertIsInstance(project, self.model)
|
||||||
|
|
||||||
|
|
||||||
class FederationDomainTests(utils.TestCase):
|
class FederationDomainTests(utils.ClientTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(FederationDomainTests, self).setUp()
|
super(FederationDomainTests, self).setUp()
|
||||||
@@ -394,7 +394,7 @@ class FederationDomainTests(utils.TestCase):
|
|||||||
self.assertIsInstance(domain, self.model)
|
self.assertIsInstance(domain, self.model)
|
||||||
|
|
||||||
|
|
||||||
class FederatedTokenTests(utils.TestCase):
|
class FederatedTokenTests(utils.ClientTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(FederatedTokenTests, self).setUp()
|
super(FederatedTokenTests, self).setUp()
|
||||||
@@ -416,7 +416,7 @@ class FederatedTokenTests(utils.TestCase):
|
|||||||
self.assertIsNone(self.federated_token.user_domain_id)
|
self.assertIsNone(self.federated_token.user_domain_id)
|
||||||
|
|
||||||
|
|
||||||
class ServiceProviderTests(utils.TestCase, utils.CrudTests):
|
class ServiceProviderTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ServiceProviderTests, self).setUp()
|
super(ServiceProviderTests, self).setUp()
|
||||||
self.key = 'service_provider'
|
self.key = 'service_provider'
|
||||||
|
@@ -18,7 +18,7 @@ from keystoneclient.tests.unit.v3 import utils
|
|||||||
from keystoneclient.v3 import groups
|
from keystoneclient.v3 import groups
|
||||||
|
|
||||||
|
|
||||||
class GroupTests(utils.TestCase, utils.CrudTests):
|
class GroupTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(GroupTests, self).setUp()
|
super(GroupTests, self).setUp()
|
||||||
self.key = 'group'
|
self.key = 'group'
|
||||||
|
@@ -33,15 +33,11 @@ except ImportError:
|
|||||||
oauth1 = None
|
oauth1 = None
|
||||||
|
|
||||||
|
|
||||||
class BaseTest(utils.TestCase):
|
class ConsumerTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(BaseTest, self).setUp()
|
|
||||||
if oauth1 is None:
|
if oauth1 is None:
|
||||||
self.skipTest('oauthlib package not available')
|
self.skipTest('oauthlib package not available')
|
||||||
|
|
||||||
|
|
||||||
class ConsumerTests(BaseTest, utils.CrudTests):
|
|
||||||
def setUp(self):
|
|
||||||
super(ConsumerTests, self).setUp()
|
super(ConsumerTests, self).setUp()
|
||||||
self.key = 'consumer'
|
self.key = 'consumer'
|
||||||
self.collection_key = 'consumers'
|
self.collection_key = 'consumers'
|
||||||
@@ -79,7 +75,7 @@ class ConsumerTests(BaseTest, utils.CrudTests):
|
|||||||
self.assertEqual(consumer_id, consumer.id)
|
self.assertEqual(consumer_id, consumer.id)
|
||||||
|
|
||||||
|
|
||||||
class TokenTests(BaseTest):
|
class TokenTests(object):
|
||||||
def _new_oauth_token(self):
|
def _new_oauth_token(self):
|
||||||
key = uuid.uuid4().hex
|
key = uuid.uuid4().hex
|
||||||
secret = uuid.uuid4().hex
|
secret = uuid.uuid4().hex
|
||||||
@@ -122,8 +118,11 @@ class TokenTests(BaseTest):
|
|||||||
return parameters
|
return parameters
|
||||||
|
|
||||||
|
|
||||||
class RequestTokenTests(TokenTests):
|
class RequestTokenTests(utils.ClientTestCase, TokenTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
if oauth1 is None:
|
||||||
|
self.skipTest('oauthlib package not available')
|
||||||
|
|
||||||
super(RequestTokenTests, self).setUp()
|
super(RequestTokenTests, self).setUp()
|
||||||
self.model = request_tokens.RequestToken
|
self.model = request_tokens.RequestToken
|
||||||
self.manager = self.client.oauth1.request_tokens
|
self.manager = self.client.oauth1.request_tokens
|
||||||
@@ -181,8 +180,11 @@ class RequestTokenTests(TokenTests):
|
|||||||
oauth_client)
|
oauth_client)
|
||||||
|
|
||||||
|
|
||||||
class AccessTokenTests(TokenTests):
|
class AccessTokenTests(utils.ClientTestCase, TokenTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
if oauth1 is None:
|
||||||
|
self.skipTest('oauthlib package not available')
|
||||||
|
|
||||||
super(AccessTokenTests, self).setUp()
|
super(AccessTokenTests, self).setUp()
|
||||||
self.manager = self.client.oauth1.access_tokens
|
self.manager = self.client.oauth1.access_tokens
|
||||||
self.model = access_tokens.AccessToken
|
self.model = access_tokens.AccessToken
|
||||||
@@ -223,7 +225,7 @@ class AccessTokenTests(TokenTests):
|
|||||||
oauth_client)
|
oauth_client)
|
||||||
|
|
||||||
|
|
||||||
class AuthenticateWithOAuthTests(TokenTests):
|
class AuthenticateWithOAuthTests(utils.TestCase, TokenTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(AuthenticateWithOAuthTests, self).setUp()
|
super(AuthenticateWithOAuthTests, self).setUp()
|
||||||
if oauth1 is None:
|
if oauth1 is None:
|
||||||
|
@@ -16,7 +16,7 @@ from keystoneclient.tests.unit.v3 import utils
|
|||||||
from keystoneclient.v3 import policies
|
from keystoneclient.v3 import policies
|
||||||
|
|
||||||
|
|
||||||
class PolicyTests(utils.TestCase, utils.CrudTests):
|
class PolicyTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(PolicyTests, self).setUp()
|
super(PolicyTests, self).setUp()
|
||||||
self.key = 'policy'
|
self.key = 'policy'
|
||||||
|
@@ -17,7 +17,7 @@ from keystoneclient.tests.unit.v3 import utils
|
|||||||
from keystoneclient.v3 import projects
|
from keystoneclient.v3 import projects
|
||||||
|
|
||||||
|
|
||||||
class ProjectTests(utils.TestCase, utils.CrudTests):
|
class ProjectTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ProjectTests, self).setUp()
|
super(ProjectTests, self).setUp()
|
||||||
self.key = 'project'
|
self.key = 'project'
|
||||||
|
@@ -18,7 +18,7 @@ from keystoneclient.tests.unit.v3 import utils
|
|||||||
from keystoneclient.v3 import regions
|
from keystoneclient.v3 import regions
|
||||||
|
|
||||||
|
|
||||||
class RegionTests(utils.TestCase, utils.CrudTests):
|
class RegionTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(RegionTests, self).setUp()
|
super(RegionTests, self).setUp()
|
||||||
self.key = 'region'
|
self.key = 'region'
|
||||||
|
@@ -15,7 +15,7 @@ from keystoneclient.tests.unit.v3 import utils
|
|||||||
from keystoneclient.v3 import role_assignments
|
from keystoneclient.v3 import role_assignments
|
||||||
|
|
||||||
|
|
||||||
class RoleAssignmentsTests(utils.TestCase, utils.CrudTests):
|
class RoleAssignmentsTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(RoleAssignmentsTests, self).setUp()
|
super(RoleAssignmentsTests, self).setUp()
|
||||||
|
@@ -20,7 +20,7 @@ from keystoneclient.v3 import roles
|
|||||||
from testtools import matchers
|
from testtools import matchers
|
||||||
|
|
||||||
|
|
||||||
class RoleTests(utils.TestCase, utils.CrudTests):
|
class RoleTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(RoleTests, self).setUp()
|
super(RoleTests, self).setUp()
|
||||||
self.key = 'role'
|
self.key = 'role'
|
||||||
|
@@ -16,7 +16,7 @@ from keystoneclient.tests.unit.v3 import utils
|
|||||||
from keystoneclient.v3 import services
|
from keystoneclient.v3 import services
|
||||||
|
|
||||||
|
|
||||||
class ServiceTests(utils.TestCase, utils.CrudTests):
|
class ServiceTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ServiceTests, self).setUp()
|
super(ServiceTests, self).setUp()
|
||||||
self.key = 'service'
|
self.key = 'service'
|
||||||
|
@@ -17,7 +17,7 @@ from keystoneclient.tests.unit import client_fixtures
|
|||||||
from keystoneclient.tests.unit.v3 import utils
|
from keystoneclient.tests.unit.v3 import utils
|
||||||
|
|
||||||
|
|
||||||
class SimpleCertTests(utils.TestCase, testresources.ResourcedTestCase):
|
class SimpleCertTests(utils.ClientTestCase, testresources.ResourcedTestCase):
|
||||||
|
|
||||||
resources = [('examples', client_fixtures.EXAMPLES_RESOURCE)]
|
resources = [('examples', client_fixtures.EXAMPLES_RESOURCE)]
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ from keystoneclient.tests.unit import client_fixtures
|
|||||||
from keystoneclient.tests.unit.v3 import utils
|
from keystoneclient.tests.unit.v3 import utils
|
||||||
|
|
||||||
|
|
||||||
class TokenTests(utils.TestCase, testresources.ResourcedTestCase):
|
class TokenTests(utils.ClientTestCase, testresources.ResourcedTestCase):
|
||||||
|
|
||||||
resources = [('examples', client_fixtures.EXAMPLES_RESOURCE)]
|
resources = [('examples', client_fixtures.EXAMPLES_RESOURCE)]
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ from keystoneclient.tests.unit.v3 import utils
|
|||||||
from keystoneclient.v3.contrib import trusts
|
from keystoneclient.v3.contrib import trusts
|
||||||
|
|
||||||
|
|
||||||
class TrustTests(utils.TestCase, utils.CrudTests):
|
class TrustTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TrustTests, self).setUp()
|
super(TrustTests, self).setUp()
|
||||||
self.key = 'trust'
|
self.key = 'trust'
|
||||||
|
@@ -20,7 +20,7 @@ from keystoneclient.tests.unit.v3 import utils
|
|||||||
from keystoneclient.v3 import users
|
from keystoneclient.v3 import users
|
||||||
|
|
||||||
|
|
||||||
class UserTests(utils.TestCase, utils.CrudTests):
|
class UserTests(utils.ClientTestCase, utils.CrudTests):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(UserTests, self).setUp()
|
super(UserTests, self).setUp()
|
||||||
self.key = 'user'
|
self.key = 'user'
|
||||||
|
@@ -127,15 +127,6 @@ class TestCase(UnauthenticatedTestCase):
|
|||||||
"type": "object-store"
|
"type": "object-store"
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
super(TestCase, self).setUp()
|
|
||||||
|
|
||||||
# Creating a Client not using session is deprecated.
|
|
||||||
with self.deprecations.expect_deprecations_here():
|
|
||||||
self.client = client.Client(token=self.TEST_TOKEN,
|
|
||||||
auth_url=self.TEST_URL,
|
|
||||||
endpoint=self.TEST_URL)
|
|
||||||
|
|
||||||
def stub_auth(self, subject_token=None, **kwargs):
|
def stub_auth(self, subject_token=None, **kwargs):
|
||||||
if not subject_token:
|
if not subject_token:
|
||||||
subject_token = self.TEST_TOKEN
|
subject_token = self.TEST_TOKEN
|
||||||
@@ -153,6 +144,18 @@ class TestCase(UnauthenticatedTestCase):
|
|||||||
self.stub_url('POST', ['auth', 'tokens'], **kwargs)
|
self.stub_url('POST', ['auth', 'tokens'], **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
class ClientTestCase(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestCase, self).setUp()
|
||||||
|
|
||||||
|
# Creating a Client not using session is deprecated.
|
||||||
|
with self.deprecations.expect_deprecations_here():
|
||||||
|
self.client = client.Client(token=self.TEST_TOKEN,
|
||||||
|
auth_url=self.TEST_URL,
|
||||||
|
endpoint=self.TEST_URL)
|
||||||
|
|
||||||
|
|
||||||
class CrudTests(object):
|
class CrudTests(object):
|
||||||
key = None
|
key = None
|
||||||
collection_key = None
|
collection_key = None
|
||||||
|
Reference in New Issue
Block a user