Adding description for testcases - identity part2

When Tempest is used in customer site, often we are required to
provide a testcase list including testcase names and descriptions.
Now no this kind of doc is available, so we can add descriptions
with the format of doc string for every testcase, so later we
can generata such a testcase description list.

There are hundreds of testcases missing descriptions, so we can
add them gradually, and limit the modified files in one patch
for the convenience of reviewing.

Change-Id: Ifd23fd4cc442a3188a5a19b506694abffadea610
partially-implements: blueprint testcase-description
This commit is contained in:
zhufl 2020-04-27 14:46:46 +08:00 committed by Ghanshyam Mann
parent a188178416
commit 8e3aacd7e9
10 changed files with 40 additions and 11 deletions

View File

@ -18,11 +18,12 @@ from tempest.lib import decorators
class TestApiDiscovery(base.BaseIdentityV2Test): class TestApiDiscovery(base.BaseIdentityV2Test):
"""Tests for API discovery features.""" """Tests for identity v2 API discovery features."""
@decorators.attr(type='smoke') @decorators.attr(type='smoke')
@decorators.idempotent_id('ea889a68-a15f-4166-bfb1-c12456eae853') @decorators.idempotent_id('ea889a68-a15f-4166-bfb1-c12456eae853')
def test_api_version_resources(self): def test_api_version_resources(self):
"""Test showing identity v2 api version resources"""
descr = self.non_admin_client.show_api_description()['version'] descr = self.non_admin_client.show_api_description()['version']
expected_resources = ('id', 'links', 'media-types', 'status', expected_resources = ('id', 'links', 'media-types', 'status',
'updated') 'updated')
@ -34,6 +35,7 @@ class TestApiDiscovery(base.BaseIdentityV2Test):
@decorators.attr(type='smoke') @decorators.attr(type='smoke')
@decorators.idempotent_id('007a0be0-78fe-4fdb-bbee-e9216cc17bb2') @decorators.idempotent_id('007a0be0-78fe-4fdb-bbee-e9216cc17bb2')
def test_api_media_types(self): def test_api_media_types(self):
"""Test showing identity v2 api version media type"""
descr = self.non_admin_client.show_api_description()['version'] descr = self.non_admin_client.show_api_description()['version']
# Get MIME type bases and descriptions # Get MIME type bases and descriptions
media_types = [(media_type['base'], media_type['type']) for media_types = [(media_type['base'], media_type['type']) for
@ -49,6 +51,7 @@ class TestApiDiscovery(base.BaseIdentityV2Test):
@decorators.attr(type='smoke') @decorators.attr(type='smoke')
@decorators.idempotent_id('77fd6be0-8801-48e6-b9bf-38cdd2f253ec') @decorators.idempotent_id('77fd6be0-8801-48e6-b9bf-38cdd2f253ec')
def test_api_version_statuses(self): def test_api_version_statuses(self):
"""Test showing identity v2 api version status"""
descr = self.non_admin_client.show_api_description()['version'] descr = self.non_admin_client.show_api_description()['version']
status = descr['status'].lower() status = descr['status'].lower()
supported_statuses = ['current', 'stable', 'experimental', supported_statuses = ['current', 'stable', 'experimental',

View File

@ -18,10 +18,11 @@ from tempest.lib import decorators
class ExtensionTestJSON(base.BaseIdentityV2Test): class ExtensionTestJSON(base.BaseIdentityV2Test):
"""Test extensions in identity v2 API"""
@decorators.idempotent_id('85f3f661-f54c-4d48-b563-72ae952b9383') @decorators.idempotent_id('85f3f661-f54c-4d48-b563-72ae952b9383')
def test_list_extensions(self): def test_list_extensions(self):
# List all the extensions """List all the identity extensions via v2 API"""
body = self.non_admin_client.list_extensions()['extensions']['values'] body = self.non_admin_client.list_extensions()['extensions']['values']
self.assertNotEmpty(body) self.assertNotEmpty(body)
keys = ['name', 'updated', 'alias', 'links', keys = ['name', 'updated', 'alias', 'links',

View File

@ -19,11 +19,13 @@ from tempest.lib import exceptions as lib_exc
class IdentityTenantsTest(base.BaseIdentityV2Test): class IdentityTenantsTest(base.BaseIdentityV2Test):
"""Test listing tenants in identity v2 API"""
credentials = ['primary', 'alt'] credentials = ['primary', 'alt']
@decorators.idempotent_id('ecae2459-243d-4ba1-ad02-65f15dc82b78') @decorators.idempotent_id('ecae2459-243d-4ba1-ad02-65f15dc82b78')
def test_list_tenants_returns_only_authorized_tenants(self): def test_list_tenants_returns_only_authorized_tenants(self):
"""Test listing tenants only returns authorized tenants via v2 API"""
alt_tenant_name = self.os_alt.credentials.tenant_name alt_tenant_name = self.os_alt.credentials.tenant_name
resp = self.non_admin_tenants_client.list_tenants() resp = self.non_admin_tenants_client.list_tenants()

View File

@ -20,10 +20,11 @@ from tempest.lib import decorators
class TokensTest(base.BaseIdentityV2Test): class TokensTest(base.BaseIdentityV2Test):
"""Test tokens in identity v2 API"""
@decorators.idempotent_id('65ae3b78-91ff-467b-a705-f6678863b8ec') @decorators.idempotent_id('65ae3b78-91ff-467b-a705-f6678863b8ec')
def test_create_token(self): def test_create_token(self):
"""Test creating token for user via v2 API"""
token_client = self.non_admin_token_client token_client = self.non_admin_token_client
# get a token for the user # get a token for the user

View File

@ -28,6 +28,7 @@ CONF = config.CONF
class IdentityUsersTest(base.BaseIdentityV2Test): class IdentityUsersTest(base.BaseIdentityV2Test):
"""Test user password in identity v2 API"""
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):
@ -85,6 +86,7 @@ class IdentityUsersTest(base.BaseIdentityV2Test):
'immutable user source and solely ' 'immutable user source and solely '
'provides read-only access to users.') 'provides read-only access to users.')
def test_user_update_own_password(self): def test_user_update_own_password(self):
"""test updating user's own password via v2 API"""
old_pass = self.creds.password old_pass = self.creds.password
old_token = self.non_admin_users_client.token old_token = self.non_admin_users_client.token
new_pass = data_utils.rand_password() new_pass = data_utils.rand_password()

View File

@ -22,10 +22,11 @@ CONF = config.CONF
class TestApiDiscovery(base.BaseIdentityV3Test): class TestApiDiscovery(base.BaseIdentityV3Test):
"""Tests for API discovery features.""" """Tests for identity API discovery features."""
@decorators.idempotent_id('79aec9ae-710f-4c54-a4fc-3aa25b4feac3') @decorators.idempotent_id('79aec9ae-710f-4c54-a4fc-3aa25b4feac3')
def test_identity_v3_existence(self): def test_identity_v3_existence(self):
"""Test that identity v3 version should exist"""
versions = self.non_admin_versions_client.list_versions() versions = self.non_admin_versions_client.list_versions()
found = any( found = any(
"v3" in version.get('id') "v3" in version.get('id')
@ -35,9 +36,12 @@ class TestApiDiscovery(base.BaseIdentityV3Test):
@decorators.idempotent_id('721f480f-35b6-46c7-846e-047e6acea0dc') @decorators.idempotent_id('721f480f-35b6-46c7-846e-047e6acea0dc')
@decorators.attr(type='smoke') @decorators.attr(type='smoke')
def test_list_api_versions(self): def test_list_api_versions(self):
# NOTE: Actually this API doesn't depend on v3 API at all, because """Test listing identity api versions
# the API operation is "GET /" without v3's endpoint. The reason of
# this test path is just v3 API is CURRENT on Keystone side. NOTE: Actually this API doesn't depend on v3 API at all, because
the API operation is "GET /" without v3's endpoint. The reason of
this test path is just v3 API is CURRENT on Keystone side.
"""
versions = self.non_admin_versions_client.list_versions() versions = self.non_admin_versions_client.list_versions()
expected_resources = ('id', 'links', 'media-types', 'status', expected_resources = ('id', 'links', 'media-types', 'status',
'updated') 'updated')
@ -49,6 +53,7 @@ class TestApiDiscovery(base.BaseIdentityV3Test):
@decorators.attr(type='smoke') @decorators.attr(type='smoke')
@decorators.idempotent_id('b9232f5e-d9e5-4d97-b96c-28d3db4de1bd') @decorators.idempotent_id('b9232f5e-d9e5-4d97-b96c-28d3db4de1bd')
def test_api_version_resources(self): def test_api_version_resources(self):
"""Test showing identity v3 api version resources"""
descr = self.non_admin_client.show_api_description()['version'] descr = self.non_admin_client.show_api_description()['version']
expected_resources = ('id', 'links', 'media-types', 'status', expected_resources = ('id', 'links', 'media-types', 'status',
'updated') 'updated')
@ -60,6 +65,7 @@ class TestApiDiscovery(base.BaseIdentityV3Test):
@decorators.attr(type='smoke') @decorators.attr(type='smoke')
@decorators.idempotent_id('657c1970-4722-4189-8831-7325f3bc4265') @decorators.idempotent_id('657c1970-4722-4189-8831-7325f3bc4265')
def test_api_media_types(self): def test_api_media_types(self):
"""Test showing identity v3 api version media type"""
descr = self.non_admin_client.show_api_description()['version'] descr = self.non_admin_client.show_api_description()['version']
# Get MIME type bases and descriptions # Get MIME type bases and descriptions
media_types = [(media_type['base'], media_type['type']) for media_types = [(media_type['base'], media_type['type']) for
@ -75,6 +81,7 @@ class TestApiDiscovery(base.BaseIdentityV3Test):
@decorators.attr(type='smoke') @decorators.attr(type='smoke')
@decorators.idempotent_id('8879a470-abfb-47bb-bb8d-5a7fd279ad1e') @decorators.idempotent_id('8879a470-abfb-47bb-bb8d-5a7fd279ad1e')
def test_api_version_statuses(self): def test_api_version_statuses(self):
"""Test showing identity v3 api version status"""
descr = self.non_admin_client.show_api_description()['version'] descr = self.non_admin_client.show_api_description()['version']
status = descr['status'].lower() status = descr['status'].lower()
supported_statuses = ['current', 'stable', 'experimental', supported_statuses = ['current', 'stable', 'experimental',

View File

@ -21,6 +21,7 @@ CONF = config.CONF
class DefaultDomainTestJSON(base.BaseIdentityV3Test): class DefaultDomainTestJSON(base.BaseIdentityV3Test):
"""Test identity default domains"""
@classmethod @classmethod
def setup_clients(cls): def setup_clients(cls):
@ -35,5 +36,6 @@ class DefaultDomainTestJSON(base.BaseIdentityV3Test):
@decorators.attr(type='smoke') @decorators.attr(type='smoke')
@decorators.idempotent_id('17a5de24-e6a0-4e4a-a9ee-d85b6e5612b5') @decorators.idempotent_id('17a5de24-e6a0-4e4a-a9ee-d85b6e5612b5')
def test_default_domain_exists(self): def test_default_domain_exists(self):
"""Test showing default domain"""
domain = self.domains_client.show_domain(self.domain_id)['domain'] domain = self.domains_client.show_domain(self.domain_id)['domain']
self.assertTrue(domain['enabled']) self.assertTrue(domain['enabled'])

View File

@ -19,11 +19,13 @@ from tempest.lib import exceptions as lib_exc
class IdentityV3ProjectsTest(base.BaseIdentityV3Test): class IdentityV3ProjectsTest(base.BaseIdentityV3Test):
"""Test identity projects"""
credentials = ['primary', 'alt'] credentials = ['primary', 'alt']
@decorators.idempotent_id('86128d46-e170-4644-866a-cc487f699e1d') @decorators.idempotent_id('86128d46-e170-4644-866a-cc487f699e1d')
def test_list_projects_returns_only_authorized_projects(self): def test_list_projects_returns_only_authorized_projects(self):
"""Test listing projects only returns authorized projects"""
alt_project_name = self.os_alt.credentials.project_name alt_project_name = self.os_alt.credentials.project_name
resp = self.non_admin_users_client.list_user_projects( resp = self.non_admin_users_client.list_user_projects(
self.os_primary.credentials.user_id) self.os_primary.credentials.user_id)

View File

@ -22,9 +22,11 @@ from tempest.lib import exceptions as lib_exc
class TokensV3Test(base.BaseIdentityV3Test): class TokensV3Test(base.BaseIdentityV3Test):
"""Test identity tokens"""
@decorators.idempotent_id('a9512ac3-3909-48a4-b395-11f438e16260') @decorators.idempotent_id('a9512ac3-3909-48a4-b395-11f438e16260')
def test_validate_token(self): def test_validate_token(self):
"""Test validating token for user"""
creds = self.os_primary.credentials creds = self.os_primary.credentials
user_id = creds.user_id user_id = creds.user_id
username = creds.username username = creds.username
@ -58,7 +60,7 @@ class TokensV3Test(base.BaseIdentityV3Test):
@decorators.idempotent_id('6f8e4436-fc96-4282-8122-e41df57197a9') @decorators.idempotent_id('6f8e4436-fc96-4282-8122-e41df57197a9')
def test_create_token(self): def test_create_token(self):
"""Test creating token for user"""
creds = self.os_primary.credentials creds = self.os_primary.credentials
user_id = creds.user_id user_id = creds.user_id
username = creds.username username = creds.username
@ -109,9 +111,12 @@ class TokensV3Test(base.BaseIdentityV3Test):
@decorators.idempotent_id('0f9f5a5f-d5cd-4a86-8a5b-c5ded151f212') @decorators.idempotent_id('0f9f5a5f-d5cd-4a86-8a5b-c5ded151f212')
def test_token_auth_creation_existence_deletion(self): def test_token_auth_creation_existence_deletion(self):
# Tests basic token auth functionality in a way that is compatible with """Test auth/check existence/delete token for user
# pre-provisioned credentials. The default user is used for token
# authentication. Tests basic token auth functionality in a way that is compatible with
pre-provisioned credentials. The default user is used for token
authentication.
"""
# Valid user's token is authenticated # Valid user's token is authenticated
user = self.os_primary.credentials user = self.os_primary.credentials

View File

@ -28,6 +28,7 @@ CONF = config.CONF
class IdentityV3UsersTest(base.BaseIdentityV3Test): class IdentityV3UsersTest(base.BaseIdentityV3Test):
"""Test identity user password"""
@classmethod @classmethod
def resource_setup(cls): def resource_setup(cls):
@ -82,6 +83,7 @@ class IdentityV3UsersTest(base.BaseIdentityV3Test):
'immutable user source and solely ' 'immutable user source and solely '
'provides read-only access to users.') 'provides read-only access to users.')
def test_user_update_own_password(self): def test_user_update_own_password(self):
"""Test updating user's own password"""
old_pass = self.creds.password old_pass = self.creds.password
old_token = self.non_admin_client.token old_token = self.non_admin_client.token
new_pass = data_utils.rand_password() new_pass = data_utils.rand_password()
@ -111,6 +113,7 @@ class IdentityV3UsersTest(base.BaseIdentityV3Test):
'immutable user source and solely ' 'immutable user source and solely '
'provides read-only access to users.') 'provides read-only access to users.')
def test_password_history_check_self_service_api(self): def test_password_history_check_self_service_api(self):
"""Test checking password changing history"""
old_pass = self.creds.password old_pass = self.creds.password
new_pass1 = data_utils.rand_password() new_pass1 = data_utils.rand_password()
new_pass2 = data_utils.rand_password() new_pass2 = data_utils.rand_password()
@ -141,6 +144,7 @@ class IdentityV3UsersTest(base.BaseIdentityV3Test):
'Security compliance not available.') 'Security compliance not available.')
@decorators.idempotent_id('a7ad8bbf-2cff-4520-8c1d-96332e151658') @decorators.idempotent_id('a7ad8bbf-2cff-4520-8c1d-96332e151658')
def test_user_account_lockout(self): def test_user_account_lockout(self):
"""Test locking out user account after failure attempts"""
if (CONF.identity.user_lockout_failure_attempts <= 0 or if (CONF.identity.user_lockout_failure_attempts <= 0 or
CONF.identity.user_lockout_duration <= 0): CONF.identity.user_lockout_duration <= 0):
raise self.skipException( raise self.skipException(