]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
Add tests for Cache-Control and Expires headers 64/head
authorAndrew Gaul <andrew@gaul.org>
Tue, 30 Jun 2015 22:42:32 +0000 (15:42 -0700)
committerAndrew Gaul <andrew@gaul.org>
Tue, 30 Jun 2015 23:39:13 +0000 (16:39 -0700)
Signed-off-by: Andrew Gaul <andrew@gaul.org>
s3tests/functional/test_s3.py

index 91cb4c83c1783673671101c8a894befed215e614..8b7db4361bccbfe9a2d52c819f2544d963e24d14 100644 (file)
@@ -895,6 +895,32 @@ def test_object_write_check_etag():
     eq(res.reason, 'OK')
     eq(res.getheader("ETag"), '"37b51d194a7513e45b56f6524f2d51f2"')
 
+@attr(resource='object')
+@attr(method='put')
+@attr(operation='write key')
+@attr(assertion='correct cache control header')
+def test_object_write_cache_control():
+    bucket = get_new_bucket()
+    key = bucket.new_key('foo')
+    cache_control = 'public, max-age=14400'
+    key.set_contents_from_string('bar', headers = {'Cache-Control': cache_control})
+    key2 = bucket.get_key('foo')
+    eq(key2.cache_control, cache_control)
+
+@attr(resource='object')
+@attr(method='put')
+@attr(operation='write key')
+@attr(assertion='correct expires header')
+def test_object_write_expires():
+    bucket = get_new_bucket()
+    key = bucket.new_key('foo')
+    utc = pytz.utc
+    expires = datetime.datetime.now(utc) + datetime.timedelta(seconds=+6000)
+    expires = expires.strftime("%a, %d %b %Y %H:%M:%S GMT")
+    key.set_contents_from_string('bar', headers = {'Expires': expires})
+    key2 = bucket.get_key('foo')
+    eq(key2.expires, expires)
+
 @attr(resource='object')
 @attr(method='all')
 @attr(operation='complete object life cycle')