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:
Tim Burke 2022-07-25 17:13:10 -07:00
parent aa1b7f9481
commit bc3625142c

View File

@ -789,15 +789,17 @@ class TestS3ApiObject(S3ApiBase):
elem = fromstring(body, 'ListBucketResult')
last_modified = elem.find('./Contents/LastModified').text
listing_datetime = S3Timestamp.from_s3xmlformat(last_modified)
headers = \
{'If-Unmodified-Since': formatdate(listing_datetime)}
# Make sure there's no fractions of a second
self.assertEqual(int(listing_datetime), float(listing_datetime))
header_datetime = formatdate(int(listing_datetime))
headers = {'If-Unmodified-Since': header_datetime}
status, headers, body = \
self.conn.make_request('GET', self.bucket, obj, headers=headers)
self.assertEqual(status, 200)
self.assertCommonResponseHeaders(headers)
headers = \
{'If-Modified-Since': formatdate(listing_datetime)}
headers = {'If-Modified-Since': header_datetime}
status, headers, body = \
self.conn.make_request('GET', self.bucket, obj, headers=headers)
self.assertEqual(status, 304)