From bc3625142cccd1af00ef0394e3abba1db6764acc Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Mon, 25 Jul 2022 17:13:10 -0700 Subject: [PATCH] py310: Fix formatdate() call Previously, this would trip TypeErrors on py310: TypeError: 'S3Timestamp' object cannot be interpreted as an integer Change-Id: I124c1957264c80d28a6b3e852d042cbc8468939c --- test/functional/s3api/test_object.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/functional/s3api/test_object.py b/test/functional/s3api/test_object.py index 5c0d847533..bbca440684 100644 --- a/test/functional/s3api/test_object.py +++ b/test/functional/s3api/test_object.py @@ -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)