Merge "Add 409 ConflictException"

This commit is contained in:
Zuul
2018-03-22 13:18:42 +00:00
committed by Gerrit Code Review
2 changed files with 9 additions and 2 deletions

View File

@@ -118,6 +118,11 @@ class BadRequestException(HttpException):
pass
class ConflictException(HttpException):
"""HTTP 409 Conflict."""
pass
class MethodNotSupported(SDKException):
"""The resource does not support this operation type."""
def __init__(self, resource, method):
@@ -162,7 +167,9 @@ def raise_from_response(response, error_message=None):
if response.status_code < 400:
return
if response.status_code == 404:
if response.status_code == 409:
cls = ConflictException
elif response.status_code == 404:
cls = NotFoundException
elif response.status_code == 400:
cls = BadRequestException

View File

@@ -203,7 +203,7 @@ class TestDomains(base.TestCase):
json=domain_data.json_response,
validate=dict(json={'domain': {'enabled': False}}))])
with testtools.ExpectedException(
openstack.cloud.OpenStackCloudHTTPError,
openstack.exceptions.ConflictException,
"Error in updating domain %s" % domain_data.domain_id
):
self.cloud.delete_domain(domain_data.domain_id)