Add keystone v2.0 and v3 api discovery checks
Keystone documentation is quite strict about field media-types and status, therefore they must be validated. Remaining fields are checked only for their presence in response. Change-Id: I76f50bc1cf5581b35adca410bb7f5d4ec9aecbf4
This commit is contained in:
parent
7e22845cb2
commit
8135405db9
|
@ -0,0 +1,57 @@
|
|||
# Copyright 2015 OpenStack Foundation.
|
||||
# Copyright 2015, 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.api.identity import base
|
||||
from tempest import test
|
||||
|
||||
|
||||
class TestApiDiscovery(base.BaseIdentityV2Test):
|
||||
"""Tests for API discovery features."""
|
||||
|
||||
@test.attr(type='smoke')
|
||||
@test.idempotent_id('ea889a68-a15f-4166-bfb1-c12456eae853')
|
||||
def test_api_version_resources(self):
|
||||
descr = self.non_admin_client.get_api_description()
|
||||
expected_resources = ('id', 'links', 'media-types', 'status',
|
||||
'updated')
|
||||
|
||||
keys = descr.keys()
|
||||
for res in expected_resources:
|
||||
self.assertIn(res, keys)
|
||||
|
||||
@test.attr(type='smoke')
|
||||
@test.idempotent_id('007a0be0-78fe-4fdb-bbee-e9216cc17bb2')
|
||||
def test_api_media_types(self):
|
||||
descr = self.non_admin_client.get_api_description()
|
||||
# Get MIME type bases and descriptions
|
||||
media_types = [(media_type['base'], media_type['type']) for
|
||||
media_type in descr['media-types']]
|
||||
# These are supported for API version 2
|
||||
supported_types = [('application/json',
|
||||
'application/vnd.openstack.identity-v2.0+json')]
|
||||
|
||||
# Check if supported types exist in response body
|
||||
for s_type in supported_types:
|
||||
self.assertIn(s_type, media_types)
|
||||
|
||||
@test.attr(type='smoke')
|
||||
@test.idempotent_id('77fd6be0-8801-48e6-b9bf-38cdd2f253ec')
|
||||
def test_api_version_statuses(self):
|
||||
descr = self.non_admin_client.get_api_description()
|
||||
status = descr['status'].lower()
|
||||
supported_statuses = ['current', 'stable', 'experimental',
|
||||
'supported', 'deprecated']
|
||||
|
||||
self.assertIn(status, supported_statuses)
|
|
@ -0,0 +1,57 @@
|
|||
# Copyright 2015 OpenStack Foundation.
|
||||
# Copyright 2015, 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.api.identity import base
|
||||
from tempest import test
|
||||
|
||||
|
||||
class TestApiDiscovery(base.BaseIdentityV3Test):
|
||||
"""Tests for API discovery features."""
|
||||
|
||||
@test.attr(type='smoke')
|
||||
@test.idempotent_id('b9232f5e-d9e5-4d97-b96c-28d3db4de1bd')
|
||||
def test_api_version_resources(self):
|
||||
descr = self.non_admin_client.get_api_description()
|
||||
expected_resources = ('id', 'links', 'media-types', 'status',
|
||||
'updated')
|
||||
|
||||
keys = descr.keys()
|
||||
for res in expected_resources:
|
||||
self.assertIn(res, keys)
|
||||
|
||||
@test.attr(type='smoke')
|
||||
@test.idempotent_id('657c1970-4722-4189-8831-7325f3bc4265')
|
||||
def test_api_media_types(self):
|
||||
descr = self.non_admin_client.get_api_description()
|
||||
# Get MIME type bases and descriptions
|
||||
media_types = [(media_type['base'], media_type['type']) for
|
||||
media_type in descr['media-types']]
|
||||
# These are supported for API version 2
|
||||
supported_types = [('application/json',
|
||||
'application/vnd.openstack.identity-v3+json')]
|
||||
|
||||
# Check if supported types exist in response body
|
||||
for s_type in supported_types:
|
||||
self.assertIn(s_type, media_types)
|
||||
|
||||
@test.attr(type='smoke')
|
||||
@test.idempotent_id('8879a470-abfb-47bb-bb8d-5a7fd279ad1e')
|
||||
def test_api_version_statuses(self):
|
||||
descr = self.non_admin_client.get_api_description()
|
||||
status = descr['status'].lower()
|
||||
supported_statuses = ['current', 'stable', 'experimental',
|
||||
'supported', 'deprecated']
|
||||
|
||||
self.assertIn(status, supported_statuses)
|
|
@ -18,6 +18,13 @@ from tempest.common import service_client
|
|||
|
||||
class IdentityClientJSON(service_client.ServiceClient):
|
||||
|
||||
def get_api_description(self):
|
||||
"""Retrieves info about the v2.0 Identity API"""
|
||||
url = ''
|
||||
resp, body = self.get(url)
|
||||
self.expected_success([200, 203], resp.status)
|
||||
return service_client.ResponseBody(resp, self._parse_resp(body))
|
||||
|
||||
def has_admin_extensions(self):
|
||||
"""
|
||||
Returns True if the KSADM Admin Extensions are supported
|
||||
|
|
|
@ -22,6 +22,13 @@ from tempest.common import service_client
|
|||
class IdentityV3ClientJSON(service_client.ServiceClient):
|
||||
api_version = "v3"
|
||||
|
||||
def get_api_description(self):
|
||||
"""Retrieves info about the v3 Identity API"""
|
||||
url = ''
|
||||
resp, body = self.get(url)
|
||||
self.expected_success(200, resp.status)
|
||||
return service_client.ResponseBody(resp, self._parse_resp(body))
|
||||
|
||||
def create_user(self, user_name, password=None, project_id=None,
|
||||
email=None, domain_id='default', **kwargs):
|
||||
"""Creates a user."""
|
||||
|
|
Loading…
Reference in New Issue