Merge "Unix style line ending"
This commit is contained in:
commit
baa6e9ad87
|
@ -1,78 +1,78 @@
|
||||||
# Copyright 2017 AT&T Corporation.
|
# Copyright 2017 AT&T Corporation.
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo_serialization import jsonutils as json
|
from oslo_serialization import jsonutils as json
|
||||||
|
|
||||||
from tempest.lib.common import rest_client
|
from tempest.lib.common import rest_client
|
||||||
|
|
||||||
|
|
||||||
class EndPointGroupsClient(rest_client.RestClient):
|
class EndPointGroupsClient(rest_client.RestClient):
|
||||||
api_version = "v3"
|
api_version = "v3"
|
||||||
|
|
||||||
def create_endpoint_group(self, **kwargs):
|
def create_endpoint_group(self, **kwargs):
|
||||||
"""Create endpoint group.
|
"""Create endpoint group.
|
||||||
|
|
||||||
For a full list of available parameters, please refer to the
|
For a full list of available parameters, please refer to the
|
||||||
official API reference:
|
official API reference:
|
||||||
https://developer.openstack.org/api-ref/identity/v3-ext/#create-endpoint-group
|
https://developer.openstack.org/api-ref/identity/v3-ext/#create-endpoint-group
|
||||||
"""
|
"""
|
||||||
post_body = json.dumps({'endpoint_group': kwargs})
|
post_body = json.dumps({'endpoint_group': kwargs})
|
||||||
resp, body = self.post('OS-EP-FILTER/endpoint_groups', post_body)
|
resp, body = self.post('OS-EP-FILTER/endpoint_groups', post_body)
|
||||||
self.expected_success(201, resp.status)
|
self.expected_success(201, resp.status)
|
||||||
body = json.loads(body)
|
body = json.loads(body)
|
||||||
return rest_client.ResponseBody(resp, body)
|
return rest_client.ResponseBody(resp, body)
|
||||||
|
|
||||||
def update_endpoint_group(self, endpoint_group_id, **kwargs):
|
def update_endpoint_group(self, endpoint_group_id, **kwargs):
|
||||||
"""Update endpoint group.
|
"""Update endpoint group.
|
||||||
|
|
||||||
For a full list of available parameters, please refer to the
|
For a full list of available parameters, please refer to the
|
||||||
official API reference:
|
official API reference:
|
||||||
https://developer.openstack.org/api-ref/identity/v3-ext/#update-endpoint-group
|
https://developer.openstack.org/api-ref/identity/v3-ext/#update-endpoint-group
|
||||||
"""
|
"""
|
||||||
post_body = json.dumps({'endpoint_group': kwargs})
|
post_body = json.dumps({'endpoint_group': kwargs})
|
||||||
resp, body = self.patch(
|
resp, body = self.patch(
|
||||||
'OS-EP-FILTER/endpoint_groups/%s' % endpoint_group_id, post_body)
|
'OS-EP-FILTER/endpoint_groups/%s' % endpoint_group_id, post_body)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
body = json.loads(body)
|
body = json.loads(body)
|
||||||
return rest_client.ResponseBody(resp, body)
|
return rest_client.ResponseBody(resp, body)
|
||||||
|
|
||||||
def delete_endpoint_group(self, endpoint_group_id):
|
def delete_endpoint_group(self, endpoint_group_id):
|
||||||
"""Delete endpoint group."""
|
"""Delete endpoint group."""
|
||||||
resp_header, resp_body = self.delete(
|
resp_header, resp_body = self.delete(
|
||||||
'OS-EP-FILTER/endpoint_groups/%s' % endpoint_group_id)
|
'OS-EP-FILTER/endpoint_groups/%s' % endpoint_group_id)
|
||||||
self.expected_success(204, resp_header.status)
|
self.expected_success(204, resp_header.status)
|
||||||
return rest_client.ResponseBody(resp_header, resp_body)
|
return rest_client.ResponseBody(resp_header, resp_body)
|
||||||
|
|
||||||
def show_endpoint_group(self, endpoint_group_id):
|
def show_endpoint_group(self, endpoint_group_id):
|
||||||
"""Get endpoint group."""
|
"""Get endpoint group."""
|
||||||
resp_header, resp_body = self.get(
|
resp_header, resp_body = self.get(
|
||||||
'OS-EP-FILTER/endpoint_groups/%s' % endpoint_group_id)
|
'OS-EP-FILTER/endpoint_groups/%s' % endpoint_group_id)
|
||||||
self.expected_success(200, resp_header.status)
|
self.expected_success(200, resp_header.status)
|
||||||
resp_body = json.loads(resp_body)
|
resp_body = json.loads(resp_body)
|
||||||
return rest_client.ResponseBody(resp_header, resp_body)
|
return rest_client.ResponseBody(resp_header, resp_body)
|
||||||
|
|
||||||
def check_endpoint_group(self, endpoint_group_id):
|
def check_endpoint_group(self, endpoint_group_id):
|
||||||
"""Check endpoint group."""
|
"""Check endpoint group."""
|
||||||
resp_header, resp_body = self.head(
|
resp_header, resp_body = self.head(
|
||||||
'OS-EP-FILTER/endpoint_groups/%s' % endpoint_group_id)
|
'OS-EP-FILTER/endpoint_groups/%s' % endpoint_group_id)
|
||||||
self.expected_success(200, resp_header.status)
|
self.expected_success(200, resp_header.status)
|
||||||
return rest_client.ResponseBody(resp_header, resp_body)
|
return rest_client.ResponseBody(resp_header, resp_body)
|
||||||
|
|
||||||
def list_endpoint_groups(self):
|
def list_endpoint_groups(self):
|
||||||
"""Get endpoint groups."""
|
"""Get endpoint groups."""
|
||||||
resp_header, resp_body = self.get('OS-EP-FILTER/endpoint_groups')
|
resp_header, resp_body = self.get('OS-EP-FILTER/endpoint_groups')
|
||||||
self.expected_success(200, resp_header.status)
|
self.expected_success(200, resp_header.status)
|
||||||
resp_body = json.loads(resp_body)
|
resp_body = json.loads(resp_body)
|
||||||
return rest_client.ResponseBody(resp_header, resp_body)
|
return rest_client.ResponseBody(resp_header, resp_body)
|
||||||
|
|
|
@ -1,162 +1,162 @@
|
||||||
# Copyright 2017 AT&T Corporation.
|
# Copyright 2017 AT&T Corporation.
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
# a copy of the License at
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from tempest.lib.services.identity.v3 import endpoint_groups_client
|
from tempest.lib.services.identity.v3 import endpoint_groups_client
|
||||||
from tempest.tests.lib import fake_auth_provider
|
from tempest.tests.lib import fake_auth_provider
|
||||||
from tempest.tests.lib.services import base
|
from tempest.tests.lib.services import base
|
||||||
|
|
||||||
|
|
||||||
class TestEndPointGroupsClient(base.BaseServiceTest):
|
class TestEndPointGroupsClient(base.BaseServiceTest):
|
||||||
FAKE_CREATE_ENDPOINT_GROUP = {
|
FAKE_CREATE_ENDPOINT_GROUP = {
|
||||||
"endpoint_group": {
|
"endpoint_group": {
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"name": "FAKE_ENDPOINT_GROUP",
|
"name": "FAKE_ENDPOINT_GROUP",
|
||||||
"description": "FAKE SERVICE ENDPOINT GROUP",
|
"description": "FAKE SERVICE ENDPOINT GROUP",
|
||||||
"filters": {
|
"filters": {
|
||||||
"service_id": 1
|
"service_id": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FAKE_ENDPOINT_GROUP_INFO = {
|
FAKE_ENDPOINT_GROUP_INFO = {
|
||||||
"endpoint_group": {
|
"endpoint_group": {
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"name": "FAKE_ENDPOINT_GROUP",
|
"name": "FAKE_ENDPOINT_GROUP",
|
||||||
"description": "FAKE SERVICE ENDPOINT GROUP",
|
"description": "FAKE SERVICE ENDPOINT GROUP",
|
||||||
"links": {
|
"links": {
|
||||||
"self": "http://example.com/identity/v3/OS-EP-FILTER/" +
|
"self": "http://example.com/identity/v3/OS-EP-FILTER/" +
|
||||||
"endpoint_groups/1"
|
"endpoint_groups/1"
|
||||||
},
|
},
|
||||||
"filters": {
|
"filters": {
|
||||||
"service_id": 1
|
"service_id": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FAKE_LIST_ENDPOINT_GROUPS = {
|
FAKE_LIST_ENDPOINT_GROUPS = {
|
||||||
"endpoint_groups": [
|
"endpoint_groups": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"name": "SERVICE_GROUP1",
|
"name": "SERVICE_GROUP1",
|
||||||
"description": "FAKE SERVICE ENDPOINT GROUP",
|
"description": "FAKE SERVICE ENDPOINT GROUP",
|
||||||
"links": {
|
"links": {
|
||||||
"self": "http://example.com/identity/v3/OS-EP-FILTER/" +
|
"self": "http://example.com/identity/v3/OS-EP-FILTER/" +
|
||||||
"endpoint_groups/1"
|
"endpoint_groups/1"
|
||||||
},
|
},
|
||||||
"filters": {
|
"filters": {
|
||||||
"service_id": 1
|
"service_id": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"name": "SERVICE_GROUP2",
|
"name": "SERVICE_GROUP2",
|
||||||
"description": "FAKE SERVICE ENDPOINT GROUP",
|
"description": "FAKE SERVICE ENDPOINT GROUP",
|
||||||
"links": {
|
"links": {
|
||||||
"self": "http://example.com/identity/v3/OS-EP-FILTER/" +
|
"self": "http://example.com/identity/v3/OS-EP-FILTER/" +
|
||||||
"endpoint_groups/2"
|
"endpoint_groups/2"
|
||||||
},
|
},
|
||||||
"filters": {
|
"filters": {
|
||||||
"service_id": 2
|
"service_id": 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestEndPointGroupsClient, self).setUp()
|
super(TestEndPointGroupsClient, self).setUp()
|
||||||
fake_auth = fake_auth_provider.FakeAuthProvider()
|
fake_auth = fake_auth_provider.FakeAuthProvider()
|
||||||
self.client = endpoint_groups_client.EndPointGroupsClient(
|
self.client = endpoint_groups_client.EndPointGroupsClient(
|
||||||
fake_auth, 'identity', 'regionOne')
|
fake_auth, 'identity', 'regionOne')
|
||||||
|
|
||||||
def _test_create_endpoint_group(self, bytes_body=False):
|
def _test_create_endpoint_group(self, bytes_body=False):
|
||||||
self.check_service_client_function(
|
self.check_service_client_function(
|
||||||
self.client.create_endpoint_group,
|
self.client.create_endpoint_group,
|
||||||
'tempest.lib.common.rest_client.RestClient.post',
|
'tempest.lib.common.rest_client.RestClient.post',
|
||||||
self.FAKE_CREATE_ENDPOINT_GROUP,
|
self.FAKE_CREATE_ENDPOINT_GROUP,
|
||||||
bytes_body,
|
bytes_body,
|
||||||
status=201,
|
status=201,
|
||||||
name="FAKE_ENDPOINT_GROUP",
|
name="FAKE_ENDPOINT_GROUP",
|
||||||
filters={'service_id': "1"})
|
filters={'service_id': "1"})
|
||||||
|
|
||||||
def _test_show_endpoint_group(self, bytes_body=False):
|
def _test_show_endpoint_group(self, bytes_body=False):
|
||||||
self.check_service_client_function(
|
self.check_service_client_function(
|
||||||
self.client.show_endpoint_group,
|
self.client.show_endpoint_group,
|
||||||
'tempest.lib.common.rest_client.RestClient.get',
|
'tempest.lib.common.rest_client.RestClient.get',
|
||||||
self.FAKE_ENDPOINT_GROUP_INFO,
|
self.FAKE_ENDPOINT_GROUP_INFO,
|
||||||
bytes_body,
|
bytes_body,
|
||||||
endpoint_group_id="1")
|
endpoint_group_id="1")
|
||||||
|
|
||||||
def _test_check_endpoint_group(self, bytes_body=False):
|
def _test_check_endpoint_group(self, bytes_body=False):
|
||||||
self.check_service_client_function(
|
self.check_service_client_function(
|
||||||
self.client.check_endpoint_group,
|
self.client.check_endpoint_group,
|
||||||
'tempest.lib.common.rest_client.RestClient.head',
|
'tempest.lib.common.rest_client.RestClient.head',
|
||||||
{},
|
{},
|
||||||
bytes_body,
|
bytes_body,
|
||||||
status=200,
|
status=200,
|
||||||
endpoint_group_id="1")
|
endpoint_group_id="1")
|
||||||
|
|
||||||
def _test_update_endpoint_group(self, bytes_body=False):
|
def _test_update_endpoint_group(self, bytes_body=False):
|
||||||
self.check_service_client_function(
|
self.check_service_client_function(
|
||||||
self.client.update_endpoint_group,
|
self.client.update_endpoint_group,
|
||||||
'tempest.lib.common.rest_client.RestClient.patch',
|
'tempest.lib.common.rest_client.RestClient.patch',
|
||||||
self.FAKE_ENDPOINT_GROUP_INFO,
|
self.FAKE_ENDPOINT_GROUP_INFO,
|
||||||
bytes_body,
|
bytes_body,
|
||||||
endpoint_group_id="1",
|
endpoint_group_id="1",
|
||||||
name="NewName")
|
name="NewName")
|
||||||
|
|
||||||
def _test_list_endpoint_groups(self, bytes_body=False):
|
def _test_list_endpoint_groups(self, bytes_body=False):
|
||||||
self.check_service_client_function(
|
self.check_service_client_function(
|
||||||
self.client.list_endpoint_groups,
|
self.client.list_endpoint_groups,
|
||||||
'tempest.lib.common.rest_client.RestClient.get',
|
'tempest.lib.common.rest_client.RestClient.get',
|
||||||
self.FAKE_LIST_ENDPOINT_GROUPS,
|
self.FAKE_LIST_ENDPOINT_GROUPS,
|
||||||
bytes_body)
|
bytes_body)
|
||||||
|
|
||||||
def test_create_endpoint_group_with_str_body(self):
|
def test_create_endpoint_group_with_str_body(self):
|
||||||
self._test_create_endpoint_group()
|
self._test_create_endpoint_group()
|
||||||
|
|
||||||
def test_create_endpoint_group_with_bytes_body(self):
|
def test_create_endpoint_group_with_bytes_body(self):
|
||||||
self._test_create_endpoint_group(bytes_body=True)
|
self._test_create_endpoint_group(bytes_body=True)
|
||||||
|
|
||||||
def test_show_endpoint_group_with_str_body(self):
|
def test_show_endpoint_group_with_str_body(self):
|
||||||
self._test_show_endpoint_group()
|
self._test_show_endpoint_group()
|
||||||
|
|
||||||
def test_show_endpoint_group_with_bytes_body(self):
|
def test_show_endpoint_group_with_bytes_body(self):
|
||||||
self._test_show_endpoint_group(bytes_body=True)
|
self._test_show_endpoint_group(bytes_body=True)
|
||||||
|
|
||||||
def test_check_endpoint_group_with_str_body(self):
|
def test_check_endpoint_group_with_str_body(self):
|
||||||
self._test_check_endpoint_group()
|
self._test_check_endpoint_group()
|
||||||
|
|
||||||
def test_check_endpoint_group_with_bytes_body(self):
|
def test_check_endpoint_group_with_bytes_body(self):
|
||||||
self._test_check_endpoint_group(bytes_body=True)
|
self._test_check_endpoint_group(bytes_body=True)
|
||||||
|
|
||||||
def test_list_endpoint_groups_with_str_body(self):
|
def test_list_endpoint_groups_with_str_body(self):
|
||||||
self._test_list_endpoint_groups()
|
self._test_list_endpoint_groups()
|
||||||
|
|
||||||
def test_list_endpoint_groups_with_bytes_body(self):
|
def test_list_endpoint_groups_with_bytes_body(self):
|
||||||
self._test_list_endpoint_groups(bytes_body=True)
|
self._test_list_endpoint_groups(bytes_body=True)
|
||||||
|
|
||||||
def test_update_endpoint_group_with_str_body(self):
|
def test_update_endpoint_group_with_str_body(self):
|
||||||
self._test_update_endpoint_group()
|
self._test_update_endpoint_group()
|
||||||
|
|
||||||
def test_update_endpoint_group_with_bytes_body(self):
|
def test_update_endpoint_group_with_bytes_body(self):
|
||||||
self._test_update_endpoint_group(bytes_body=True)
|
self._test_update_endpoint_group(bytes_body=True)
|
||||||
|
|
||||||
def test_delete_endpoint_group(self):
|
def test_delete_endpoint_group(self):
|
||||||
self.check_service_client_function(
|
self.check_service_client_function(
|
||||||
self.client.delete_endpoint_group,
|
self.client.delete_endpoint_group,
|
||||||
'tempest.lib.common.rest_client.RestClient.delete',
|
'tempest.lib.common.rest_client.RestClient.delete',
|
||||||
{},
|
{},
|
||||||
endpoint_group_id="1",
|
endpoint_group_id="1",
|
||||||
status=204)
|
status=204)
|
||||||
|
|
Loading…
Reference in New Issue