Merge "Add 409 ConflictException"
This commit is contained in:
@@ -118,6 +118,11 @@ class BadRequestException(HttpException):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ConflictException(HttpException):
|
||||||
|
"""HTTP 409 Conflict."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MethodNotSupported(SDKException):
|
class MethodNotSupported(SDKException):
|
||||||
"""The resource does not support this operation type."""
|
"""The resource does not support this operation type."""
|
||||||
def __init__(self, resource, method):
|
def __init__(self, resource, method):
|
||||||
@@ -162,7 +167,9 @@ def raise_from_response(response, error_message=None):
|
|||||||
if response.status_code < 400:
|
if response.status_code < 400:
|
||||||
return
|
return
|
||||||
|
|
||||||
if response.status_code == 404:
|
if response.status_code == 409:
|
||||||
|
cls = ConflictException
|
||||||
|
elif response.status_code == 404:
|
||||||
cls = NotFoundException
|
cls = NotFoundException
|
||||||
elif response.status_code == 400:
|
elif response.status_code == 400:
|
||||||
cls = BadRequestException
|
cls = BadRequestException
|
||||||
|
@@ -203,7 +203,7 @@ class TestDomains(base.TestCase):
|
|||||||
json=domain_data.json_response,
|
json=domain_data.json_response,
|
||||||
validate=dict(json={'domain': {'enabled': False}}))])
|
validate=dict(json={'domain': {'enabled': False}}))])
|
||||||
with testtools.ExpectedException(
|
with testtools.ExpectedException(
|
||||||
openstack.cloud.OpenStackCloudHTTPError,
|
openstack.exceptions.ConflictException,
|
||||||
"Error in updating domain %s" % domain_data.domain_id
|
"Error in updating domain %s" % domain_data.domain_id
|
||||||
):
|
):
|
||||||
self.cloud.delete_domain(domain_data.domain_id)
|
self.cloud.delete_domain(domain_data.domain_id)
|
||||||
|
Reference in New Issue
Block a user