Merge pull request #136 from jkorvin/fix-ifmodifiedsince-failed

Fix 'If-Modified-Since' format string

Reviewed-by: Yehuda Sadeh <yehuda@redhat.com>
This commit is contained in:
Yehuda Sadeh 2017-03-07 13:47:44 -08:00 committed by GitHub
commit 4eec3bebc7

View file

@ -2437,13 +2437,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')