py310: Fix formatdate() call
Previously, this would trip TypeErrors on py310: TypeError: 'S3Timestamp' object cannot be interpreted as an integer Change-Id: I124c1957264c80d28a6b3e852d042cbc8468939c
This commit is contained in:
parent
aa1b7f9481
commit
bc3625142c
@ -789,15 +789,17 @@ class TestS3ApiObject(S3ApiBase):
|
|||||||
elem = fromstring(body, 'ListBucketResult')
|
elem = fromstring(body, 'ListBucketResult')
|
||||||
last_modified = elem.find('./Contents/LastModified').text
|
last_modified = elem.find('./Contents/LastModified').text
|
||||||
listing_datetime = S3Timestamp.from_s3xmlformat(last_modified)
|
listing_datetime = S3Timestamp.from_s3xmlformat(last_modified)
|
||||||
headers = \
|
# Make sure there's no fractions of a second
|
||||||
{'If-Unmodified-Since': formatdate(listing_datetime)}
|
self.assertEqual(int(listing_datetime), float(listing_datetime))
|
||||||
|
header_datetime = formatdate(int(listing_datetime))
|
||||||
|
|
||||||
|
headers = {'If-Unmodified-Since': header_datetime}
|
||||||
status, headers, body = \
|
status, headers, body = \
|
||||||
self.conn.make_request('GET', self.bucket, obj, headers=headers)
|
self.conn.make_request('GET', self.bucket, obj, headers=headers)
|
||||||
self.assertEqual(status, 200)
|
self.assertEqual(status, 200)
|
||||||
self.assertCommonResponseHeaders(headers)
|
self.assertCommonResponseHeaders(headers)
|
||||||
|
|
||||||
headers = \
|
headers = {'If-Modified-Since': header_datetime}
|
||||||
{'If-Modified-Since': formatdate(listing_datetime)}
|
|
||||||
status, headers, body = \
|
status, headers, body = \
|
||||||
self.conn.make_request('GET', self.bucket, obj, headers=headers)
|
self.conn.make_request('GET', self.bucket, obj, headers=headers)
|
||||||
self.assertEqual(status, 304)
|
self.assertEqual(status, 304)
|
||||||
|
Loading…
Reference in New Issue
Block a user