From 3b46d27c90aa6289724f4c137a0838c89d116b62 Mon Sep 17 00:00:00 2001 From: Jordan Pittier Date: Wed, 12 Apr 2017 16:17:28 +0200 Subject: Move the `attr` decorator from test.py to tempest/lib I think it's a good idea to move all utility decorators into tempest/lib/decorators.py. This patch does that for the `attr` decorator. Change-Id: Iaafbb112b6eee458089cc49918359a8a8d0485e2 --- .../api/identity/admin/v2/test_roles_negative.py | 41 ++++++++++----------- tempest/api/identity/admin/v2/test_services.py | 3 +- .../api/identity/admin/v2/test_tenant_negative.py | 27 +++++++------- tempest/api/identity/admin/v2/test_users.py | 3 +- .../api/identity/admin/v2/test_users_negative.py | 43 +++++++++++----------- tempest/api/identity/admin/v3/test_credentials.py | 3 +- tempest/api/identity/admin/v3/test_domains.py | 5 +-- .../api/identity/admin/v3/test_domains_negative.py | 11 +++--- tempest/api/identity/admin/v3/test_endpoints.py | 3 +- .../identity/admin/v3/test_endpoints_negative.py | 9 ++--- tempest/api/identity/admin/v3/test_groups.py | 3 +- tempest/api/identity/admin/v3/test_policies.py | 3 +- .../identity/admin/v3/test_projects_negative.py | 15 ++++---- tempest/api/identity/admin/v3/test_regions.py | 3 +- tempest/api/identity/admin/v3/test_roles.py | 3 +- tempest/api/identity/admin/v3/test_services.py | 3 +- tempest/api/identity/admin/v3/test_trusts.py | 3 +- .../api/identity/admin/v3/test_users_negative.py | 5 +-- 18 files changed, 84 insertions(+), 102 deletions(-) (limited to 'tempest/api/identity/admin') diff --git a/tempest/api/identity/admin/v2/test_roles_negative.py b/tempest/api/identity/admin/v2/test_roles_negative.py index f80721c83..86d06e201 100644 --- a/tempest/api/identity/admin/v2/test_roles_negative.py +++ b/tempest/api/identity/admin/v2/test_roles_negative.py @@ -17,7 +17,6 @@ from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): @@ -28,14 +27,14 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): role = self.setup_test_role() return (user, tenant, role) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('d5d5f1df-f8ca-4de0-b2ef-259c1cc67025') def test_list_roles_by_unauthorized_user(self): # Non-administrator user should not be able to list roles self.assertRaises(lib_exc.Forbidden, self.non_admin_roles_client.list_roles) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('11a3c7da-df6c-40c2-abc2-badd682edf9f') def test_list_roles_request_without_token(self): # Request to list roles without a valid token should fail @@ -44,14 +43,14 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): self.assertRaises(lib_exc.Unauthorized, self.roles_client.list_roles) self.client.auth_provider.clear_auth() - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('c0b89e56-accc-4c73-85f8-9c0f866104c1') def test_role_create_blank_name(self): # Should not be able to create a role with a blank name self.assertRaises(lib_exc.BadRequest, self.roles_client.create_role, name='') - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('585c8998-a8a4-4641-a5dd-abef7a8ced00') def test_create_role_by_unauthorized_user(self): # Non-administrator user should not be able to create role @@ -60,7 +59,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): self.non_admin_roles_client.create_role, name=role_name) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('a7edd17a-e34a-4aab-8bb7-fa6f498645b8') def test_create_role_request_without_token(self): # Request to create role without a valid token should fail @@ -71,7 +70,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): self.roles_client.create_role, name=role_name) self.client.auth_provider.clear_auth() - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('c0cde2c8-81c1-4bb0-8fe2-cf615a3547a8') def test_role_create_duplicate(self): # Role names should be unique @@ -82,7 +81,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): self.assertRaises(lib_exc.Conflict, self.roles_client.create_role, name=role_name) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('15347635-b5b1-4a87-a280-deb2bd6d865e') def test_delete_role_by_unauthorized_user(self): # Non-administrator user should not be able to delete role @@ -93,7 +92,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): self.assertRaises(lib_exc.Forbidden, self.non_admin_roles_client.delete_role, role_id) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('44b60b20-70de-4dac-beaf-a3fc2650a16b') def test_delete_role_request_without_token(self): # Request to delete role without a valid token should fail @@ -108,7 +107,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): role_id) self.client.auth_provider.clear_auth() - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('38373691-8551-453a-b074-4260ad8298ef') def test_delete_role_non_existent(self): # Attempt to delete a non existent role should fail @@ -116,7 +115,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): self.assertRaises(lib_exc.NotFound, self.roles_client.delete_role, non_existent_role) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('391df5cf-3ec3-46c9-bbe5-5cb58dd4dc41') def test_assign_user_role_by_unauthorized_user(self): # Non-administrator user should not be authorized to @@ -127,7 +126,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): self.non_admin_roles_client.create_user_role_on_project, tenant['id'], user['id'], role['id']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('f0d2683c-5603-4aee-95d7-21420e87cfd8') def test_assign_user_role_request_without_token(self): # Request to assign a role to a user without a valid token @@ -140,7 +139,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): user['id'], role['id']) self.client.auth_provider.clear_auth() - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('99b297f6-2b5d-47c7-97a9-8b6bb4f91042') def test_assign_user_role_for_non_existent_role(self): # Attempt to assign a non existent role to user should fail @@ -150,7 +149,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): self.roles_client.create_user_role_on_project, tenant['id'], user['id'], non_existent_role) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('b2285aaa-9e76-4704-93a9-7a8acd0a6c8f') def test_assign_user_role_for_non_existent_tenant(self): # Attempt to assign a role on a non existent tenant should fail @@ -160,7 +159,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): self.roles_client.create_user_role_on_project, non_existent_tenant, user['id'], role['id']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('5c3132cd-c4c8-4402-b5ea-71eb44e97793') def test_assign_duplicate_user_role(self): # Duplicate user role should not get assigned @@ -172,7 +171,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): self.roles_client.create_user_role_on_project, tenant['id'], user['id'], role['id']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('d0537987-0977-448f-a435-904c15de7298') def test_remove_user_role_by_unauthorized_user(self): # Non-administrator user should not be authorized to @@ -186,7 +185,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): self.non_admin_roles_client.delete_role_from_user_on_project, tenant['id'], user['id'], role['id']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('cac81cf4-c1d2-47dc-90d3-f2b7eb572286') def test_remove_user_role_request_without_token(self): # Request to remove a user's role without a valid token @@ -201,7 +200,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): tenant['id'], user['id'], role['id']) self.client.auth_provider.clear_auth() - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('ab32d759-cd16-41f1-a86e-44405fa9f6d2') def test_remove_user_role_non_existent_role(self): # Attempt to delete a non existent role from a user should fail @@ -214,7 +213,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): self.roles_client.delete_role_from_user_on_project, tenant['id'], user['id'], non_existent_role) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('67a679ec-03dd-4551-bbfc-d1c93284f023') def test_remove_user_role_non_existent_tenant(self): # Attempt to remove a role from a non existent tenant should fail @@ -227,7 +226,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): self.roles_client.delete_role_from_user_on_project, non_existent_tenant, user['id'], role['id']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('7391ab4c-06f3-477a-a64a-c8e55ce89837') def test_list_user_roles_by_unauthorized_user(self): # Non-administrator user should not be authorized to list @@ -241,7 +240,7 @@ class RolesNegativeTestJSON(base.BaseIdentityV2AdminTest): self.non_admin_roles_client.list_user_roles_on_project, tenant['id'], user['id']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('682adfb2-fd5f-4b0a-a9ca-322e9bebb907') def test_list_user_roles_request_without_token(self): # Request to list user's roles without a valid token should fail diff --git a/tempest/api/identity/admin/v2/test_services.py b/tempest/api/identity/admin/v2/test_services.py index f6d4a241a..634cf21f2 100644 --- a/tempest/api/identity/admin/v2/test_services.py +++ b/tempest/api/identity/admin/v2/test_services.py @@ -17,7 +17,6 @@ from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class ServicesTestJSON(base.BaseIdentityV2AdminTest): @@ -78,7 +77,7 @@ class ServicesTestJSON(base.BaseIdentityV2AdminTest): self.assertIn('type', service) self.assertEqual(s_type, service['type']) - @test.attr(type='smoke') + @decorators.attr(type='smoke') @decorators.idempotent_id('34ea6489-012d-4a86-9038-1287cadd5eca') def test_list_services(self): # Create, List, Verify and Delete Services diff --git a/tempest/api/identity/admin/v2/test_tenant_negative.py b/tempest/api/identity/admin/v2/test_tenant_negative.py index 69f0920d2..750f9f900 100644 --- a/tempest/api/identity/admin/v2/test_tenant_negative.py +++ b/tempest/api/identity/admin/v2/test_tenant_negative.py @@ -17,19 +17,18 @@ from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest): - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('ca9bb202-63dd-4240-8a07-8ef9c19c04bb') def test_list_tenants_by_unauthorized_user(self): # Non-administrator user should not be able to list tenants self.assertRaises(lib_exc.Forbidden, self.non_admin_tenants_client.list_tenants) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('df33926c-1c96-4d8d-a762-79cc6b0c3cf4') def test_list_tenant_request_without_token(self): # Request to list tenants without a valid token should fail @@ -39,7 +38,7 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest): self.tenants_client.list_tenants) self.client.auth_provider.clear_auth() - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('162ba316-f18b-4987-8c0c-fd9140cd63ed') def test_tenant_delete_by_unauthorized_user(self): # Non-administrator user should not be able to delete a tenant @@ -50,7 +49,7 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest): self.non_admin_tenants_client.delete_tenant, tenant['id']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('e450db62-2e9d-418f-893a-54772d6386b1') def test_tenant_delete_request_without_token(self): # Request to delete a tenant without a valid token should fail @@ -64,14 +63,14 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest): tenant['id']) self.client.auth_provider.clear_auth() - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('9c9a2aed-6e3c-467a-8f5c-89da9d1b516b') def test_delete_non_existent_tenant(self): # Attempt to delete a non existent tenant should fail self.assertRaises(lib_exc.NotFound, self.tenants_client.delete_tenant, data_utils.rand_uuid_hex()) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('af16f44b-a849-46cb-9f13-a751c388f739') def test_tenant_create_duplicate(self): # Tenant names should be unique @@ -83,7 +82,7 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest): self.assertRaises(lib_exc.Conflict, self.tenants_client.create_tenant, name=tenant_name) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('d26b278a-6389-4702-8d6e-5980d80137e0') def test_create_tenant_by_unauthorized_user(self): # Non-administrator user should not be authorized to create a tenant @@ -92,7 +91,7 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest): self.non_admin_tenants_client.create_tenant, name=tenant_name) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('a3ee9d7e-6920-4dd5-9321-d4b2b7f0a638') def test_create_tenant_request_without_token(self): # Create tenant request without a token should not be authorized @@ -104,7 +103,7 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest): name=tenant_name) self.client.auth_provider.clear_auth() - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('5a2e4ca9-b0c0-486c-9c48-64a94fba2395') def test_create_tenant_with_empty_name(self): # Tenant name should not be empty @@ -112,7 +111,7 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest): self.tenants_client.create_tenant, name='') - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('2ff18d1e-dfe3-4359-9dc3-abf582c196b9') def test_create_tenants_name_length_over_64(self): # Tenant name length should not be greater than 64 characters @@ -121,14 +120,14 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest): self.tenants_client.create_tenant, name=tenant_name) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('bd20dc2a-9557-4db7-b755-f48d952ad706') def test_update_non_existent_tenant(self): # Attempt to update a non existent tenant should fail self.assertRaises(lib_exc.NotFound, self.tenants_client.update_tenant, data_utils.rand_uuid_hex()) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('41704dc5-c5f7-4f79-abfa-76e6fedc570b') def test_tenant_update_by_unauthorized_user(self): # Non-administrator user should not be able to update a tenant @@ -139,7 +138,7 @@ class TenantsNegativeTestJSON(base.BaseIdentityV2AdminTest): self.non_admin_tenants_client.update_tenant, tenant['id']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('7a421573-72c7-4c22-a98e-ce539219c657') def test_tenant_update_request_without_token(self): # Request to update a tenant without a valid token should fail diff --git a/tempest/api/identity/admin/v2/test_users.py b/tempest/api/identity/admin/v2/test_users.py index df4ded85f..4d7c11943 100644 --- a/tempest/api/identity/admin/v2/test_users.py +++ b/tempest/api/identity/admin/v2/test_users.py @@ -21,7 +21,6 @@ from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils from tempest.lib import decorators -from tempest import test class UsersTestJSON(base.BaseIdentityV2AdminTest): @@ -33,7 +32,7 @@ class UsersTestJSON(base.BaseIdentityV2AdminTest): cls.alt_password = data_utils.rand_password() cls.alt_email = cls.alt_user + '@testmail.tm' - @test.attr(type='smoke') + @decorators.attr(type='smoke') @decorators.idempotent_id('2d55a71e-da1d-4b43-9c03-d269fd93d905') def test_create_user(self): # Create a user diff --git a/tempest/api/identity/admin/v2/test_users_negative.py b/tempest/api/identity/admin/v2/test_users_negative.py index 442c1a7c3..4f47e41d8 100644 --- a/tempest/api/identity/admin/v2/test_users_negative.py +++ b/tempest/api/identity/admin/v2/test_users_negative.py @@ -17,7 +17,6 @@ from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): @@ -29,7 +28,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): cls.alt_password = data_utils.rand_password() cls.alt_email = cls.alt_user + '@testmail.tm' - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('60a1f5fa-5744-4cdf-82bf-60b7de2d29a4') def test_create_user_by_unauthorized_user(self): # Non-administrator should not be authorized to create a user @@ -40,7 +39,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): tenantId=tenant['id'], email=self.alt_email) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('d80d0c2f-4514-4d1e-806d-0930dfc5a187') def test_create_user_with_empty_name(self): # User with an empty name should not be created @@ -50,7 +49,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): tenantId=tenant['id'], email=self.alt_email) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('7704b4f3-3b75-4b82-87cc-931d41c8f780') def test_create_user_with_name_length_over_255(self): # Length of user name filed should be restricted to 255 characters @@ -60,7 +59,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): tenantId=tenant['id'], email=self.alt_email) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('57ae8558-120c-4723-9308-3751474e7ecf') def test_create_user_with_duplicate_name(self): # Duplicate user should not be created @@ -73,7 +72,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): tenantId=tenant['id'], email=user['email']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('0132cc22-7c4f-42e1-9e50-ac6aad31d59a') def test_create_user_for_non_existent_tenant(self): # Attempt to create a user in a non-existent tenant should fail @@ -83,7 +82,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): tenantId='49ffgg99999', email=self.alt_email) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('55bbb103-d1ae-437b-989b-bcdf8175c1f4') def test_create_user_request_without_a_token(self): # Request to create a user without a valid token should fail @@ -101,7 +100,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): tenantId=tenant['id'], email=self.alt_email) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('23a2f3da-4a1a-41da-abdd-632328a861ad') def test_create_user_with_enabled_non_bool(self): # Attempt to create a user with valid enabled para should fail @@ -112,7 +111,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): tenantId=tenant['id'], email=self.alt_email, enabled=3) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('3d07e294-27a0-4144-b780-a2a1bf6fee19') def test_update_user_for_non_existent_user(self): # Attempt to update a user non-existent user should fail @@ -121,7 +120,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): self.assertRaises(lib_exc.NotFound, self.users_client.update_user, non_existent_id, name=user_name) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('3cc2a64b-83aa-4b02-88f0-d6ab737c4466') def test_update_user_request_without_a_token(self): # Request to update a user without a valid token should fail @@ -137,7 +136,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): self.assertRaises(lib_exc.Unauthorized, self.users_client.update_user, self.alt_user) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('424868d5-18a7-43e1-8903-a64f95ee3aac') def test_update_user_by_unauthorized_user(self): # Non-administrator should not be authorized to update user @@ -145,7 +144,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): self.non_admin_users_client.update_user, self.alt_user) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('d45195d5-33ed-41b9-a452-7d0d6a00f6e9') def test_delete_users_by_unauthorized_user(self): # Non-administrator user should not be authorized to delete a user @@ -154,14 +153,14 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): self.non_admin_users_client.delete_user, user['id']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('7cc82f7e-9998-4f89-abae-23df36495867') def test_delete_non_existent_user(self): # Attempt to delete a non-existent user should fail self.assertRaises(lib_exc.NotFound, self.users_client.delete_user, 'junk12345123') - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('57fe1df8-0aa7-46c0-ae9f-c2e785c7504a') def test_delete_user_request_without_a_token(self): # Request to delete a user without a valid token should fail @@ -177,7 +176,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): self.assertRaises(lib_exc.Unauthorized, self.users_client.delete_user, self.alt_user) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('593a4981-f6d4-460a-99a1-57a78bf20829') def test_authentication_for_disabled_user(self): # Disabled user's token should not get authenticated @@ -190,7 +189,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): password, tenant['name']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('440a7a8d-9328-4b7b-83e0-d717010495e4') def test_authentication_when_tenant_is_disabled(self): # User's token for a disabled tenant should not be authenticated @@ -203,7 +202,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): password, tenant['name']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('921f1ad6-7907-40b8-853f-637e7ee52178') def test_authentication_with_invalid_tenant(self): # User's token for an invalid tenant should not be authenticated @@ -214,7 +213,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): password, 'junktenant1234') - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('bde9aecd-3b1c-4079-858f-beb5deaa5b5e') def test_authentication_with_invalid_username(self): # Non-existent user's token should not get authenticated @@ -224,7 +223,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): self.assertRaises(lib_exc.Unauthorized, self.token_client.auth, 'junkuser123', password, tenant['name']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('d5308b33-3574-43c3-8d87-1c090c5e1eca') def test_authentication_with_invalid_password(self): # User's token with invalid password should not be authenticated @@ -233,14 +232,14 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): self.assertRaises(lib_exc.Unauthorized, self.token_client.auth, user['name'], 'junkpass1234', tenant['name']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('284192ce-fb7c-4909-a63b-9a502e0ddd11') def test_get_users_by_unauthorized_user(self): # Non-administrator user should not be authorized to get user list self.assertRaises(lib_exc.Forbidden, self.non_admin_users_client.list_users) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('a73591ec-1903-4ffe-be42-282b39fefc9d') def test_get_users_request_without_token(self): # Request to get list of users without a valid token should fail @@ -252,7 +251,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest): self.assertRaises(lib_exc.Unauthorized, self.users_client.list_users) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('f5d39046-fc5f-425c-b29e-bac2632da28e') def test_list_users_with_invalid_tenant(self): # Should not be able to return a list of all diff --git a/tempest/api/identity/admin/v3/test_credentials.py b/tempest/api/identity/admin/v3/test_credentials.py index c75253208..75e877a4d 100644 --- a/tempest/api/identity/admin/v3/test_credentials.py +++ b/tempest/api/identity/admin/v3/test_credentials.py @@ -17,7 +17,6 @@ from oslo_serialization import jsonutils as json from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test class CredentialsTestJSON(base.BaseIdentityV3AdminTest): @@ -52,7 +51,7 @@ class CredentialsTestJSON(base.BaseIdentityV3AdminTest): def _delete_credential(self, cred_id): self.creds_client.delete_credential(cred_id) - @test.attr(type='smoke') + @decorators.attr(type='smoke') @decorators.idempotent_id('7cd59bf9-bda4-4c72-9467-d21cab278355') def test_credentials_create_get_update_delete(self): blob = '{"access": "%s", "secret": "%s"}' % ( diff --git a/tempest/api/identity/admin/v3/test_domains.py b/tempest/api/identity/admin/v3/test_domains.py index d04e77426..86a576408 100644 --- a/tempest/api/identity/admin/v3/test_domains.py +++ b/tempest/api/identity/admin/v3/test_domains.py @@ -18,7 +18,6 @@ from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils from tempest.lib import decorators -from tempest import test CONF = config.CONF @@ -87,7 +86,7 @@ class DomainsTestJSON(base.BaseIdentityV3AdminTest): for domain in fetched_domains: self.assertEqual(True, domain['enabled']) - @test.attr(type='smoke') + @decorators.attr(type='smoke') @decorators.idempotent_id('f2f5b44a-82e8-4dad-8084-0661ea3b18cf') def test_create_update_delete_domain(self): # Create domain @@ -168,7 +167,7 @@ class DefaultDomainTestJSON(base.BaseIdentityV3AdminTest): cls.domain_id = CONF.identity.default_domain_id super(DefaultDomainTestJSON, cls).resource_setup() - @test.attr(type='smoke') + @decorators.attr(type='smoke') @decorators.idempotent_id('17a5de24-e6a0-4e4a-a9ee-d85b6e5612b5') def test_default_domain_exists(self): domain = self.domains_client.show_domain(self.domain_id)['domain'] diff --git a/tempest/api/identity/admin/v3/test_domains_negative.py b/tempest/api/identity/admin/v3/test_domains_negative.py index 280a5a86d..61b4fa249 100644 --- a/tempest/api/identity/admin/v3/test_domains_negative.py +++ b/tempest/api/identity/admin/v3/test_domains_negative.py @@ -17,13 +17,12 @@ from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class DomainsNegativeTestJSON(base.BaseIdentityV3AdminTest): _interface = 'json' - @test.attr(type=['negative', 'gate']) + @decorators.attr(type=['negative', 'gate']) @decorators.idempotent_id('1f3fbff5-4e44-400d-9ca1-d953f05f609b') def test_delete_active_domain(self): d_name = data_utils.rand_name('domain') @@ -39,14 +38,14 @@ class DomainsNegativeTestJSON(base.BaseIdentityV3AdminTest): self.assertRaises(lib_exc.Forbidden, self.domains_client.delete_domain, domain_id) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('9018461d-7d24-408d-b3fe-ae37e8cd5c9e') def test_create_domain_with_empty_name(self): # Domain name should not be empty self.assertRaises(lib_exc.BadRequest, self.domains_client.create_domain, name='') - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('37b1bbf2-d664-4785-9a11-333438586eae') def test_create_domain_with_name_length_over_64(self): # Domain name length should not ne greater than 64 characters @@ -55,14 +54,14 @@ class DomainsNegativeTestJSON(base.BaseIdentityV3AdminTest): self.domains_client.create_domain, name=d_name) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('43781c07-764f-4cf2-a405-953c1916f605') def test_delete_non_existent_domain(self): # Attempt to delete a non existent domain should fail self.assertRaises(lib_exc.NotFound, self.domains_client.delete_domain, data_utils.rand_uuid_hex()) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('e6f9e4a2-4f36-4be8-bdbc-4e199ae29427') def test_domain_create_duplicate(self): domain_name = data_utils.rand_name('domain-dup') diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py index 0786d828e..09f92e2a7 100644 --- a/tempest/api/identity/admin/v3/test_endpoints.py +++ b/tempest/api/identity/admin/v3/test_endpoints.py @@ -16,7 +16,6 @@ from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test class EndPointsTestJSON(base.BaseIdentityV3AdminTest): @@ -109,7 +108,7 @@ class EndPointsTestJSON(base.BaseIdentityV3AdminTest): fetched_endpoints_id = [e['id'] for e in fetched_endpoints] self.assertNotIn(endpoint['id'], fetched_endpoints_id) - @test.attr(type='smoke') + @decorators.attr(type='smoke') @decorators.idempotent_id('37e8f15e-ee7c-4657-a1e7-f6b61e375eff') def test_update_endpoint(self): # Creating an endpoint so as to check update endpoint diff --git a/tempest/api/identity/admin/v3/test_endpoints_negative.py b/tempest/api/identity/admin/v3/test_endpoints_negative.py index d46e1f067..70dd7b523 100644 --- a/tempest/api/identity/admin/v3/test_endpoints_negative.py +++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py @@ -18,7 +18,6 @@ from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest): @@ -48,7 +47,7 @@ class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest): cls.services_client.delete_service(s) super(EndpointsNegativeTestJSON, cls).resource_cleanup() - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('ac6c137e-4d3d-448f-8c83-4f13d0942651') def test_create_with_enabled_False(self): # Enabled should be a boolean, not a string like 'False' @@ -59,7 +58,7 @@ class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest): service_id=self.service_id, interface=interface, url=url, region=region, enabled='False') - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('9c43181e-0627-484a-8c79-923e8a59598b') def test_create_with_enabled_True(self): # Enabled should be a boolean, not a string like 'True' @@ -86,13 +85,13 @@ class EndpointsNegativeTestJSON(base.BaseIdentityV3AdminTest): self.assertRaises(lib_exc.BadRequest, self.client.update_endpoint, endpoint_for_update['id'], enabled=enabled) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('65e41f32-5eb7-498f-a92a-a6ccacf7439a') def test_update_with_enabled_False(self): # Enabled should be a boolean, not a string like 'False' self._assert_update_raises_bad_request('False') - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('faba3587-f066-4757-a48e-b4a3f01803bb') def test_update_with_enabled_True(self): # Enabled should be a boolean, not a string like 'True' diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py index a423a128b..fefcb315e 100644 --- a/tempest/api/identity/admin/v3/test_groups.py +++ b/tempest/api/identity/admin/v3/test_groups.py @@ -16,7 +16,6 @@ from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test class GroupsV3TestJSON(base.BaseIdentityV3AdminTest): @@ -72,7 +71,7 @@ class GroupsV3TestJSON(base.BaseIdentityV3AdminTest): # Verify that 'description' is not being updated or deleted. self.assertEqual(old_description, updated_group['description']) - @test.attr(type='smoke') + @decorators.attr(type='smoke') @decorators.idempotent_id('1598521a-2f36-4606-8df9-30772bd51339') def test_group_users_add_list_delete(self): name = data_utils.rand_name('Group') diff --git a/tempest/api/identity/admin/v3/test_policies.py b/tempest/api/identity/admin/v3/test_policies.py index f74cb1c5a..730d4698c 100644 --- a/tempest/api/identity/admin/v3/test_policies.py +++ b/tempest/api/identity/admin/v3/test_policies.py @@ -16,7 +16,6 @@ from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib import decorators -from tempest import test class PoliciesTestJSON(base.BaseIdentityV3AdminTest): @@ -44,7 +43,7 @@ class PoliciesTestJSON(base.BaseIdentityV3AdminTest): missing_pols = [p for p in policy_ids if p not in fetched_ids] self.assertEqual(0, len(missing_pols)) - @test.attr(type='smoke') + @decorators.attr(type='smoke') @decorators.idempotent_id('e544703a-2f03-4cf2-9b0f-350782fdb0d3') def test_create_update_delete_policy(self): # Test to update policy diff --git a/tempest/api/identity/admin/v3/test_projects_negative.py b/tempest/api/identity/admin/v3/test_projects_negative.py index 31e73029c..6277fdabc 100644 --- a/tempest/api/identity/admin/v3/test_projects_negative.py +++ b/tempest/api/identity/admin/v3/test_projects_negative.py @@ -17,19 +17,18 @@ from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class ProjectsNegativeTestJSON(base.BaseIdentityV3AdminTest): - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('24c49279-45dd-4155-887a-cb738c2385aa') def test_list_projects_by_unauthorized_user(self): # Non-admin user should not be able to list projects self.assertRaises(lib_exc.Forbidden, self.non_admin_projects_client.list_projects) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('874c3e84-d174-4348-a16b-8c01f599561b') def test_project_create_duplicate(self): # Project names should be unique @@ -40,7 +39,7 @@ class ProjectsNegativeTestJSON(base.BaseIdentityV3AdminTest): self.assertRaises(lib_exc.Conflict, self.projects_client.create_project, project_name) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('8fba9de2-3e1f-4e77-812a-60cb68f8df13') def test_create_project_by_unauthorized_user(self): # Non-admin user should not be authorized to create a project @@ -49,14 +48,14 @@ class ProjectsNegativeTestJSON(base.BaseIdentityV3AdminTest): lib_exc.Forbidden, self.non_admin_projects_client.create_project, project_name) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('7828db17-95e5-475b-9432-9a51b4aa79a9') def test_create_project_with_empty_name(self): # Project name should not be empty self.assertRaises(lib_exc.BadRequest, self.projects_client.create_project, name='') - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('502b6ceb-b0c8-4422-bf53-f08fdb21e2f0') def test_create_projects_name_length_over_64(self): # Project name length should not be greater than 64 characters @@ -64,7 +63,7 @@ class ProjectsNegativeTestJSON(base.BaseIdentityV3AdminTest): self.assertRaises(lib_exc.BadRequest, self.projects_client.create_project, project_name) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('8d68c012-89e0-4394-8d6b-ccd7196def97') def test_project_delete_by_unauthorized_user(self): # Non-admin user should not be able to delete a project @@ -75,7 +74,7 @@ class ProjectsNegativeTestJSON(base.BaseIdentityV3AdminTest): lib_exc.Forbidden, self.non_admin_projects_client.delete_project, project['id']) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('7965b581-60c1-43b7-8169-95d4ab7fc6fb') def test_delete_non_existent_project(self): # Attempt to delete a non existent project should fail diff --git a/tempest/api/identity/admin/v3/test_regions.py b/tempest/api/identity/admin/v3/test_regions.py index 56ee496c0..ac550a73a 100644 --- a/tempest/api/identity/admin/v3/test_regions.py +++ b/tempest/api/identity/admin/v3/test_regions.py @@ -17,7 +17,6 @@ from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils from tempest.lib import decorators -from tempest import test class RegionsTestJSON(base.BaseIdentityV3AdminTest): @@ -79,7 +78,7 @@ class RegionsTestJSON(base.BaseIdentityV3AdminTest): regions_list = [r['id'] for r in body] self.assertNotIn(region['id'], regions_list) - @test.attr(type='smoke') + @decorators.attr(type='smoke') @decorators.idempotent_id('2c12c5b5-efcf-4aa5-90c5-bff1ab0cdbe2') def test_create_region_with_specific_id(self): # Create a region with a specific id diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py index 04be00b8d..ac56fc622 100644 --- a/tempest/api/identity/admin/v3/test_roles.py +++ b/tempest/api/identity/admin/v3/test_roles.py @@ -19,7 +19,6 @@ from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -74,7 +73,7 @@ class RolesV3TestJSON(base.BaseIdentityV3AdminTest): self.assertEqual(len(body), 1) self.assertIn(role_id, fetched_role_ids) - @test.attr(type='smoke') + @decorators.attr(type='smoke') @decorators.idempotent_id('18afc6c0-46cf-4911-824e-9989cc056c3a') def test_role_create_update_show_list(self): r_name = data_utils.rand_name('Role') diff --git a/tempest/api/identity/admin/v3/test_services.py b/tempest/api/identity/admin/v3/test_services.py index 53e005da2..ad4e549a5 100644 --- a/tempest/api/identity/admin/v3/test_services.py +++ b/tempest/api/identity/admin/v3/test_services.py @@ -17,7 +17,6 @@ from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class ServicesTestJSON(base.BaseIdentityV3AdminTest): @@ -29,7 +28,7 @@ class ServicesTestJSON(base.BaseIdentityV3AdminTest): self.assertRaises(lib_exc.NotFound, self.services_client.show_service, service_id) - @test.attr(type='smoke') + @decorators.attr(type='smoke') @decorators.idempotent_id('5193aad5-bcb7-411d-85b0-b3b61b96ef06') def test_create_update_get_service(self): # Creating a Service diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py index ec64e0c57..339b4bb01 100644 --- a/tempest/api/identity/admin/v3/test_trusts.py +++ b/tempest/api/identity/admin/v3/test_trusts.py @@ -22,7 +22,6 @@ from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test CONF = config.CONF @@ -265,7 +264,7 @@ class TrustsV3TestJSON(BaseTrustsV3Test): self.assertEqual(1, len(trusts_get)) self.validate_trust(trusts_get[0], summary=True) - @test.attr(type='smoke') + @decorators.attr(type='smoke') @decorators.idempotent_id('4773ebd5-ecbf-4255-b8d8-b63e6f72b65d') def test_get_trusts_all(self): diff --git a/tempest/api/identity/admin/v3/test_users_negative.py b/tempest/api/identity/admin/v3/test_users_negative.py index 93241c5ca..09d1b9b32 100644 --- a/tempest/api/identity/admin/v3/test_users_negative.py +++ b/tempest/api/identity/admin/v3/test_users_negative.py @@ -17,12 +17,11 @@ from tempest.api.identity import base from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc -from tempest import test class UsersNegativeTest(base.BaseIdentityV3AdminTest): - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('e75f006c-89cc-477b-874d-588e4eab4b17') def test_create_user_for_non_existent_domain(self): # Attempt to create a user in a non-existent domain should fail @@ -34,7 +33,7 @@ class UsersNegativeTest(base.BaseIdentityV3AdminTest): email=u_email, domain_id=data_utils.rand_uuid_hex()) - @test.attr(type=['negative']) + @decorators.attr(type=['negative']) @decorators.idempotent_id('b3c9fccc-4134-46f5-b600-1da6fb0a3b1f') def test_authentication_for_disabled_user(self): # Attempt to authenticate for disabled user should fail -- cgit v1.2.1