]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
s3tests: improve cors test to cover more functionality
authorYehuda Sadeh <yehuda@inktank.com>
Thu, 1 Aug 2013 20:24:28 +0000 (13:24 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Thu, 1 Aug 2013 20:24:28 +0000 (13:24 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
s3tests/functional/test_s3.py

index 708815c8120407955e1d1f96d22364d0083ae18a..e8587364698eba9884c5bd56fd95479f36f05745 100644 (file)
@@ -4260,7 +4260,8 @@ def test_stress_bucket_acls_changes():
 def test_set_cors():
     bucket = get_new_bucket()
     cfg = CORSConfiguration()
-    cfg.add_rule('GET', '*')
+    cfg.add_rule('GET', '*.get')
+    cfg.add_rule('PUT', '*.put')
 
     e = assert_raises(boto.exception.S3ResponseError, bucket.get_cors)
     eq(e.status, 404)
@@ -4268,6 +4269,25 @@ def test_set_cors():
     bucket.set_cors(cfg)
     new_cfg = bucket.get_cors()
 
+    eq(len(new_cfg), 2)
+
+    result = bunch.Bunch()
+
+    for c in new_cfg:
+        eq(len(c.allowed_method), 1)
+        eq(len(c.allowed_origin), 1)
+        result[c.allowed_method[0]] = c.allowed_origin[0]
+
+
+    eq(result['GET'], '*.get')
+    eq(result['PUT'], '*.put')
+
+    bucket.delete_cors()
+
+    e = assert_raises(boto.exception.S3ResponseError, bucket.get_cors)
+    eq(e.status, 404)
+
+
 class FakeFile(object):
     """
     file that simulates seek, tell, and current character