Skip to content

Commit

Permalink
Merge pull request #229 from fkautz/pr_out_adding_405_and_501_to_list…
Browse files Browse the repository at this point in the history
…_of_handled_errors_fixes_226
  • Loading branch information
Frederick F. Kautz IV committed Jul 16, 2015
2 parents 5b43397 + 347217a commit 9f16fee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions integration/remove_bucket_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
bucket = 'goroutine-delete-me'

client = minio.Minio(url, access_key=access_key, secret_key=secret_key)
play_client = minio.Minio("https://play.minio.io:9000")


class RemoveBucketIntegration(TestCase):
Expand All @@ -44,3 +45,7 @@ def test_remove_bucket_with_data_fails(self):
@raises(ResponseError)
def test_invalid_bucket_name_exception(self):
client.remove_bucket('1234')

@raises(ResponseError)
def test_remove_object_not_allowed(self):
play_client.remove_object("foo", "bar")
5 changes: 5 additions & 0 deletions integration/remove_object_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
secret_key = credentials.secret_key()

client = minio.Minio(url, access_key=access_key, secret_key=secret_key)
play_client = minio.Minio("https://play.minio.io:9000")

bucket = 'goroutine-py'

Expand All @@ -46,3 +47,7 @@ def test_bucket_not_found(self):

def test_object_not_found(self):
client.remove_object(bucket, 'missing-object')

@raises(ResponseError)
def test_remove_bucket_not_allowed(self):
play_client.remove_bucket("foo")
3 changes: 3 additions & 0 deletions minio/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ def parse_error(response, url=None):
amz_request_id = None
if 'x-amz-request-id' in response.headers:
amz_request_id = response.headers['x-amz-request-id']
raise ResponseError('MethodNotAllowedException', response.reason, amz_request_id, None, url, response.data)
if response.status == 405 or response.status == 501:
raise ResponseError('MethodNotAllowedException', response.reason, amz_request_id, None, url, response.data)
if response.status == 404:
raise ResponseError('ObjectNotFoundException', response.reason, amz_request_id, None, url, response.data)
if response.status == 403:
Expand Down

0 comments on commit 9f16fee

Please sign in to comment.