Refactor: Don't hard code 409 Conflict error codes

This patch replaces hard coded HTTP codes with constants.

Change-Id: I5b314c250d2e891ed8af1d3878b57461075c68f1
This commit is contained in:
Lance Bragstad 2015-10-09 15:26:47 +00:00
parent 8500d76e35
commit ce293f68ed
3 changed files with 6 additions and 6 deletions

View File

@ -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."""

View File

@ -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):

View File

@ -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')