Define v3 endpoints_client as library
Migrate v3 API endpoints_client to tempest.lib Partially implements blueprint consistent-service-method-names Change-Id: Ic6836aef3400d5b1d14320896ae3a3f4f1eaa450
This commit is contained in:
parent
a01f0d59fd
commit
1f361c2c11
releasenotes/notes
tempest
lib/services/identity/v3
services/identity/v3
tests/lib/services/identity/v3
@ -7,6 +7,7 @@ features:
|
|||||||
any maintenance changes.
|
any maintenance changes.
|
||||||
|
|
||||||
* endpoints_client(v2)
|
* endpoints_client(v2)
|
||||||
|
* endpoints_client(v3)
|
||||||
* roles_client(v2)
|
* roles_client(v2)
|
||||||
* services_client(v2)
|
* services_client(v2)
|
||||||
* tenants_client(v2)
|
* tenants_client(v2)
|
||||||
|
@ -12,11 +12,11 @@
|
|||||||
# License for the specific language governing permissions and limitations under
|
# License for the specific language governing permissions and limitations under
|
||||||
# the License.
|
# the License.
|
||||||
|
|
||||||
|
from tempest.lib.services.identity.v3.endpoints_client import EndPointsClient
|
||||||
from tempest.lib.services.identity.v3.token_client import V3TokenClient
|
from tempest.lib.services.identity.v3.token_client import V3TokenClient
|
||||||
from tempest.services.identity.v3.json.credentials_client import \
|
from tempest.services.identity.v3.json.credentials_client import \
|
||||||
CredentialsClient
|
CredentialsClient
|
||||||
from tempest.services.identity.v3.json.domains_client import DomainsClient
|
from tempest.services.identity.v3.json.domains_client import DomainsClient
|
||||||
from tempest.services.identity.v3.json.endpoints_client import EndPointsClient
|
|
||||||
from tempest.services.identity.v3.json.groups_client import GroupsClient
|
from tempest.services.identity.v3.json.groups_client import GroupsClient
|
||||||
from tempest.services.identity.v3.json.identity_client import IdentityClient
|
from tempest.services.identity.v3.json.identity_client import IdentityClient
|
||||||
from tempest.services.identity.v3.json.policies_client import PoliciesClient
|
from tempest.services.identity.v3.json.policies_client import PoliciesClient
|
||||||
@ -27,7 +27,7 @@ from tempest.services.identity.v3.json.services_client import ServicesClient
|
|||||||
from tempest.services.identity.v3.json.trusts_client import TrustsClient
|
from tempest.services.identity.v3.json.trusts_client import TrustsClient
|
||||||
from tempest.services.identity.v3.json.users_clients import UsersClient
|
from tempest.services.identity.v3.json.users_clients import UsersClient
|
||||||
|
|
||||||
__all__ = ['V3TokenClient', 'CredentialsClient', 'DomainsClient',
|
__all__ = ['EndPointsClient', 'V3TokenClient', 'CredentialsClient',
|
||||||
'EndPointsClient', 'GroupsClient', 'IdentityClient',
|
'DomainsClient', 'GroupsClient', 'IdentityClient', 'PoliciesClient',
|
||||||
'PoliciesClient', 'ProjectsClient', 'RegionsClient', 'RolesClient',
|
'ProjectsClient', 'RegionsClient', 'RolesClient', 'ServicesClient',
|
||||||
'ServicesClient', 'TrustsClient', 'UsersClient', ]
|
'TrustsClient', 'UsersClient', ]
|
||||||
|
100
tempest/tests/lib/services/identity/v3/test_endpoints_client.py
Normal file
100
tempest/tests/lib/services/identity/v3/test_endpoints_client.py
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
# 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 endpoints_client
|
||||||
|
from tempest.tests.lib import fake_auth_provider
|
||||||
|
from tempest.tests.lib.services import base
|
||||||
|
|
||||||
|
|
||||||
|
class TestEndpointsClient(base.BaseServiceTest):
|
||||||
|
FAKE_CREATE_ENDPOINT = {
|
||||||
|
"endpoint": {
|
||||||
|
"id": 1,
|
||||||
|
"tenantId": 1,
|
||||||
|
"region": "North",
|
||||||
|
"type": "compute",
|
||||||
|
"publicURL": "https://compute.north.public.com/v1",
|
||||||
|
"internalURL": "https://compute.north.internal.com/v1",
|
||||||
|
"adminURL": "https://compute.north.internal.com/v1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FAKE_LIST_ENDPOINTS = {
|
||||||
|
"endpoints": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"tenantId": "1",
|
||||||
|
"region": "North",
|
||||||
|
"type": "compute",
|
||||||
|
"publicURL": "https://compute.north.public.com/v1",
|
||||||
|
"internalURL": "https://compute.north.internal.com/v1",
|
||||||
|
"adminURL": "https://compute.north.internal.com/v1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"tenantId": "1",
|
||||||
|
"region": "South",
|
||||||
|
"type": "compute",
|
||||||
|
"publicURL": "https://compute.north.public.com/v1",
|
||||||
|
"internalURL": "https://compute.north.internal.com/v1",
|
||||||
|
"adminURL": "https://compute.north.internal.com/v1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestEndpointsClient, self).setUp()
|
||||||
|
fake_auth = fake_auth_provider.FakeAuthProvider()
|
||||||
|
self.client = endpoints_client.EndPointsClient(fake_auth,
|
||||||
|
'identity', 'regionOne')
|
||||||
|
|
||||||
|
def _test_create_endpoint(self, bytes_body=False):
|
||||||
|
self.check_service_client_function(
|
||||||
|
self.client.create_endpoint,
|
||||||
|
'tempest.lib.common.rest_client.RestClient.post',
|
||||||
|
self.FAKE_CREATE_ENDPOINT,
|
||||||
|
bytes_body,
|
||||||
|
status=201,
|
||||||
|
service_id="b344506af7644f6794d9cb316600b020",
|
||||||
|
region="region-demo",
|
||||||
|
publicurl="https://compute.north.public.com/v1",
|
||||||
|
adminurl="https://compute.north.internal.com/v1",
|
||||||
|
internalurl="https://compute.north.internal.com/v1")
|
||||||
|
|
||||||
|
def _test_list_endpoints(self, bytes_body=False):
|
||||||
|
self.check_service_client_function(
|
||||||
|
self.client.list_endpoints,
|
||||||
|
'tempest.lib.common.rest_client.RestClient.get',
|
||||||
|
self.FAKE_LIST_ENDPOINTS,
|
||||||
|
bytes_body)
|
||||||
|
|
||||||
|
def test_create_endpoint_with_str_body(self):
|
||||||
|
self._test_create_endpoint()
|
||||||
|
|
||||||
|
def test_create_endpoint_with_bytes_body(self):
|
||||||
|
self._test_create_endpoint(bytes_body=True)
|
||||||
|
|
||||||
|
def test_list_endpoints_with_str_body(self):
|
||||||
|
self._test_list_endpoints()
|
||||||
|
|
||||||
|
def test_list_endpoints_with_bytes_body(self):
|
||||||
|
self._test_list_endpoints(bytes_body=True)
|
||||||
|
|
||||||
|
def test_delete_endpoint(self):
|
||||||
|
self.check_service_client_function(
|
||||||
|
self.client.delete_endpoint,
|
||||||
|
'tempest.lib.common.rest_client.RestClient.delete',
|
||||||
|
{},
|
||||||
|
endpoint_id="b344506af7644f6794d9cb316600b020",
|
||||||
|
status=204)
|
Loading…
x
Reference in New Issue
Block a user