From ce293f68ed74d60af94c7d1b5be9f1fe131246b5 Mon Sep 17 00:00:00 2001 From: Lance Bragstad Date: Fri, 9 Oct 2015 15:26:47 +0000 Subject: [PATCH] Refactor: Don't hard code 409 Conflict error codes This patch replaces hard coded HTTP codes with constants. Change-Id: I5b314c250d2e891ed8af1d3878b57461075c68f1 --- keystone/tests/unit/test_v3_catalog.py | 2 +- keystone/tests/unit/test_v3_credential.py | 4 ++-- keystone/tests/unit/test_v3_federation.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/keystone/tests/unit/test_v3_catalog.py b/keystone/tests/unit/test_v3_catalog.py index e8efff08fe..5f4c36871b 100644 --- a/keystone/tests/unit/test_v3_catalog.py +++ b/keystone/tests/unit/test_v3_catalog.py @@ -64,7 +64,7 @@ class CatalogTestCase(test_v3.RestfulTestCase): # Create region again with duplicate id self.put( '/regions/myregion', - body={'region': ref}, expected_status=409) + body={'region': ref}, expected_status=http_client.CONFLICT) def test_create_region(self): """Call ``POST /regions`` with an ID in the request body.""" diff --git a/keystone/tests/unit/test_v3_credential.py b/keystone/tests/unit/test_v3_credential.py index d5f9024ea4..d7e4b645ce 100644 --- a/keystone/tests/unit/test_v3_credential.py +++ b/keystone/tests/unit/test_v3_credential.py @@ -206,7 +206,7 @@ class CredentialTestCase(CredentialBaseTestCase): # for conflict. self.post( '/credentials', - body={'credential': ref}, expected_status=409) + body={'credential': ref}, expected_status=http_client.CONFLICT) def test_get_ec2_dict_blob(self): """Ensure non-JSON blob data is correctly converted.""" @@ -351,7 +351,7 @@ class TestCredentialTrustScoped(test_v3.RestfulTestCase): '/credentials', body={'credential': ref}, token=token_id, - expected_status=409) + expected_status=http_client.CONFLICT) class TestCredentialEc2(CredentialBaseTestCase): diff --git a/keystone/tests/unit/test_v3_federation.py b/keystone/tests/unit/test_v3_federation.py index 818506f5da..e28a2ffeb7 100644 --- a/keystone/tests/unit/test_v3_federation.py +++ b/keystone/tests/unit/test_v3_federation.py @@ -886,7 +886,7 @@ class FederatedIdentityProviderTests(FederationTests): A remote_id is the same for both so the second IdP is not created because of the uniqueness of the remote_ids - Expect HTTP 409 code for the latter call. + Expect HTTP 409 Conflict code for the latter call. """ @@ -1021,7 +1021,7 @@ class FederatedIdentityProviderTests(FederationTests): def test_check_idp_uniqueness(self): """Add same IdP twice. - Expect HTTP 409 code for the latter call. + Expect HTTP 409 Conflict code for the latter call. """ url = self.base_url(suffix=uuid.uuid4().hex) @@ -1204,7 +1204,7 @@ class FederatedIdentityProviderTests(FederationTests): """Test whether Keystone checks for unique idp/protocol values. Add same protocol twice, expect Keystone to reject a latter call and - return HTTP 409 code. + return HTTP 409 Conflict code. """ url = self.base_url(suffix='%(idp_id)s/protocols/%(protocol_id)s')