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:
parent
8500d76e35
commit
ce293f68ed
|
@ -64,7 +64,7 @@ class CatalogTestCase(test_v3.RestfulTestCase):
|
||||||
# Create region again with duplicate id
|
# Create region again with duplicate id
|
||||||
self.put(
|
self.put(
|
||||||
'/regions/myregion',
|
'/regions/myregion',
|
||||||
body={'region': ref}, expected_status=409)
|
body={'region': ref}, expected_status=http_client.CONFLICT)
|
||||||
|
|
||||||
def test_create_region(self):
|
def test_create_region(self):
|
||||||
"""Call ``POST /regions`` with an ID in the request body."""
|
"""Call ``POST /regions`` with an ID in the request body."""
|
||||||
|
|
|
@ -206,7 +206,7 @@ class CredentialTestCase(CredentialBaseTestCase):
|
||||||
# for conflict.
|
# for conflict.
|
||||||
self.post(
|
self.post(
|
||||||
'/credentials',
|
'/credentials',
|
||||||
body={'credential': ref}, expected_status=409)
|
body={'credential': ref}, expected_status=http_client.CONFLICT)
|
||||||
|
|
||||||
def test_get_ec2_dict_blob(self):
|
def test_get_ec2_dict_blob(self):
|
||||||
"""Ensure non-JSON blob data is correctly converted."""
|
"""Ensure non-JSON blob data is correctly converted."""
|
||||||
|
@ -351,7 +351,7 @@ class TestCredentialTrustScoped(test_v3.RestfulTestCase):
|
||||||
'/credentials',
|
'/credentials',
|
||||||
body={'credential': ref},
|
body={'credential': ref},
|
||||||
token=token_id,
|
token=token_id,
|
||||||
expected_status=409)
|
expected_status=http_client.CONFLICT)
|
||||||
|
|
||||||
|
|
||||||
class TestCredentialEc2(CredentialBaseTestCase):
|
class TestCredentialEc2(CredentialBaseTestCase):
|
||||||
|
|
|
@ -886,7 +886,7 @@ class FederatedIdentityProviderTests(FederationTests):
|
||||||
A remote_id is the same for both so the second IdP is not
|
A remote_id is the same for both so the second IdP is not
|
||||||
created because of the uniqueness of the remote_ids
|
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):
|
def test_check_idp_uniqueness(self):
|
||||||
"""Add same IdP twice.
|
"""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)
|
url = self.base_url(suffix=uuid.uuid4().hex)
|
||||||
|
@ -1204,7 +1204,7 @@ class FederatedIdentityProviderTests(FederationTests):
|
||||||
"""Test whether Keystone checks for unique idp/protocol values.
|
"""Test whether Keystone checks for unique idp/protocol values.
|
||||||
|
|
||||||
Add same protocol twice, expect Keystone to reject a latter call and
|
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')
|
url = self.base_url(suffix='%(idp_id)s/protocols/%(protocol_id)s')
|
||||||
|
|
Loading…
Reference in New Issue