Merge "Define v3 domains_client as library"
This commit is contained in:
commit
bb3102d2a2
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- Define the identity v3 service client domains_client as a library.
|
||||
Add domains_client to the library interface so the other
|
||||
projects can use this module as a stable library without any
|
||||
maintenance changes.
|
@ -21,7 +21,7 @@ from tempest import config
|
||||
from tempest.lib import auth
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
from tempest.lib.services import clients
|
||||
from tempest.services import identity
|
||||
from tempest.lib.services import identity
|
||||
from tempest.services import object_storage
|
||||
from tempest.services import orchestration
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
from tempest.lib.services.identity import v2
|
||||
from tempest.lib.services.identity import v3
|
||||
|
||||
__all__ = ['v2', 'v3']
|
@ -0,0 +1,38 @@
|
||||
# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
from tempest.lib.services.identity.v3.credentials_client import \
|
||||
CredentialsClient
|
||||
from tempest.lib.services.identity.v3.domains_client import DomainsClient
|
||||
from tempest.lib.services.identity.v3.endpoints_client import EndPointsClient
|
||||
from tempest.lib.services.identity.v3.groups_client import GroupsClient
|
||||
from tempest.lib.services.identity.v3.identity_client import IdentityClient
|
||||
from tempest.lib.services.identity.v3.inherited_roles_client import \
|
||||
InheritedRolesClient
|
||||
from tempest.lib.services.identity.v3.policies_client import PoliciesClient
|
||||
from tempest.lib.services.identity.v3.projects_client import ProjectsClient
|
||||
from tempest.lib.services.identity.v3.regions_client import RegionsClient
|
||||
from tempest.lib.services.identity.v3.role_assignments_client import \
|
||||
RoleAssignmentsClient
|
||||
from tempest.lib.services.identity.v3.roles_client import RolesClient
|
||||
from tempest.lib.services.identity.v3.services_client import ServicesClient
|
||||
from tempest.lib.services.identity.v3.token_client import V3TokenClient
|
||||
from tempest.lib.services.identity.v3.trusts_client import TrustsClient
|
||||
from tempest.lib.services.identity.v3.users_client import UsersClient
|
||||
|
||||
__all__ = ['CredentialsClient', 'DomainsClient', 'EndPointsClient',
|
||||
'GroupsClient', 'IdentityClient', 'InheritedRolesClient',
|
||||
'PoliciesClient', 'ProjectsClient', 'RegionsClient',
|
||||
'RoleAssignmentsClient', 'RolesClient', 'ServicesClient',
|
||||
'V3TokenClient', 'TrustsClient', 'UsersClient', ]
|
@ -1,18 +0,0 @@
|
||||
# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
from tempest.lib.services.identity import v2
|
||||
from tempest.services.identity import v3
|
||||
|
||||
__all__ = ['v2', 'v3']
|
@ -1,38 +0,0 @@
|
||||
# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
|
||||
from tempest.lib.services.identity.v3.credentials_client import \
|
||||
CredentialsClient
|
||||
from tempest.lib.services.identity.v3.endpoints_client import EndPointsClient
|
||||
from tempest.lib.services.identity.v3.groups_client import GroupsClient
|
||||
from tempest.lib.services.identity.v3.identity_client import IdentityClient
|
||||
from tempest.lib.services.identity.v3.inherited_roles_client import \
|
||||
InheritedRolesClient
|
||||
from tempest.lib.services.identity.v3.policies_client import PoliciesClient
|
||||
from tempest.lib.services.identity.v3.projects_client import ProjectsClient
|
||||
from tempest.lib.services.identity.v3.regions_client import RegionsClient
|
||||
from tempest.lib.services.identity.v3.role_assignments_client import \
|
||||
RoleAssignmentsClient
|
||||
from tempest.lib.services.identity.v3.roles_client import RolesClient
|
||||
from tempest.lib.services.identity.v3.services_client import ServicesClient
|
||||
from tempest.lib.services.identity.v3.token_client import V3TokenClient
|
||||
from tempest.lib.services.identity.v3.trusts_client import TrustsClient
|
||||
from tempest.lib.services.identity.v3.users_client import UsersClient
|
||||
from tempest.services.identity.v3.json.domains_client import DomainsClient
|
||||
|
||||
__all__ = ['CredentialsClient', 'EndPointsClient', 'GroupsClient',
|
||||
'IdentityClient', 'InheritedRolesClient', 'PoliciesClient',
|
||||
'ProjectsClient', 'RegionsClient', 'RoleAssignmentsClient',
|
||||
'RolesClient', 'ServicesClient', 'V3TokenClient', 'TrustsClient',
|
||||
'UsersClient', 'DomainsClient', ]
|
@ -75,7 +75,7 @@ class MockHelpersMixin(object):
|
||||
fake_domain_list = {'domains': [{'id': 'fake_domain',
|
||||
'name': 'Fake_Domain'}]}
|
||||
self.useFixture(fixtures.MockPatch(''.join([
|
||||
'tempest.services.identity.v3.json.domains_client.'
|
||||
'tempest.lib.services.identity.v3.domains_client.'
|
||||
'DomainsClient.list_domains']),
|
||||
return_value=fake_domain_list))
|
||||
self.useFixture(fixtures.MockPatch(
|
||||
@ -121,7 +121,7 @@ class TestAccountGeneratorV3(TestAccountGeneratorV2):
|
||||
super(TestAccountGeneratorV3, self).setUp()
|
||||
fake_domain_list = {'domains': [{'id': 'fake_domain'}]}
|
||||
self.useFixture(fixtures.MockPatch(''.join([
|
||||
'tempest.services.identity.v3.json.domains_client.'
|
||||
'tempest.lib.services.identity.v3.domains_client.'
|
||||
'DomainsClient.list_domains']),
|
||||
return_value=fake_domain_list))
|
||||
|
||||
|
@ -27,6 +27,7 @@ from tempest.lib.services.identity.v2 import tenants_client as \
|
||||
v2_tenants_client
|
||||
from tempest.lib.services.identity.v2 import token_client as v2_token_client
|
||||
from tempest.lib.services.identity.v2 import users_client as v2_users_client
|
||||
from tempest.lib.services.identity.v3 import domains_client
|
||||
from tempest.lib.services.identity.v3 import identity_client as v3_iden_client
|
||||
from tempest.lib.services.identity.v3 import projects_client as \
|
||||
v3_projects_client
|
||||
@ -35,7 +36,6 @@ from tempest.lib.services.identity.v3 import token_client as v3_token_client
|
||||
from tempest.lib.services.identity.v3 import users_client as \
|
||||
v3_users_client
|
||||
from tempest.lib.services.network import routers_client
|
||||
from tempest.services.identity.v3.json import domains_client
|
||||
from tempest.tests import base
|
||||
from tempest.tests import fake_config
|
||||
from tempest.tests.lib import fake_http
|
||||
|
138
tempest/tests/lib/services/identity/v3/test_domains_client.py
Normal file
138
tempest/tests/lib/services/identity/v3/test_domains_client.py
Normal file
@ -0,0 +1,138 @@
|
||||
# Copyright 2016 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from tempest.lib.services.identity.v3 import domains_client
|
||||
from tempest.tests.lib import fake_auth_provider
|
||||
from tempest.tests.lib.services import base
|
||||
|
||||
|
||||
class TestDomainsClient(base.BaseServiceTest):
|
||||
FAKE_CREATE_DOMAIN = {
|
||||
"domain": {
|
||||
"description": "Domain description",
|
||||
"enabled": True,
|
||||
"name": "myDomain"
|
||||
}
|
||||
}
|
||||
|
||||
FAKE_DOMAIN_INFO = {
|
||||
"domain": {
|
||||
"description": "Used for swift functional testing",
|
||||
"enabled": True,
|
||||
"id": "5a75994a3",
|
||||
"links": {
|
||||
"self": "http://example.com/identity/v3/domains/5a75994a3"
|
||||
},
|
||||
"name": "swift_test"
|
||||
}
|
||||
}
|
||||
|
||||
FAKE_LIST_DOMAINS = {
|
||||
"domains": [
|
||||
{
|
||||
"description": "Used for swift functional testing",
|
||||
"enabled": True,
|
||||
"id": "5a75994a3",
|
||||
"links": {
|
||||
"self": "http://example.com/identity/v3/domains/5a75994a3"
|
||||
},
|
||||
"name": "swift_test"
|
||||
},
|
||||
{
|
||||
"description": "Owns users and tenants available on " +
|
||||
"Identity API",
|
||||
"enabled": True,
|
||||
"id": "default",
|
||||
"links": {
|
||||
"self": "http://example.com/identity/v3/domains/default"
|
||||
},
|
||||
"name": "Default"
|
||||
}
|
||||
],
|
||||
"links": {
|
||||
"next": None,
|
||||
"previous": None,
|
||||
"self": "http://example.com/identity/v3/domains"
|
||||
}
|
||||
}
|
||||
|
||||
def setUp(self):
|
||||
super(TestDomainsClient, self).setUp()
|
||||
fake_auth = fake_auth_provider.FakeAuthProvider()
|
||||
self.client = domains_client.DomainsClient(fake_auth,
|
||||
'identity',
|
||||
'regionOne')
|
||||
|
||||
def _test_create_domain(self, bytes_body=False):
|
||||
self.check_service_client_function(
|
||||
self.client.create_domain,
|
||||
'tempest.lib.common.rest_client.RestClient.post',
|
||||
self.FAKE_CREATE_DOMAIN,
|
||||
bytes_body,
|
||||
status=201)
|
||||
|
||||
def _test_show_domain(self, bytes_body=False):
|
||||
self.check_service_client_function(
|
||||
self.client.show_domain,
|
||||
'tempest.lib.common.rest_client.RestClient.get',
|
||||
self.FAKE_DOMAIN_INFO,
|
||||
bytes_body,
|
||||
domain_id="5a75994a3")
|
||||
|
||||
def _test_list_domains(self, bytes_body=False):
|
||||
self.check_service_client_function(
|
||||
self.client.list_domains,
|
||||
'tempest.lib.common.rest_client.RestClient.get',
|
||||
self.FAKE_LIST_DOMAINS,
|
||||
bytes_body)
|
||||
|
||||
def _test_update_domain(self, bytes_body=False):
|
||||
self.check_service_client_function(
|
||||
self.client.update_domain,
|
||||
'tempest.lib.common.rest_client.RestClient.patch',
|
||||
self.FAKE_DOMAIN_INFO,
|
||||
bytes_body,
|
||||
domain_id="5a75994a3")
|
||||
|
||||
def test_create_domain_with_str_body(self):
|
||||
self._test_create_domain()
|
||||
|
||||
def test_create_domain_with_bytes_body(self):
|
||||
self._test_create_domain(bytes_body=True)
|
||||
|
||||
def test_show_domain_with_str_body(self):
|
||||
self._test_show_domain()
|
||||
|
||||
def test_show_domain_with_bytes_body(self):
|
||||
self._test_show_domain(bytes_body=True)
|
||||
|
||||
def test_list_domain_with_str_body(self):
|
||||
self._test_list_domains()
|
||||
|
||||
def test_list_domain_with_bytes_body(self):
|
||||
self._test_list_domains(bytes_body=True)
|
||||
|
||||
def test_update_domain_with_str_body(self):
|
||||
self._test_update_domain()
|
||||
|
||||
def test_update_domain_with_bytes_body(self):
|
||||
self._test_update_domain(bytes_body=True)
|
||||
|
||||
def test_delete_domain(self):
|
||||
self.check_service_client_function(
|
||||
self.client.delete_domain,
|
||||
'tempest.lib.common.rest_client.RestClient.delete',
|
||||
{},
|
||||
domain_id="5a75994a3",
|
||||
status=204)
|
Loading…
Reference in New Issue
Block a user