From: Evgenii Gorinov Date: Wed, 9 Nov 2016 16:19:13 +0000 (+0300) Subject: Fix 'If-Modified-Since' format string X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=217f0d520f0ba41aadf37e4d1ad2037d91c2bb40;p=s3-tests.git Fix 'If-Modified-Since' format string According to https://tools.ietf.org/html/rfc7232 header 'If-Modified-Since' should be a correct HTTP-date. For example: `Tue, 15 Nov 1994 12:45:26 GMT`; not `1994-11-15T12:45:26.000Z`. Signed-off-by: Evgenii Gorinov --- diff --git a/s3tests/functional/test_s3.py b/s3tests/functional/test_s3.py index f2a5e54b..42c251f2 100644 --- a/s3tests/functional/test_s3.py +++ b/s3tests/functional/test_s3.py @@ -2435,13 +2435,14 @@ def test_get_object_ifmodifiedsince_failed(): for k in bucket.get_all_keys(): key = k - mtime = time.strptime(key.last_modified, '%Y-%m-%dT%H:%M:%S.%fZ') + mtime = datetime.datetime.strptime(key.last_modified, '%Y-%m-%dT%H:%M:%S.%fZ') - after = time.ctime(time.mktime(mtime) + 1) + after = mtime + datetime.timedelta(seconds=1) + after_str = time.strftime("%a, %d %b %Y %H:%M:%S GMT", after.timetuple()) time.sleep(1) - e = assert_raises(boto.exception.S3ResponseError, bucket.get_key, 'foo', headers={'If-Modified-Since': after}) + e = assert_raises(boto.exception.S3ResponseError, bucket.get_key, 'foo', headers={'If-Modified-Since': after_str}) eq(e.status, 304) eq(e.reason, 'Not Modified')