s3tests: Add test_object_requestid_matchs_header_on_error

Error responses' RequestId must match header's x-amz-request-id value.

Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
This commit is contained in:
Javier M. Mellid 2015-09-09 21:49:17 +02:00
parent 63048b7bdf
commit 6ca9492797

View file

@ -844,6 +844,17 @@ def test_object_requestid_on_error():
request_id = re.search(r'<RequestId>.*</RequestId>', e.body.encode('utf-8')).group(0) request_id = re.search(r'<RequestId>.*</RequestId>', e.body.encode('utf-8')).group(0)
assert request_id is not None assert request_id is not None
@attr(resource='object')
@attr(method='get')
@attr(operation='read contents that were never written to raise one error response')
@attr(assertion='RequestId in the error response matchs the x-amz-request-id in the headers')
def test_object_requestid_matchs_header_on_error():
bucket = get_new_bucket()
key = bucket.new_key('foobar')
e = assert_raises(boto.exception.S3ResponseError, key.get_contents_as_string)
request_id = re.search(r'<RequestId>(.*)</RequestId>', e.body.encode('utf-8')).group(1)
eq(key.resp.getheader('x-amz-request-id'), request_id)
@attr(resource='object') @attr(resource='object')
@attr(method='put') @attr(method='put')
@attr(operation='write to special characters key') @attr(operation='write to special characters key')