From 2160a6a403de98bf4e72afb5673ee9367433f702 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Tue, 14 Mar 2017 15:56:13 -0700 Subject: [PATCH] Test reading an unreadable object Signed-off-by: Andrew Gaul --- s3tests_boto3/functional/test_s3.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/s3tests_boto3/functional/test_s3.py b/s3tests_boto3/functional/test_s3.py index 1246394..c27a789 100644 --- a/s3tests_boto3/functional/test_s3.py +++ b/s3tests_boto3/functional/test_s3.py @@ -12291,3 +12291,15 @@ def test_copy_object_ifnonematch_failed(): client.copy_object(Bucket=bucket_name, CopySource=bucket_name+'/foo', CopySourceIfNoneMatch='ABCORZ', Key='bar') resp = client.get_object(Bucket=bucket_name, Key='bar') eq(resp['Body'].read(), 'bar') + +@attr(resource='object') +@attr(method='get') +@attr(operation='read to invalid key') +@attr(assertion='fails 400') +def test_object_read_unreadable(): + bucket_name = get_new_bucket() + client = get_client() + e = assert_raises(ClientError, client.get_object, Bucket=bucket_name, Key='\xae\x8a-') + status, error_code = _get_status_and_error_code(e.response) + eq(status, 400) + eq(e.response['Error']['Message'], 'Couldn\'t parse the specified URI.')