Hello community, here is the log from the commit of package python-minio for openSUSE:Factory checked in at 2020-01-22 22:46:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-minio (Old) and /work/SRC/openSUSE:Factory/.python-minio.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-minio" Wed Jan 22 22:46:34 2020 rev:8 rq:766362 version:5.0.6 Changes: -------- --- /work/SRC/openSUSE:Factory/python-minio/python-minio.changes 2019-10-02 14:55:36.291332169 +0200 +++ /work/SRC/openSUSE:Factory/.python-minio.new.26092/python-minio.changes 2020-01-22 22:46:57.940596619 +0100 @@ -1,0 +2,19 @@ +Wed Jan 22 15:23:46 UTC 2020 - Martin Sirringhaus <martin.sirringh...@suse.com> + +- Update to 5.0.6 + * Fix detecting a valid endpoint with new Python versions + * Fix some typo in SELECT API doc + * fget_object(): open temporary file on overwrite mode + +- Update to 5.0.5 + * Increase presigned timeouts for functional tests + * Remove future depdency for python3 + * Do not need to set max-keys, max-uploads and max-parts + +- Update to 5.0.4 + * signV4: Avoid encoding ~ when found in the query part of + the url + * FIX: AttributeError at error.message + * Strip port 80/443 from host + +------------------------------------------------------------------- Old: ---- minio-5.0.1.tar.gz New: ---- minio-5.0.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-minio.spec ++++++ --- /var/tmp/diff_new_pack.elOIMZ/_old 2020-01-22 22:46:59.624597467 +0100 +++ /var/tmp/diff_new_pack.elOIMZ/_new 2020-01-22 22:46:59.628597468 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-minio # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-minio -Version: 5.0.1 +Version: 5.0.6 Release: 0 Summary: Minio library for Amazon S3 compatible cloud storage License: Apache-2.0 ++++++ minio-5.0.1.tar.gz -> minio-5.0.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/PKG-INFO new/minio-5.0.6/PKG-INFO --- old/minio-5.0.1/PKG-INFO 2019-09-18 23:08:50.000000000 +0200 +++ new/minio-5.0.6/PKG-INFO 2019-12-30 21:00:31.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: minio -Version: 5.0.1 +Version: 5.0.6 Summary: MinIO Python Library for Amazon S3 Compatible Cloud Storage for Python Home-page: https://github.com/minio/minio-py Author: MinIO, Inc. @@ -89,12 +89,13 @@ pass except ResponseError as err: raise - else: - # Put an object 'pumaserver_debug.log' with contents from 'pumaserver_debug.log'. - try: - minioClient.fput_object('maylogs', 'pumaserver_debug.log', '/tmp/pumaserver_debug.log') - except ResponseError as err: - print(err) + + # Put an object 'pumaserver_debug.log' with contents from 'pumaserver_debug.log'. + try: + minioClient.fput_object('maylogs', 'pumaserver_debug.log', '/tmp/pumaserver_debug.log') + except ResponseError as err: + print(err) + ``` #### Run file-uploader diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/README.md new/minio-5.0.6/README.md --- old/minio-5.0.1/README.md 2019-09-18 23:07:19.000000000 +0200 +++ new/minio-5.0.6/README.md 2019-12-30 20:59:25.000000000 +0100 @@ -80,12 +80,13 @@ pass except ResponseError as err: raise -else: - # Put an object 'pumaserver_debug.log' with contents from 'pumaserver_debug.log'. - try: - minioClient.fput_object('maylogs', 'pumaserver_debug.log', '/tmp/pumaserver_debug.log') - except ResponseError as err: - print(err) + +# Put an object 'pumaserver_debug.log' with contents from 'pumaserver_debug.log'. +try: + minioClient.fput_object('maylogs', 'pumaserver_debug.log', '/tmp/pumaserver_debug.log') +except ResponseError as err: + print(err) + ``` #### Run file-uploader diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/docs/API.md new/minio-5.0.6/docs/API.md --- old/minio-5.0.1/docs/API.md 2019-09-18 23:07:19.000000000 +0200 +++ new/minio-5.0.6/docs/API.md 2019-12-30 20:59:25.000000000 +0100 @@ -383,7 +383,7 @@ ]} -minioClient.set_bucket_policy('mybucket', policy_read_only) +minioClient.set_bucket_policy('mybucket', json.dumps(policy_read_only)) ``` <a name="get_bucket_notification"></a> @@ -671,7 +671,7 @@ ``` <a name="select_object_content"></a> -### select_object_content(self, bucket_name, object_name, options) +### select_object_content(bucket_name, object_name, options) Select object content filters the contents of object based on a simple structured query language (SQL). __Parameters__ @@ -680,7 +680,7 @@ |:---|:---|:---| |``bucket_name`` |_string_ |Name of the bucket. | |``object_name`` |_string_ |Name of the object. | -|``options`` | _SelectObjectReader_ | Query Options | +|``options`` | _SelectObjectOptions_ | Query Options | __Return Value__ @@ -720,7 +720,7 @@ QuoteEscapeCharacter='"',) ), request_progress=RequestProgress( - enabled="FLASE" + enabled="FALSE" ) ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/minio/__init__.py new/minio-5.0.6/minio/__init__.py --- old/minio-5.0.1/minio/__init__.py 2019-09-18 23:07:19.000000000 +0200 +++ new/minio-5.0.6/minio/__init__.py 2019-12-30 20:59:25.000000000 +0100 @@ -29,7 +29,7 @@ __title__ = 'minio-py' __author__ = 'MinIO, Inc.' -__version__ = '5.0.1' +__version__ = '5.0.6' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2015, 2016, 2017, 2018, 2019 MinIO, Inc.' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/minio/api.py new/minio-5.0.6/minio/api.py --- old/minio-5.0.1/minio/api.py 2019-09-18 23:07:19.000000000 +0200 +++ new/minio-5.0.6/minio/api.py 2019-12-30 20:59:25.000000000 +0100 @@ -331,7 +331,8 @@ headers, self._access_key, self._secret_key, self._session_token, - content_sha256_hex) + content_sha256_hex, + datetime.utcnow()) response = self._http.urlopen(method, url, body=content, @@ -370,7 +371,7 @@ headers, self._access_key, self._secret_key, self._session_token, - None) + None, datetime.utcnow()) response = self._http.urlopen(method, url, body=None, @@ -637,8 +638,8 @@ # Write to a temporary file "file_path.part.minio" before saving. file_part_path = file_path + stat.etag + '.part.minio' - # Open file in 'write+append' mode. - with open(file_part_path, 'ab') as file_part_data: + # Open file in 'overwrite' mode. + with open(file_part_path, 'wb') as file_part_data: # Save current file_part statinfo. file_statinfo = os.stat(file_part_path) @@ -923,7 +924,6 @@ # Initialize query parameters. query = { - 'max-keys': '1000', 'prefix': prefix } @@ -1217,7 +1217,6 @@ # Initialize query parameters. query = { 'uploads': '', - 'max-uploads': '1000', 'prefix': prefix } @@ -1274,7 +1273,6 @@ query = { 'uploadId': upload_id, - 'max-parts': '1000' } is_truncated = True @@ -1864,7 +1862,7 @@ headers, self._access_key, self._secret_key, self._session_token, - None) + None, datetime.utcnow()) response = self._http.urlopen(method, url, body=None, @@ -1914,7 +1912,7 @@ headers = sign_v4(method, url, region, fold_case_headers, self._access_key, self._secret_key, self._session_token, - content_sha256) + content_sha256, datetime.utcnow()) response = self._http.urlopen(method, url, body=body, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/minio/error.py new/minio-5.0.6/minio/error.py --- old/minio-5.0.1/minio/error.py 2019-09-18 23:07:19.000000000 +0200 +++ new/minio-5.0.6/minio/error.py 2019-12-30 20:59:25.000000000 +0100 @@ -29,14 +29,9 @@ from xml.etree.cElementTree import ParseError if hasattr(cElementTree, 'ParseError'): - ## ParseError seems to not have .message like other - ## exceptions. Add dynamically new attribute carrying - ## value from message. - if not hasattr(ParseError, 'message'): - setattr(ParseError, 'message', ParseError.msg) - _ETREE_EXCEPTIONS = (ParseError, AttributeError, ValueError, TypeError) + ETREE_EXCEPTIONS = (ParseError, AttributeError, ValueError, TypeError) else: - _ETREE_EXCEPTIONS = (SyntaxError, AttributeError, ValueError, TypeError) + ETREE_EXCEPTIONS = (SyntaxError, AttributeError, ValueError, TypeError) class MinioError(Exception): @@ -178,9 +173,9 @@ raise ValueError('response data has no body.') try: root = cElementTree.fromstring(self._response.data) - except _ETREE_EXCEPTIONS as error: + except ETREE_EXCEPTIONS as error: raise InvalidXMLError('"Error" XML is not parsable. ' - 'Message: {0}'.format(error.message)) + 'Message: {0}'.format(error)) for attribute in root: if attribute.tag == 'Code': self.code = attribute.text diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/minio/helpers.py new/minio-5.0.6/minio/helpers.py --- old/minio-5.0.1/minio/helpers.py 2019-09-18 23:07:19.000000000 +0200 +++ new/minio-5.0.6/minio/helpers.py 2019-12-30 20:59:25.000000000 +0100 @@ -288,10 +288,21 @@ otherwise. """ try: - if urlsplit(endpoint).scheme: + if not '//' in endpoint: + # Having '//' in the beginning of the endpoint enforce + # urlsplit to consider the endpoint as a netloc according + # to this quote in docs.python.org/3/library/urllib.parse.html: + # Following the syntax specifications in RFC 1808, urlparse + # recognizes a netloc only if it is properly introduced by ‘//’. + # Otherwise the input is presumed to be a relative URL and thus + # to start with a path component. + endpoint = '//' + endpoint + + u = urlsplit(endpoint) + if u.scheme: raise InvalidEndpointError('Hostname cannot have a scheme.') - hostname = endpoint.split(':')[0] + hostname = u.hostname if hostname is None: raise InvalidEndpointError('Hostname cannot be empty.') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/minio/parsers.py new/minio-5.0.6/minio/parsers.py --- old/minio-5.0.1/minio/parsers.py 2019-09-18 23:07:19.000000000 +0200 +++ new/minio-5.0.6/minio/parsers.py 2019-12-30 20:59:25.000000000 +0100 @@ -34,7 +34,7 @@ import pytz # minio specific. -from .error import (InvalidXMLError, MultiDeleteError) +from .error import (ETREE_EXCEPTIONS, InvalidXMLError, MultiDeleteError) from .compat import urldecode from .definitions import (Object, Bucket, IncompleteUpload, UploadPart, MultipartUploadResult, @@ -42,11 +42,6 @@ from .xml_marshal import (NOTIFICATIONS_ARN_FIELDNAME_MAP) -if hasattr(cElementTree, 'ParseError'): - _ETREE_EXCEPTIONS = (ParseError, AttributeError, ValueError, TypeError) -else: - _ETREE_EXCEPTIONS = (SyntaxError, AttributeError, ValueError, TypeError) - _S3_NS = {'s3' : 'http://s3.amazonaws.com/doc/2006-03-01/'} @@ -70,10 +65,10 @@ """ try: return cls(root_name, cElementTree.fromstring(data.strip())) - except _ETREE_EXCEPTIONS as error: + except ETREE_EXCEPTIONS as error: raise InvalidXMLError( '"{}" XML is not parsable. Message: {}'.format( - root_name, error.message + root_name, error ) ) @@ -102,10 +97,10 @@ if strict: try: return self.element.find('s3:{}'.format(name), _S3_NS).text - except _ETREE_EXCEPTIONS as error: + except ETREE_EXCEPTIONS as error: raise InvalidXMLError( ('Invalid XML provided for "{}" - erroring tag <{}>. ' - 'Message: {}').format(self.root_name, name, error.message) + 'Message: {}').format(self.root_name, name, error) ) else: return self.element.findtext('s3:{}'.format(name), None, _S3_NS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/minio/signer.py new/minio-5.0.6/minio/signer.py --- old/minio-5.0.1/minio/signer.py 2019-09-18 23:07:19.000000000 +0200 +++ new/minio-5.0.6/minio/signer.py 2019-12-30 20:59:25.000000000 +0100 @@ -96,7 +96,7 @@ parsed_url = urlsplit(url) content_hash_hex = _UNSIGNED_PAYLOAD - host = parsed_url.netloc + host = remove_default_port(parsed_url) headers['Host'] = host iso8601Date = request_date.strftime("%Y%m%dT%H%M%SZ") @@ -173,7 +173,8 @@ access_key=None, secret_key=None, session_token=None, - content_sha256=None): + content_sha256=None, + request_datetime=None): """ Signature version 4. @@ -188,6 +189,7 @@ :param session_token: Optional session token, set only for temporary credentials. :param content_sha256: Optional body sha256. + :param request_datetime: Optional request date/time """ # If no access key or secret key is provided return headers. @@ -208,11 +210,13 @@ # with no payload, calculate sha256 for 0 length data. content_sha256 = get_sha256_hexdigest('') - host = parsed_url.netloc + host = remove_default_port(parsed_url) headers['Host'] = host - date = datetime.utcnow() - headers['X-Amz-Date'] = date.strftime("%Y%m%dT%H%M%SZ") + if request_datetime is None: + request_datetime = datetime.utcnow() + + headers['X-Amz-Date'] = request_datetime.strftime("%Y%m%dT%H%M%SZ") headers['X-Amz-Content-Sha256'] = content_sha256 if session_token: headers['X-Amz-Security-Token'] = session_token @@ -226,14 +230,14 @@ signed_headers, content_sha256) - string_to_sign = generate_string_to_sign(date, region, + string_to_sign = generate_string_to_sign(request_datetime, region, canonical_req) - signing_key = generate_signing_key(date, region, secret_key) + signing_key = generate_signing_key(request_datetime, region, secret_key) signature = hmac.new(signing_key, string_to_sign.encode('utf-8'), hashlib.sha256).hexdigest() authorization_header = generate_authorization_header(access_key, - date, + request_datetime, region, signed_headers, signature) @@ -253,7 +257,8 @@ """ # Should not encode ~. Decode it back if present. parsed_url_path = parsed_url.path.replace("%7E", "~") - lines = [method, parsed_url_path, parsed_url.query] + parsed_url_query = parsed_url.query.replace("%7E", "~") + lines = [method, parsed_url_path, parsed_url_query] # Headers added to canonical request. header_lines = [] @@ -355,3 +360,16 @@ 'SignedHeaders=' + signed_headers_string + ',', 'Signature=' + signature] return ' '.join(auth_header) + +def remove_default_port(parsed_url): + default_ports = { + 'http': 80, + 'https': 443 + } + if any(parsed_url.scheme == scheme and parsed_url.port == port + for scheme, port in default_ports.items()): + # omit default port (i.e. 80 or 443) + host = parsed_url.hostname + else: + host = parsed_url.netloc + return host diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/minio.egg-info/PKG-INFO new/minio-5.0.6/minio.egg-info/PKG-INFO --- old/minio-5.0.1/minio.egg-info/PKG-INFO 2019-09-18 23:08:50.000000000 +0200 +++ new/minio-5.0.6/minio.egg-info/PKG-INFO 2019-12-30 21:00:31.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: minio -Version: 5.0.1 +Version: 5.0.6 Summary: MinIO Python Library for Amazon S3 Compatible Cloud Storage for Python Home-page: https://github.com/minio/minio-py Author: MinIO, Inc. @@ -89,12 +89,13 @@ pass except ResponseError as err: raise - else: - # Put an object 'pumaserver_debug.log' with contents from 'pumaserver_debug.log'. - try: - minioClient.fput_object('maylogs', 'pumaserver_debug.log', '/tmp/pumaserver_debug.log') - except ResponseError as err: - print(err) + + # Put an object 'pumaserver_debug.log' with contents from 'pumaserver_debug.log'. + try: + minioClient.fput_object('maylogs', 'pumaserver_debug.log', '/tmp/pumaserver_debug.log') + except ResponseError as err: + print(err) + ``` #### Run file-uploader diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/minio.egg-info/requires.txt new/minio-5.0.6/minio.egg-info/requires.txt --- old/minio-5.0.1/minio.egg-info/requires.txt 2019-09-18 23:08:50.000000000 +0200 +++ new/minio-5.0.6/minio.egg-info/requires.txt 2019-12-30 21:00:31.000000000 +0100 @@ -1,5 +1,7 @@ -future urllib3 pytz certifi python-dateutil + +[:python_version < "3.0"] +future diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/setup.py new/minio-5.0.6/setup.py --- old/minio-5.0.1/setup.py 2019-09-18 23:07:19.000000000 +0200 +++ new/minio-5.0.6/setup.py 2019-12-30 20:59:25.000000000 +0100 @@ -41,7 +41,7 @@ ] requires = [ - 'future', + 'future;python_version<"3.0"', 'urllib3', 'pytz', 'certifi', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/tests/functional/tests.py new/minio-5.0.6/tests/functional/tests.py --- old/minio-5.0.1/tests/functional/tests.py 2019-09-18 23:07:19.000000000 +0200 +++ new/minio-5.0.6/tests/functional/tests.py 2019-12-30 20:59:25.000000000 +0100 @@ -22,6 +22,7 @@ import io import csv import sys +import tempfile from sys import exit import uuid @@ -895,22 +896,25 @@ # default value for log_output.function attribute is; # log_output.function = "fget_object(bucket_name, object_name, file_path, request_headers)" + tmpfd, tmpfile = tempfile.mkstemp() + os.close(tmpfd) + # Get a unique bucket_name and object_name log_output.args['bucket_name'] = bucket_name = generate_bucket_name() log_output.args['object_name'] = object_name = uuid.uuid4().__str__() - log_output.args['file_path'] = newfile_f = 'newfile-f 新' + log_output.args['file_path'] = tmpfile try: MB_1 = 1024*1024 # 1MiB. MB_1_reader = LimitedRandomReader(MB_1) client.make_bucket(bucket_name) client.put_object(bucket_name, object_name, MB_1_reader, MB_1, sse=sse) # Get/Download a full object and save locally at path - client.fget_object(bucket_name, object_name, newfile_f, sse=sse) + client.fget_object(bucket_name, object_name, tmpfile, sse=sse) except Exception as err: raise Exception(err) finally: try: - os.remove(newfile_f) + os.remove(tmpfile) client.remove_object(bucket_name, object_name) client.remove_bucket(bucket_name) except Exception as err: @@ -1303,7 +1307,7 @@ print(log_output.json_report()) -def test_presigned_get_object_expiry_5sec(client, log_output): +def test_presigned_get_object_expiry(client, log_output): # default value for log_output.function attribute is; # log_output.function = "presigned_get_object(bucket_name, object_name, expires, response_headers)" @@ -1323,7 +1327,7 @@ presigned_get_object_url = client.presigned_get_object(bucket_name, object_name, - timedelta(seconds=5)) + timedelta(seconds=120)) log_output.args['presigned_get_object_url'] = presigned_get_object_url @@ -1339,8 +1343,13 @@ 'GET', bucket_name, object_name).get_exception() - # Wait for 5 seconds for the presigned url to expire - time.sleep(5) + + presigned_get_object_url = client.presigned_get_object(bucket_name, + object_name, + timedelta(seconds=1)) + + # Wait for 2 seconds for the presigned url to expire + time.sleep(2) response = _http.urlopen('GET', presigned_get_object_url) log_output.args['response.status-2'] = response.status @@ -1387,7 +1396,7 @@ 'response-content-language': content_language} presigned_get_object_url = client.presigned_get_object(bucket_name, object_name, - timedelta(seconds=5), + timedelta(seconds=120), response_headers) log_output.args['presigned_get_object_url'] = presigned_get_object_url @@ -1461,7 +1470,7 @@ print(log_output.json_report()) -def test_presigned_put_object_expiry_5sec(client, log_output): +def test_presigned_put_object_expiry(client, log_output): # default value for log_output.function attribute is; # log_output.function = "presigned_put_object(bucket_name, object_name, expires)" @@ -1479,9 +1488,9 @@ presigned_put_object_url = client.presigned_put_object(bucket_name, object_name, - timedelta(seconds=5)) - # Wait for 5 seconds for the presigned url to expire - time.sleep(5) + timedelta(seconds=1)) + # Wait for 2 seconds for the presigned url to expire + time.sleep(2) response = _http.urlopen('PUT', presigned_put_object_url, LimitedRandomReader(KB_1)) @@ -2032,8 +2041,8 @@ log_output = LogOutput(client.presigned_get_object, 'test_presigned_get_object_default_expiry') test_presigned_get_object_default_expiry(client, log_output) - log_output = LogOutput(client.presigned_get_object, 'test_presigned_get_object_expiry_5sec') - test_presigned_get_object_expiry_5sec(client, log_output) + log_output = LogOutput(client.presigned_get_object, 'test_presigned_get_object_expiry') + test_presigned_get_object_expiry(client, log_output) log_output = LogOutput(client.presigned_get_object, 'test_presigned_get_object_response_headers') test_presigned_get_object_response_headers(client, log_output) @@ -2041,8 +2050,8 @@ log_output = LogOutput(client.presigned_put_object, 'test_presigned_put_object_default_expiry') test_presigned_put_object_default_expiry(client, log_output) - log_output = LogOutput(client.presigned_put_object, 'test_presigned_put_object_expiry_5sec') - test_presigned_put_object_expiry_5sec(client, log_output) + log_output = LogOutput(client.presigned_put_object, 'test_presigned_put_object_expiry') + test_presigned_put_object_expiry(client, log_output) log_output = LogOutput(client.presigned_post_policy, 'test_presigned_post_policy') test_presigned_post_policy(client, log_output) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/tests/unit/list_incomplete_uploads_test.py new/minio-5.0.6/tests/unit/list_incomplete_uploads_test.py --- old/minio-5.0.1/tests/unit/list_incomplete_uploads_test.py 2019-09-18 23:07:19.000000000 +0200 +++ new/minio-5.0.6/tests/unit/list_incomplete_uploads_test.py 2019-12-30 20:59:25.000000000 +0100 @@ -45,7 +45,7 @@ mock_connection.return_value = mock_server mock_server.mock_add_request( MockResponse('GET', - 'https://localhost:9000/bucket/?max-uploads=1000&prefix=&uploads=', + 'https://localhost:9000/bucket/?prefix=&uploads=', {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data)) client = Minio('localhost:9000') upload_iter = client._list_incomplete_uploads('bucket', '', True, False) @@ -102,7 +102,7 @@ mock_connection.return_value = mock_server mock_server.mock_add_request( MockResponse('GET', - 'https://localhost:9000/bucket/?delimiter=%2F&max-uploads=1000&prefix=&uploads=', + 'https://localhost:9000/bucket/?delimiter=%2F&prefix=&uploads=', {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data)) @@ -203,7 +203,7 @@ mock_connection.return_value = mock_server mock_server.mock_add_request( MockResponse('GET', - 'https://localhost:9000/bucket/?max-uploads=1000&prefix=&uploads=', + 'https://localhost:9000/bucket/?prefix=&uploads=', {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data1)) client = Minio('localhost:9000') @@ -213,7 +213,7 @@ mock_server.mock_add_request(MockResponse('GET', 'https://localhost:9000/bucket/?' 'key-marker=keymarker&' - 'max-uploads=1000&prefix=&' + 'prefix=&' 'upload-id-marker=uploadidmarker&uploads=', {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data2)) uploads.append(upload) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/tests/unit/list_objects_test.py new/minio-5.0.6/tests/unit/list_objects_test.py --- old/minio-5.0.1/tests/unit/list_objects_test.py 2019-09-18 23:07:19.000000000 +0200 +++ new/minio-5.0.6/tests/unit/list_objects_test.py 2019-12-30 20:59:25.000000000 +0100 @@ -40,7 +40,7 @@ mock_server = MockConnection() mock_connection.return_value = mock_server mock_server.mock_add_request(MockResponse('GET', - 'https://localhost:9000/bucket/?max-keys=1000&prefix=', + 'https://localhost:9000/bucket/?prefix=', {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data)) client = Minio('localhost:9000') bucket_iter = client.list_objects('bucket', recursive=True) @@ -87,7 +87,7 @@ mock_server = MockConnection() mock_connection.return_value = mock_server mock_server.mock_add_request(MockResponse('GET', - 'https://localhost:9000/bucket/?delimiter=%2F&max-keys=1000&prefix=', + 'https://localhost:9000/bucket/?delimiter=%2F&prefix=', {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data)) client = Minio('localhost:9000') bucket_iter = client.list_objects('bucket') @@ -95,7 +95,7 @@ for bucket in bucket_iter: # cause an xml exception and fail if we try retrieving again mock_server.mock_add_request(MockResponse('GET', - 'https://localhost:9000/bucket/?delimiter=%2F&max-keys=1000&prefix=', + 'https://localhost:9000/bucket/?delimiter=%2F&prefix=', {'User-Agent': _DEFAULT_USER_AGENT}, 200, content='')) buckets.append(bucket) @@ -172,13 +172,13 @@ mock_server = MockConnection() mock_connection.return_value = mock_server mock_server.mock_add_request(MockResponse('GET', - 'https://localhost:9000/bucket/?max-keys=1000&prefix=', + 'https://localhost:9000/bucket/?prefix=', {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data1)) client = Minio('localhost:9000') bucket_iter = client.list_objects('bucket', recursive=True) buckets = [] for bucket in bucket_iter: - url = 'https://localhost:9000/bucket/?marker=marker&max-keys=1000&prefix=' + url = 'https://localhost:9000/bucket/?marker=marker&prefix=' mock_server.mock_add_request(MockResponse('GET', url, {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data2)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/tests/unit/list_uploaded_parts_test.py new/minio-5.0.6/tests/unit/list_uploaded_parts_test.py --- old/minio-5.0.1/tests/unit/list_uploaded_parts_test.py 2019-09-18 23:07:19.000000000 +0200 +++ new/minio-5.0.6/tests/unit/list_uploaded_parts_test.py 2019-12-30 20:59:25.000000000 +0100 @@ -51,7 +51,7 @@ mock_connection.return_value = mock_server mock_server.mock_add_request( MockResponse('GET', - 'https://localhost:9000/bucket/key?max-parts=1000&uploadId=upload_id', + 'https://localhost:9000/bucket/key?uploadId=upload_id', {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data)) client = Minio('localhost:9000') @@ -98,7 +98,7 @@ mock_server = MockConnection() mock_connection.return_value = mock_server mock_server.mock_add_request(MockResponse('GET', - 'https://localhost:9000/bucket/key?max-parts=1000&uploadId=upload_id', + 'https://localhost:9000/bucket/key?uploadId=upload_id', {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data)) client = Minio('localhost:9000') @@ -179,7 +179,7 @@ mock_connection.return_value = mock_server mock_server.mock_add_request( MockResponse('GET', - 'https://localhost:9000/bucket/key?max-parts=1000&uploadId=upload_id', + 'https://localhost:9000/bucket/key?uploadId=upload_id', {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data1)) @@ -190,7 +190,7 @@ for part in part_iter: mock_server.mock_add_request( MockResponse('GET', - 'https://localhost:9000/bucket/key?max-parts=1000&part-number-marker=2&uploadId=upload_id', + 'https://localhost:9000/bucket/key?part-number-marker=2&uploadId=upload_id', {'User-Agent': _DEFAULT_USER_AGENT}, 200, content=mock_data2)) parts.append(part) eq_(4, len(parts)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minio-5.0.1/tests/unit/sign_test.py new/minio-5.0.6/tests/unit/sign_test.py --- old/minio-5.0.1/tests/unit/sign_test.py 2019-09-18 23:07:19.000000000 +0200 +++ new/minio-5.0.6/tests/unit/sign_test.py 2019-12-30 20:59:25.000000000 +0100 @@ -22,10 +22,11 @@ from minio.signer import (generate_canonical_request, generate_string_to_sign, generate_signing_key, generate_authorization_header, - presign_v4) + presign_v4, sign_v4) from minio.error import InvalidArgumentError from minio.compat import urlsplit, urlencode, queryencode from minio.fold_case_dict import FoldCaseDict +from minio.helpers import get_target_url empty_hash = 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' dt = datetime(2015, 6, 20, 1, 2, 3, 0, pytz.utc) @@ -116,6 +117,14 @@ def test_presigned_invalid_expires(self): presign_v4('GET', 'http://localhost:9000/hello', None, None, region=None, headers={}, expires=0) +class SignV4Test(TestCase): + def test_signv4(self): + # Construct target url. + url = get_target_url('http://localhost:9000', bucket_name='testbucket', + object_name='~testobject', bucket_region='us-east-1', query={'partID': '1', 'uploadID': '~abcd'}) + hdrs = sign_v4('PUT', url, 'us-east-1', access_key='minio', secret_key='minio123', request_datetime=dt) + eq_(hdrs['Authorization'], 'AWS4-HMAC-SHA256 Credential=minio/20150620/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=a2f4546f647981732bd90dfa5a7599c44dca92f44bea48ecc7565df06032c25b') + class UnicodeEncodeTest(TestCase): def test_unicode_urlencode(self): eq_(urlencode('/test/123/汉字'), '/test/123/%E6%B1%89%E5%AD%97')