]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
s3tests: modify test_get_object_ifmodifiedsince_failed wip-ifmodified 111/head
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 17 May 2016 21:33:40 +0000 (14:33 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 17 May 2016 22:46:27 +0000 (15:46 -0700)
Use key's last_modified instead of local time

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
s3tests/functional/test_s3.py

index 58a738e38b783dc2e255e04aa1da5174c66b4112..4cda267ed58d51f01acbaa9a1222cca1e300138f 100644 (file)
@@ -2357,11 +2357,14 @@ def test_get_object_ifmodifiedsince_failed():
     key = bucket.new_key('foo')
     key.set_contents_from_string('bar')
 
-    # Sleep since Amazon returns 200 if the date is in the future:
-    # https://forums.aws.amazon.com/message.jspa?messageID=325930
-    now = time.time()
-    time.sleep(20)
-    after = formatdate(now + 10)
+    for k in bucket.get_all_keys():
+        key = k
+
+    mtime = time.strptime(key.last_modified, '%Y-%m-%dT%H:%M:%S.%fZ')
+
+    after = time.ctime(time.mktime(mtime) + 1)
+
+    time.sleep(1)
 
     e = assert_raises(boto.exception.S3ResponseError, bucket.get_key, 'foo', headers={'If-Modified-Since': after})
     eq(e.status, 304)