]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
rgw: aws4: fix test_object_create_missing_signed_header_aws4 115/head
authorJavier M. Mellid <jmunhoz@igalia.com>
Thu, 2 Jun 2016 20:57:48 +0000 (20:57 +0000)
committerJavier M. Mellid <jmunhoz@igalia.com>
Thu, 2 Jun 2016 21:32:00 +0000 (21:32 +0000)
Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
s3tests/functional/test_headers.py

index 2c1f5d2fddd509d81df2c6c7c1ec0854a9814a1d..5274a657414b2610fcf4a6f9da0df1c7d6337491 100644 (file)
@@ -12,6 +12,7 @@ import string
 import socket
 import ssl
 import os
+import re
 
 from urlparse import urlparse
 
@@ -1415,12 +1416,28 @@ def test_object_create_missing_signed_custom_header_aws4():
 @nose.with_setup(teardown=_clear_custom_headers)
 def test_object_create_missing_signed_header_aws4():
     check_aws4_support()
-    key = _setup_bad_object()
-    _add_custom_non_auth_headers(remove=('Content-MD5',))
-    e = assert_raises(boto.exception.S3ResponseError, key.set_contents_from_string, 'bar')
-    eq(e.status, 403)
-    eq(e.reason, 'Forbidden')
-    eq(e.error_code, 'SignatureDoesNotMatch')
+    method='PUT'
+    expires_in='100000'
+    bucket = get_new_bucket()
+    key = bucket.new_key('foo')
+    body='zoo'
+
+    # compute the signature...
+    request_headers = {}
+    url = key.generate_url(expires_in, method=method, headers=request_headers)
+
+    o = urlparse(url)
+    path = o.path + '?' + o.query
+
+    # 'X-Amz-Expires' is missing
+    target = r'&X-Amz-Expires=' + expires_in
+    path = re.sub(target, '', path)
+
+    res =_make_raw_request(host=s3.main.host, port=s3.main.port, method=method, path=path,
+                           body=body, request_headers=request_headers, secure=s3.main.is_secure)
+
+    eq(res.status, 403)
+    eq(res.reason, 'Forbidden')
 
 
 @tag('auth_aws4')