From fb20c5fca92840f19544333b1d794fcf4fb8d987 Mon Sep 17 00:00:00 2001 From: Lance Bragstad Date: Fri, 9 Oct 2015 14:23:05 +0000 Subject: [PATCH] Refactor: change 404 status codes in test names Change I952cac73a9713bde4ad757371ca8b4ded93f207e refactored the keystone test cases to use the six.moves.http_client for HTTP status codes instead of integers. This change refactors the method names to follow the same pattern. Change-Id: I5b48598afa55a7c15ca21e79f9c572001e17b069 --- keystone/tests/unit/backend/role/core.py | 4 +- keystone/tests/unit/test_backend.py | 66 +++++++++---------- keystone/tests/unit/test_backend_kvs.py | 2 +- keystone/tests/unit/test_backend_ldap.py | 4 +- keystone/tests/unit/test_backend_rules.py | 15 +++-- keystone/tests/unit/test_backend_sql.py | 2 +- keystone/tests/unit/test_backend_templated.py | 10 +-- keystone/tests/unit/test_v2.py | 6 +- keystone/tests/unit/test_v2_keystoneclient.py | 42 ++++++------ keystone/tests/unit/test_v3_assignment.py | 13 ++-- keystone/tests/unit/test_v3_auth.py | 12 ++-- keystone/tests/unit/test_v3_catalog.py | 2 +- keystone/tests/unit/test_v3_federation.py | 21 +++--- .../tests/unit/token/test_fernet_provider.py | 4 +- 14 files changed, 104 insertions(+), 99 deletions(-) diff --git a/keystone/tests/unit/backend/role/core.py b/keystone/tests/unit/backend/role/core.py index 603216e3d9..d9b9a1bcd4 100644 --- a/keystone/tests/unit/backend/role/core.py +++ b/keystone/tests/unit/backend/role/core.py @@ -22,7 +22,7 @@ from keystone.tests.unit import default_fixtures class RoleTests(object): - def test_get_role_404(self): + def test_get_role_returns_not_found(self): self.assertRaises(exception.RoleNotFound, self.role_api.get_role, uuid.uuid4().hex) @@ -73,7 +73,7 @@ class RoleTests(object): self.role_api.get_role, role['id']) - def test_update_role_404(self): + def test_update_role_returns_not_found(self): role = {'id': uuid.uuid4().hex, 'name': uuid.uuid4().hex} self.assertRaises(exception.RoleNotFound, self.role_api.update_role, diff --git a/keystone/tests/unit/test_backend.py b/keystone/tests/unit/test_backend.py index 7f51f5d61a..5d5c9031f3 100644 --- a/keystone/tests/unit/test_backend.py +++ b/keystone/tests/unit/test_backend.py @@ -531,7 +531,7 @@ class IdentityTests(AssignmentTestHelperMixin): tenant_ref = self.resource_api.get_project(self.tenant_bar['id']) self.assertDictEqual(self.tenant_bar, tenant_ref) - def test_get_project_404(self): + def test_get_project_returns_not_found(self): self.assertRaises(exception.ProjectNotFound, self.resource_api.get_project, uuid.uuid4().hex) @@ -542,7 +542,7 @@ class IdentityTests(AssignmentTestHelperMixin): DEFAULT_DOMAIN_ID) self.assertDictEqual(self.tenant_bar, tenant_ref) - def test_get_project_by_name_404(self): + def test_get_project_by_name_returns_not_found(self): self.assertRaises(exception.ProjectNotFound, self.resource_api.get_project_by_name, uuid.uuid4().hex, @@ -586,7 +586,7 @@ class IdentityTests(AssignmentTestHelperMixin): # Ensure the user is only returned once self.assertEqual(1, len(user_ids)) - def test_get_project_user_ids_404(self): + def test_get_project_user_ids_returns_not_found(self): self.assertRaises(exception.ProjectNotFound, self.assignment_api.list_user_ids_for_project, uuid.uuid4().hex) @@ -637,7 +637,7 @@ class IdentityTests(AssignmentTestHelperMixin): self.identity_api.get_user_by_name(ref['name'], ref['domain_id']), user_updated) - def test_get_user_404(self): + def test_get_user_returns_not_found(self): self.assertRaises(exception.UserNotFound, self.identity_api.get_user, uuid.uuid4().hex) @@ -687,7 +687,7 @@ class IdentityTests(AssignmentTestHelperMixin): self.identity_api.get_user_by_name(ref['name'], ref['domain_id']), user_updated) - def test_get_user_by_name_404(self): + def test_get_user_by_name_returns_not_found(self): self.assertRaises(exception.UserNotFound, self.identity_api.get_user_by_name, uuid.uuid4().hex, @@ -1096,7 +1096,7 @@ class IdentityTests(AssignmentTestHelperMixin): domain_id=new_domain['id']) self.assertEqual(0, len(roles_ref)) - def test_get_roles_for_user_and_domain_404(self): + def test_get_roles_for_user_and_domain_returns_not_found(self): """Test errors raised when getting roles for user on a domain. Test Plan: @@ -1120,7 +1120,7 @@ class IdentityTests(AssignmentTestHelperMixin): new_user1['id'], uuid.uuid4().hex) - def test_get_roles_for_user_and_project_404(self): + def test_get_roles_for_user_and_project_returns_not_found(self): self.assertRaises(exception.UserNotFound, self.assignment_api.get_roles_for_user_and_project, uuid.uuid4().hex, @@ -1131,7 +1131,7 @@ class IdentityTests(AssignmentTestHelperMixin): self.user_foo['id'], uuid.uuid4().hex) - def test_add_role_to_user_and_project_404(self): + def test_add_role_to_user_and_project_returns_not_found(self): self.assertRaises(exception.ProjectNotFound, self.assignment_api.add_role_to_user_and_project, self.user_foo['id'], @@ -2088,7 +2088,7 @@ class IdentityTests(AssignmentTestHelperMixin): default_role = self.role_api.get_role(CONF.member_role_id) self.assertIsNotNone(default_role) - def test_add_user_to_project_404(self): + def test_add_user_to_project_returns_not_found(self): self.assertRaises(exception.ProjectNotFound, self.assignment_api.add_user_to_project, uuid.uuid4().hex, @@ -2132,7 +2132,7 @@ class IdentityTests(AssignmentTestHelperMixin): self.user_foo['id']) self.assertNotIn(self.tenant_baz, tenants) - def test_remove_user_from_project_404(self): + def test_remove_user_from_project_returns_not_found(self): self.assertRaises(exception.ProjectNotFound, self.assignment_api.remove_user_from_project, uuid.uuid4().hex, @@ -2148,23 +2148,23 @@ class IdentityTests(AssignmentTestHelperMixin): self.tenant_baz['id'], self.user_foo['id']) - def test_list_user_project_ids_404(self): + def test_list_user_project_ids_returns_not_found(self): self.assertRaises(exception.UserNotFound, self.assignment_api.list_projects_for_user, uuid.uuid4().hex) - def test_update_project_404(self): + def test_update_project_returns_not_found(self): self.assertRaises(exception.ProjectNotFound, self.resource_api.update_project, uuid.uuid4().hex, dict()) - def test_delete_project_404(self): + def test_delete_project_returns_not_found(self): self.assertRaises(exception.ProjectNotFound, self.resource_api.delete_project, uuid.uuid4().hex) - def test_update_user_404(self): + def test_update_user_returns_not_found(self): user_id = uuid.uuid4().hex self.assertRaises(exception.UserNotFound, self.identity_api.update_user, @@ -2198,12 +2198,12 @@ class IdentityTests(AssignmentTestHelperMixin): self.assignment_api.list_projects_for_user, user['id']) - def test_delete_user_404(self): + def test_delete_user_returns_not_found(self): self.assertRaises(exception.UserNotFound, self.identity_api.delete_user, uuid.uuid4().hex) - def test_delete_role_404(self): + def test_delete_role_returns_not_found(self): self.assertRaises(exception.RoleNotFound, self.role_api.delete_role, uuid.uuid4().hex) @@ -3049,7 +3049,7 @@ class IdentityTests(AssignmentTestHelperMixin): found = True self.assertTrue(found) - def test_add_user_to_group_404(self): + def test_add_user_to_group_returns_not_found(self): domain = self._get_domain_fixture() new_user = {'name': 'new_user', 'password': uuid.uuid4().hex, 'enabled': True, 'domain_id': domain['id']} @@ -3108,7 +3108,7 @@ class IdentityTests(AssignmentTestHelperMixin): new_user['id'], new_group['id']) - def test_check_user_in_group_404(self): + def test_check_user_in_group_returns_not_found(self): new_user = {'name': 'new_user', 'password': uuid.uuid4().hex, 'enabled': True, 'domain_id': DEFAULT_DOMAIN_ID} new_user = self.identity_api.create_user(new_user) @@ -3155,7 +3155,7 @@ class IdentityTests(AssignmentTestHelperMixin): self.assertNotIn('password', x) self.assertTrue(found) - def test_list_users_in_group_404(self): + def test_list_users_in_group_returns_not_found(self): self.assertRaises(exception.GroupNotFound, self.identity_api.list_users_in_group, uuid.uuid4().hex) @@ -3241,7 +3241,7 @@ class IdentityTests(AssignmentTestHelperMixin): groups = self.identity_api.list_groups_for_user(new_user['id']) self.assertNotIn(new_group['id'], [x['id'] for x in groups]) - def test_remove_user_from_group_404(self): + def test_remove_user_from_group_returns_not_found(self): domain = self._get_domain_fixture() new_user = {'name': 'new_user', 'password': uuid.uuid4().hex, 'enabled': True, 'domain_id': domain['id']} @@ -3292,7 +3292,7 @@ class IdentityTests(AssignmentTestHelperMixin): group_name, DEFAULT_DOMAIN_ID) self.assertDictEqual(group, group_ref) - def test_get_group_by_name_404(self): + def test_get_group_by_name_returns_not_found(self): self.assertRaises(exception.GroupNotFound, self.identity_api.get_group_by_name, uuid.uuid4().hex, @@ -4613,7 +4613,7 @@ class TokenTests(object): self.assertEqual(1, len(tokens)) self.assertIn(token_id5, tokens) - def test_get_token_404(self): + def test_get_token_returns_not_found(self): self.assertRaises(exception.TokenNotFound, self.token_provider_api._persistence.get_token, uuid.uuid4().hex) @@ -4621,7 +4621,7 @@ class TokenTests(object): self.token_provider_api._persistence.get_token, None) - def test_delete_token_404(self): + def test_delete_token_returns_not_found(self): self.assertRaises(exception.TokenNotFound, self.token_provider_api._persistence.delete_token, uuid.uuid4().hex) @@ -5214,17 +5214,17 @@ class CatalogTests(object): self.catalog_api.create_region, new_region) - def test_get_region_404(self): + def test_get_region_returns_not_found(self): self.assertRaises(exception.RegionNotFound, self.catalog_api.get_region, uuid.uuid4().hex) - def test_delete_region_404(self): + def test_delete_region_returns_not_found(self): self.assertRaises(exception.RegionNotFound, self.catalog_api.delete_region, uuid.uuid4().hex) - def test_create_region_invalid_parent_region_404(self): + def test_create_region_invalid_parent_region_returns_not_found(self): region_id = uuid.uuid4().hex new_region = { 'id': region_id, @@ -5540,12 +5540,12 @@ class CatalogTests(object): self.catalog_api.delete_endpoint, second_endpoint['id']) - def test_get_service_404(self): + def test_get_service_returns_not_found(self): self.assertRaises(exception.ServiceNotFound, self.catalog_api.get_service, uuid.uuid4().hex) - def test_delete_service_404(self): + def test_delete_service_returns_not_found(self): self.assertRaises(exception.ServiceNotFound, self.catalog_api.delete_service, uuid.uuid4().hex) @@ -5603,12 +5603,12 @@ class CatalogTests(object): enabled_endpoint['id'], new_endpoint) - def test_get_endpoint_404(self): + def test_get_endpoint_returns_not_found(self): self.assertRaises(exception.EndpointNotFound, self.catalog_api.get_endpoint, uuid.uuid4().hex) - def test_delete_endpoint_404(self): + def test_delete_endpoint_returns_not_found(self): self.assertRaises(exception.EndpointNotFound, self.catalog_api.delete_endpoint, uuid.uuid4().hex) @@ -5834,19 +5834,19 @@ class PolicyTests(object): res = self.policy_api.list_policies() self.assertFalse(len([x for x in res if x['id'] == ref['id']])) - def test_get_policy_404(self): + def test_get_policy_returns_not_found(self): self.assertRaises(exception.PolicyNotFound, self.policy_api.get_policy, uuid.uuid4().hex) - def test_update_policy_404(self): + def test_update_policy_returns_not_found(self): ref = self._new_policy_ref() self.assertRaises(exception.PolicyNotFound, self.policy_api.update_policy, ref['id'], ref) - def test_delete_policy_404(self): + def test_delete_policy_returns_not_found(self): self.assertRaises(exception.PolicyNotFound, self.policy_api.delete_policy, uuid.uuid4().hex) diff --git a/keystone/tests/unit/test_backend_kvs.py b/keystone/tests/unit/test_backend_kvs.py index 84a47839b6..1fbbcd48b4 100644 --- a/keystone/tests/unit/test_backend_kvs.py +++ b/keystone/tests/unit/test_backend_kvs.py @@ -118,7 +118,7 @@ class KvsCatalog(unit.TestCase, test_backend.CatalogTests): 'foo', 'bar', {'RegionFoo': {'service_bar': {'foo': 'bar'}}}) - def test_get_catalog_404(self): + def test_get_catalog_returns_not_found(self): # FIXME(dolph): this test should be moved up to test_backend # FIXME(dolph): exceptions should be UserNotFound and ProjectNotFound self.assertRaises(exception.NotFound, diff --git a/keystone/tests/unit/test_backend_ldap.py b/keystone/tests/unit/test_backend_ldap.py index 552d32453f..5e43a012ba 100644 --- a/keystone/tests/unit/test_backend_ldap.py +++ b/keystone/tests/unit/test_backend_ldap.py @@ -3171,10 +3171,10 @@ class DomainSpecificLDAPandSQLIdentity( domain_scope=self.domains['domain1']['id']), matchers.HasLength(1)) - def test_add_role_grant_to_user_and_project_404(self): + def test_add_role_grant_to_user_and_project_returns_not_found(self): self.skipTest('Blocked by bug 1101287') - def test_get_role_grants_for_user_and_project_404(self): + def test_get_role_grants_for_user_and_project_returns_not_found(self): self.skipTest('Blocked by bug 1101287') def test_list_projects_for_user_with_grants(self): diff --git a/keystone/tests/unit/test_backend_rules.py b/keystone/tests/unit/test_backend_rules.py index 9a11fddc51..945ffca496 100644 --- a/keystone/tests/unit/test_backend_rules.py +++ b/keystone/tests/unit/test_backend_rules.py @@ -47,14 +47,17 @@ class RulesPolicy(unit.TestCase, test_backend.PolicyTests): self.assertRaises(exception.NotImplemented, super(RulesPolicy, self).test_delete) - def test_get_policy_404(self): + def test_get_policy_returns_not_found(self): self.assertRaises(exception.NotImplemented, - super(RulesPolicy, self).test_get_policy_404) + super(RulesPolicy, + self).test_get_policy_returns_not_found) - def test_update_policy_404(self): + def test_update_policy_returns_not_found(self): self.assertRaises(exception.NotImplemented, - super(RulesPolicy, self).test_update_policy_404) + super(RulesPolicy, + self).test_update_policy_returns_not_found) - def test_delete_policy_404(self): + def test_delete_policy_returns_not_found(self): self.assertRaises(exception.NotImplemented, - super(RulesPolicy, self).test_delete_policy_404) + super(RulesPolicy, + self).test_delete_policy_returns_not_found) diff --git a/keystone/tests/unit/test_backend_sql.py b/keystone/tests/unit/test_backend_sql.py index f7b2eb7bbf..1b2858fcbe 100644 --- a/keystone/tests/unit/test_backend_sql.py +++ b/keystone/tests/unit/test_backend_sql.py @@ -633,7 +633,7 @@ class SqlCatalog(SqlTests, test_backend.CatalogTests): self.assertIsNone(catalog_endpoint.get('adminURL')) self.assertIsNone(catalog_endpoint.get('internalURL')) - def test_create_endpoint_region_404(self): + def test_create_endpoint_region_returns_not_found(self): service = { 'id': uuid.uuid4().hex, 'type': uuid.uuid4().hex, diff --git a/keystone/tests/unit/test_backend_templated.py b/keystone/tests/unit/test_backend_templated.py index db18a26bc1..393ef40f6f 100644 --- a/keystone/tests/unit/test_backend_templated.py +++ b/keystone/tests/unit/test_backend_templated.py @@ -172,10 +172,10 @@ class TestTemplatedCatalog(unit.TestCase, test_backend.CatalogTests): def test_create_region_with_duplicate_id(self): self.skipTest(BROKEN_WRITE_FUNCTIONALITY_MSG) - def test_delete_region_404(self): + def test_delete_region_returns_not_found(self): self.skipTest(BROKEN_WRITE_FUNCTIONALITY_MSG) - def test_create_region_invalid_parent_region_404(self): + def test_create_region_invalid_parent_region_returns_not_found(self): self.skipTest(BROKEN_WRITE_FUNCTIONALITY_MSG) def test_avoid_creating_circular_references_in_regions_update(self): @@ -203,7 +203,7 @@ class TestTemplatedCatalog(unit.TestCase, test_backend.CatalogTests): def test_cache_layer_delete_service_with_endpoint(self): self.skipTest(BROKEN_WRITE_FUNCTIONALITY_MSG) - def test_delete_service_404(self): + def test_delete_service_returns_not_found(self): self.skipTest(BROKEN_WRITE_FUNCTIONALITY_MSG) def test_update_endpoint_nonexistent_service(self): @@ -215,10 +215,10 @@ class TestTemplatedCatalog(unit.TestCase, test_backend.CatalogTests): def test_update_endpoint_nonexistent_region(self): self.skipTest(BROKEN_WRITE_FUNCTIONALITY_MSG) - def test_get_endpoint_404(self): + def test_get_endpoint_returns_not_found(self): self.skipTest("Templated backend doesn't use IDs for endpoints.") - def test_delete_endpoint_404(self): + def test_delete_endpoint_returns_not_found(self): self.skipTest(BROKEN_WRITE_FUNCTIONALITY_MSG) def test_create_endpoint(self): diff --git a/keystone/tests/unit/test_v2.py b/keystone/tests/unit/test_v2.py index 99b5a8973f..f88978c0b1 100644 --- a/keystone/tests/unit/test_v2.py +++ b/keystone/tests/unit/test_v2.py @@ -106,11 +106,11 @@ class CoreApiTests(object): self.assertValidExtensionListResponse( r, keystone_extension.ADMIN_EXTENSIONS) - def test_admin_extensions_404(self): + def test_admin_extensions_returns_not_found(self): self.admin_request(path='/v2.0/extensions/invalid-extension', expected_status=http_client.NOT_FOUND) - def test_public_osksadm_extension_404(self): + def test_public_osksadm_extension_returns_not_found(self): self.public_request(path='/v2.0/extensions/OS-KSADM', expected_status=http_client.NOT_FOUND) @@ -164,7 +164,7 @@ class CoreApiTests(object): token=token) self.assertValidAuthenticationResponse(r) - def test_invalid_token_404(self): + def test_invalid_token_returns_not_found(self): token = self.get_scoped_token() self.admin_request( path='/v2.0/tokens/%(token_id)s' % { diff --git a/keystone/tests/unit/test_v2_keystoneclient.py b/keystone/tests/unit/test_v2_keystoneclient.py index 8d6d9eb7f8..50b7b8c9ca 100644 --- a/keystone/tests/unit/test_v2_keystoneclient.py +++ b/keystone/tests/unit/test_v2_keystoneclient.py @@ -358,19 +358,19 @@ class ClientDrivenTestCase(unit.TestCase): client.tenants.create, tenant_name="") - def test_tenant_delete_404(self): + def test_tenant_delete_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.tenants.delete, tenant=uuid.uuid4().hex) - def test_tenant_get_404(self): + def test_tenant_get_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.tenants.get, tenant_id=uuid.uuid4().hex) - def test_tenant_update_404(self): + def test_tenant_update_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.tenants.update, @@ -630,7 +630,7 @@ class ClientDrivenTestCase(unit.TestCase): password=uuid.uuid4().hex, email=uuid.uuid4().hex) - def test_user_create_404(self): + def test_user_create_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.users.create, @@ -639,19 +639,19 @@ class ClientDrivenTestCase(unit.TestCase): email=uuid.uuid4().hex, tenant_id=uuid.uuid4().hex) - def test_user_get_404(self): + def test_user_get_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.users.get, user=uuid.uuid4().hex) - def test_user_list_404(self): + def test_user_list_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.users.list, tenant_id=uuid.uuid4().hex) - def test_user_update_404(self): + def test_user_update_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.users.update, @@ -664,14 +664,14 @@ class ClientDrivenTestCase(unit.TestCase): tenant_id=tenant_id) self.assertEqual(tenant_id, user.tenant_id) - def test_user_update_password_404(self): + def test_user_update_password_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.users.update_password, user=uuid.uuid4().hex, password=uuid.uuid4().hex) - def test_user_delete_404(self): + def test_user_delete_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.users.delete, @@ -732,19 +732,19 @@ class ClientDrivenTestCase(unit.TestCase): # the ID should be set as defined in CONF self.assertEqual(CONF.member_role_id, role.id) - def test_role_get_404(self): + def test_role_get_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.roles.get, role=uuid.uuid4().hex) - def test_role_delete_404(self): + def test_role_delete_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.roles.delete, role=uuid.uuid4().hex) - def test_role_list_404(self): + def test_role_list_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.roles.roles_for_user, @@ -800,19 +800,19 @@ class ClientDrivenTestCase(unit.TestCase): services = [x for x in client.services.list() if x.id == service.id] self.assertEqual(0, len(services)) - def test_service_delete_404(self): + def test_service_delete_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.services.delete, id=uuid.uuid4().hex) - def test_service_get_404(self): + def test_service_get_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.services.get, id=uuid.uuid4().hex) - def test_endpoint_delete_404(self): + def test_endpoint_delete_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.endpoints.delete, @@ -886,7 +886,7 @@ class ClientDrivenTestCase(unit.TestCase): user_refs = client.tenants.list_users(tenant=self.tenant_bar['id']) self.assertNotIn(self.user_two['id'], [x.id for x in user_refs]) - def test_user_role_add_404(self): + def test_user_role_add_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.roles.add_user_role, @@ -906,7 +906,7 @@ class ClientDrivenTestCase(unit.TestCase): user=uuid.uuid4().hex, role=self.role_member['id']) - def test_user_role_remove_404(self): + def test_user_role_remove_returns_not_found(self): client = self.get_client(admin=True) self.assertRaises(client_exceptions.NotFound, client.roles.remove_user_role, @@ -1239,7 +1239,7 @@ class ClientDrivenTestCase(unit.TestCase): sorted(creds, key=lambda x: x.access)) self.assertNotIn(cred_4, creds) - def test_ec2_credentials_create_404(self): + def test_ec2_credentials_create_returns_not_found(self): self.assertRaises(client_exceptions.NotFound, self.default_client.ec2.create, user_id=uuid.uuid4().hex, @@ -1249,19 +1249,19 @@ class ClientDrivenTestCase(unit.TestCase): user_id=self.user_foo['id'], tenant_id=uuid.uuid4().hex) - def test_ec2_credentials_delete_404(self): + def test_ec2_credentials_delete_returns_not_found(self): self.assertRaises(client_exceptions.NotFound, self.default_client.ec2.delete, user_id=uuid.uuid4().hex, access=uuid.uuid4().hex) - def test_ec2_credentials_get_404(self): + def test_ec2_credentials_get_returns_not_found(self): self.assertRaises(client_exceptions.NotFound, self.default_client.ec2.get, user_id=uuid.uuid4().hex, access=uuid.uuid4().hex) - def test_ec2_credentials_list_404(self): + def test_ec2_credentials_list_returns_not_found(self): self.assertRaises(client_exceptions.NotFound, self.default_client.ec2.list, user_id=uuid.uuid4().hex) diff --git a/keystone/tests/unit/test_v3_assignment.py b/keystone/tests/unit/test_v3_assignment.py index e1e4fc6415..71b6b89f23 100644 --- a/keystone/tests/unit/test_v3_assignment.py +++ b/keystone/tests/unit/test_v3_assignment.py @@ -1139,7 +1139,7 @@ class AssignmentTestCase(test_v3.RestfulTestCase, # self.assertIn(collection_url, r.result['links']['self']) def test_crud_user_project_role_grants_no_user(self): - """Grant role on a project to a user that doesn't exist, 404 result. + """Grant role on a project to a user that doesn't exist. When grant a role on a project to a user that doesn't exist, the server returns Not Found for the user. @@ -1178,7 +1178,7 @@ class AssignmentTestCase(test_v3.RestfulTestCase, resource_url=collection_url) def test_crud_user_domain_role_grants_no_user(self): - """Grant role on a domain to a user that doesn't exist, 404 result. + """Grant role on a domain to a user that doesn't exist. When grant a role on a domain to a user that doesn't exist, the server returns 404 Not Found for the user. @@ -1217,7 +1217,7 @@ class AssignmentTestCase(test_v3.RestfulTestCase, resource_url=collection_url) def test_crud_group_project_role_grants_no_group(self): - """Grant role on a project to a group that doesn't exist, 404 result. + """Grant role on a project to a group that doesn't exist. When grant a role on a project to a group that doesn't exist, the server returns 404 Not Found for the group. @@ -1257,7 +1257,7 @@ class AssignmentTestCase(test_v3.RestfulTestCase, resource_url=collection_url) def test_crud_group_domain_role_grants_no_group(self): - """Grant role on a domain to a group that doesn't exist, 404 result. + """Grant role on a domain to a group that doesn't exist. When grant a role on a domain to a group that doesn't exist, the server returns 404 Not Found for the group. @@ -1309,8 +1309,9 @@ class AssignmentTestCase(test_v3.RestfulTestCase, member_url, user = self._create_new_user_and_assign_role_on_project() # Delete the user from identity backend self.identity_api.delete_user(user['id']) - # We should get a 404 when looking for the user in the identity - # backend because we're not performing a delete operation on the role. + # We should get a 404 Not Found when looking for the user in the + # identity backend because we're not performing a delete operation on + # the role. self.head(member_url, expected_status=http_client.NOT_FOUND) def test_token_revoked_once_group_role_grant_revoked(self): diff --git a/keystone/tests/unit/test_v3_auth.py b/keystone/tests/unit/test_v3_auth.py index cdc3a76646..0adba23aff 100644 --- a/keystone/tests/unit/test_v3_auth.py +++ b/keystone/tests/unit/test_v3_auth.py @@ -1342,7 +1342,7 @@ class TestTokenRevokeById(test_v3.RestfulTestCase): self.delete( '/projects/%(project_id)s' % {'project_id': self.projectA['id']}) - # Make sure that we get a NotFound(404) when heading that role. + # Make sure that we get a 404 Not Found when heading that role. self.head(role_path, expected_status=http_client.NOT_FOUND) def get_v2_token(self, token=None, project_id=None): @@ -2730,7 +2730,7 @@ class TestTrustOptional(test_v3.RestfulTestCase): super(TestTrustOptional, self).config_overrides() self.config_fixture.config(group='trust', enabled=False) - def test_trusts_404(self): + def test_trusts_returns_not_found(self): self.get('/OS-TRUST/trusts', body={'trust': {}}, expected_status=http_client.NOT_FOUND) self.post('/OS-TRUST/trusts', body={'trust': {}}, @@ -3371,7 +3371,7 @@ class TestTrustAuth(test_v3.RestfulTestCase): '/OS-TRUST/trusts/%(trust_id)s' % {'trust_id': trust['id']}, expected_status=http_client.NOT_FOUND) - def test_create_trust_trustee_404(self): + def test_create_trust_trustee_returns_not_found(self): ref = self.new_trust_ref( trustor_user_id=self.user_id, trustee_user_id=uuid.uuid4().hex, @@ -3389,7 +3389,7 @@ class TestTrustAuth(test_v3.RestfulTestCase): self.post('/OS-TRUST/trusts', body={'trust': ref}, expected_status=http_client.FORBIDDEN) - def test_create_trust_project_404(self): + def test_create_trust_project_returns_not_found(self): ref = self.new_trust_ref( trustor_user_id=self.user_id, trustee_user_id=self.trustee_user_id, @@ -3398,7 +3398,7 @@ class TestTrustAuth(test_v3.RestfulTestCase): self.post('/OS-TRUST/trusts', body={'trust': ref}, expected_status=http_client.NOT_FOUND) - def test_create_trust_role_id_404(self): + def test_create_trust_role_id_returns_not_found(self): ref = self.new_trust_ref( trustor_user_id=self.user_id, trustee_user_id=self.trustee_user_id, @@ -3407,7 +3407,7 @@ class TestTrustAuth(test_v3.RestfulTestCase): self.post('/OS-TRUST/trusts', body={'trust': ref}, expected_status=http_client.NOT_FOUND) - def test_create_trust_role_name_404(self): + def test_create_trust_role_name_returns_not_found(self): ref = self.new_trust_ref( trustor_user_id=self.user_id, trustee_user_id=self.trustee_user_id, diff --git a/keystone/tests/unit/test_v3_catalog.py b/keystone/tests/unit/test_v3_catalog.py index 0d82390d9b..e8efff08fe 100644 --- a/keystone/tests/unit/test_v3_catalog.py +++ b/keystone/tests/unit/test_v3_catalog.py @@ -745,7 +745,7 @@ class CatalogTestCase(test_v3.RestfulTestCase): # delete the endpoint self.delete('/endpoints/%s' % ref['id']) - # make sure it's deleted (GET should return 404) + # make sure it's deleted (GET should return Not Found) self.get('/endpoints/%s' % ref['id'], expected_status=http_client.NOT_FOUND) diff --git a/keystone/tests/unit/test_v3_federation.py b/keystone/tests/unit/test_v3_federation.py index 53847b8a60..2de4b99706 100644 --- a/keystone/tests/unit/test_v3_federation.py +++ b/keystone/tests/unit/test_v3_federation.py @@ -1047,7 +1047,7 @@ class FederatedIdentityProviderTests(FederationTests): def test_get_nonexisting_idp(self): """Fetch nonexisting IdP entity. - Expected HTTP 404 status code. + Expected HTTP 404 Not Found status code. """ idp_id = uuid.uuid4().hex @@ -1059,7 +1059,7 @@ class FederatedIdentityProviderTests(FederationTests): def test_delete_existing_idp(self): """Create and later delete IdP. - Expect HTTP 404 for the GET IdP call. + Expect HTTP 404 Not Found for the GET IdP call. """ default_resp = self._create_default_idp() default_idp = self._fetch_attribute_from_response(default_resp, @@ -1100,7 +1100,7 @@ class FederatedIdentityProviderTests(FederationTests): def test_delete_nonexisting_idp(self): """Delete nonexisting IdP. - Expect HTTP 404 for the GET IdP call. + Expect HTTP 404 Not Found for the GET IdP call. """ idp_id = uuid.uuid4().hex url = self.base_url(suffix=idp_id) @@ -1165,7 +1165,7 @@ class FederatedIdentityProviderTests(FederationTests): def test_update_nonexistent_idp(self): """Update nonexistent IdP - Expect HTTP 404 code. + Expect HTTP 404 Not Found code. """ idp_id = uuid.uuid4().hex @@ -1221,7 +1221,7 @@ class FederatedIdentityProviderTests(FederationTests): def test_assign_protocol_to_nonexistent_idp(self): """Assign protocol to IdP that doesn't exist. - Expect HTTP 404 code. + Expect HTTP 404 Not Found code. """ @@ -1298,7 +1298,8 @@ class FederatedIdentityProviderTests(FederationTests): def test_delete_protocol(self): """Delete protocol. - Expect HTTP 404 code for the GET call after the protocol is deleted. + Expect HTTP 404 Not Found code for the GET call after the protocol is + deleted. """ url = self.base_url(suffix='/%(idp_id)s/' @@ -2825,7 +2826,7 @@ class SAMLGenerationTests(FederationTests): def test_sp_not_found(self): """Test SAML generation with an invalid service provider ID. - Raises exception.ServiceProviderNotFound() - error code 404 + Raises exception.ServiceProviderNotFound() - error Not Found 404 """ sp_id = uuid.uuid4().hex @@ -2850,7 +2851,7 @@ class SAMLGenerationTests(FederationTests): def test_token_not_found(self): """Test that an invalid token in the request body raises an exception. - Raises exception.TokenNotFound() - error code 404 + Raises exception.TokenNotFound() - error Not Found 404 """ @@ -3248,7 +3249,7 @@ class ServiceProviderTests(FederationTests): self.patch(url, body={'service_provider': new_sp_ref}, expected_status=http_client.BAD_REQUEST) - def test_update_service_provider_404(self): + def test_update_service_provider_returns_not_found(self): new_sp_ref = self.sp_ref() new_sp_ref['description'] = uuid.uuid4().hex url = self.base_url(suffix=uuid.uuid4().hex) @@ -3270,7 +3271,7 @@ class ServiceProviderTests(FederationTests): url = self.base_url(suffix=self.SERVICE_PROVIDER_ID) self.delete(url) - def test_delete_service_provider_404(self): + def test_delete_service_provider_returns_not_found(self): url = self.base_url(suffix=uuid.uuid4().hex) self.delete(url, expected_status=http_client.NOT_FOUND) diff --git a/keystone/tests/unit/token/test_fernet_provider.py b/keystone/tests/unit/token/test_fernet_provider.py index 62ee0fb35b..bf2afb7d0d 100644 --- a/keystone/tests/unit/token/test_fernet_provider.py +++ b/keystone/tests/unit/token/test_fernet_provider.py @@ -48,13 +48,13 @@ class TestFernetTokenProvider(unit.TestCase): def test_needs_persistence_returns_false(self): self.assertFalse(self.provider.needs_persistence()) - def test_invalid_v3_token_raises_404(self): + def test_invalid_v3_token_raises_token_not_found(self): self.assertRaises( exception.TokenNotFound, self.provider.validate_v3_token, uuid.uuid4().hex) - def test_invalid_v2_token_raises_404(self): + def test_invalid_v2_token_raises_token_not_found(self): self.assertRaises( exception.TokenNotFound, self.provider.validate_v2_token,