Fix assorted typos
Change-Id: I54c018c7044224f0365f4f378cf75013e0746731
This commit is contained in:
		| @@ -116,7 +116,7 @@ class BaseAclHandler(object): | |||||||
|         """ |         """ | ||||||
|         General acl handling method. |         General acl handling method. | ||||||
|         This method expects to call Request._get_response() in outside of |         This method expects to call Request._get_response() in outside of | ||||||
|         this method so that this method returns resonse only when sw_method |         this method so that this method returns response only when sw_method | ||||||
|         is HEAD. |         is HEAD. | ||||||
|         """ |         """ | ||||||
|  |  | ||||||
| @@ -278,7 +278,7 @@ class MultiUploadAclHandler(BaseAclHandler): | |||||||
|     """ |     """ | ||||||
|     MultiUpload stuff requires acl checking just once for BASE container |     MultiUpload stuff requires acl checking just once for BASE container | ||||||
|     so that MultiUploadAclHandler extends BaseAclHandler to check acl only |     so that MultiUploadAclHandler extends BaseAclHandler to check acl only | ||||||
|     when the verb defined. We should define tThe verb as the first step to |     when the verb defined. We should define the verb as the first step to | ||||||
|     request to backend Swift at incoming request. |     request to backend Swift at incoming request. | ||||||
|  |  | ||||||
|     Basic Rules: |     Basic Rules: | ||||||
|   | |||||||
| @@ -189,7 +189,7 @@ class BucketController(Controller): | |||||||
|                 raise exc_type, exc_value, exc_traceback |                 raise exc_type, exc_value, exc_traceback | ||||||
|  |  | ||||||
|             if location != CONF.location: |             if location != CONF.location: | ||||||
|                 # Swift3 cannot support multiple reagions now. |                 # Swift3 cannot support multiple regions currently. | ||||||
|                 raise InvalidLocationConstraint() |                 raise InvalidLocationConstraint() | ||||||
|  |  | ||||||
|         resp = req.get_response(self.app) |         resp = req.get_response(self.app) | ||||||
|   | |||||||
| @@ -255,7 +255,7 @@ class UploadsController(Controller): | |||||||
|             return obj_dict |             return obj_dict | ||||||
|  |  | ||||||
|         # uploads is a list consists of dict, {key, upload_id, last_modified} |         # uploads is a list consists of dict, {key, upload_id, last_modified} | ||||||
|         # Note that pattern matcher willd drop whole segments objects like as |         # Note that pattern matcher will drop whole segments objects like as | ||||||
|         # object_name/upload_id/1. |         # object_name/upload_id/1. | ||||||
|         pattern = re.compile('/[0-9]+$') |         pattern = re.compile('/[0-9]+$') | ||||||
|         uploads = [object_to_upload(obj) for obj in objects if |         uploads = [object_to_upload(obj) for obj in objects if | ||||||
|   | |||||||
| @@ -32,7 +32,7 @@ class ObjectController(Controller): | |||||||
|     def _gen_head_range_resp(self, req_range, resp): |     def _gen_head_range_resp(self, req_range, resp): | ||||||
|         """ |         """ | ||||||
|         Swift doesn't handle Range header for HEAD requests. |         Swift doesn't handle Range header for HEAD requests. | ||||||
|         So, this mothod generates HEAD range response from HEAD response. |         So, this method generates HEAD range response from HEAD response. | ||||||
|         S3 return HEAD range response, if the value of range satisfies the |         S3 return HEAD range response, if the value of range satisfies the | ||||||
|         conditions which are described in the following document. |         conditions which are described in the following document. | ||||||
|         - http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35 |         - http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35 | ||||||
|   | |||||||
| @@ -38,7 +38,7 @@ class ServiceController(Controller): | |||||||
|         containers = filter( |         containers = filter( | ||||||
|             lambda item: validate_bucket_name(item['name']), containers) |             lambda item: validate_bucket_name(item['name']), containers) | ||||||
|  |  | ||||||
|         # we don't keep the creation time of a backet (s3cmd doesn't |         # we don't keep the creation time of a bucket (s3cmd doesn't | ||||||
|         # work without that) so we use something bogus. |         # work without that) so we use something bogus. | ||||||
|         elem = Element('ListAllMyBucketsResult') |         elem = Element('ListAllMyBucketsResult') | ||||||
|  |  | ||||||
|   | |||||||
| @@ -67,7 +67,7 @@ from swift.common.utils import get_logger, register_swift_info | |||||||
|  |  | ||||||
|  |  | ||||||
| class Swift3Middleware(object): | class Swift3Middleware(object): | ||||||
|     """Swift3 S3 compatibility midleware""" |     """Swift3 S3 compatibility middleware""" | ||||||
|     def __init__(self, app, conf, *args, **kwargs): |     def __init__(self, app, conf, *args, **kwargs): | ||||||
|         self.app = app |         self.app = app | ||||||
|         self.slo_enabled = conf['allow_multipart_uploads'] |         self.slo_enabled = conf['allow_multipart_uploads'] | ||||||
| @@ -132,7 +132,7 @@ class Swift3Middleware(object): | |||||||
|             self.slo_enabled = False |             self.slo_enabled = False | ||||||
|             LOGGER.warning('swift3 middleware requires SLO middleware ' |             LOGGER.warning('swift3 middleware requires SLO middleware ' | ||||||
|                            'to support multi-part upload, please add it ' |                            'to support multi-part upload, please add it ' | ||||||
|                            'in pipline') |                            'in pipeline') | ||||||
|  |  | ||||||
|         if not conf.auth_pipeline_check: |         if not conf.auth_pipeline_check: | ||||||
|             LOGGER.debug('Skip pipeline auth check.') |             LOGGER.debug('Skip pipeline auth check.') | ||||||
|   | |||||||
| @@ -396,7 +396,7 @@ class Request(swob.Request): | |||||||
|         if not self._timestamp: |         if not self._timestamp: | ||||||
|             try: |             try: | ||||||
|                 if self._is_query_auth and 'Timestamp' in self.params: |                 if self._is_query_auth and 'Timestamp' in self.params: | ||||||
|                     # If Timestamp speciied in query, it should be prior |                     # If Timestamp specified in query, it should be prior | ||||||
|                     # to any Date header (is this right?) |                     # to any Date header (is this right?) | ||||||
|                     timestamp = mktime( |                     timestamp = mktime( | ||||||
|                         self.params['Timestamp'], SIGV2_TIMESTAMP_FORMAT) |                         self.params['Timestamp'], SIGV2_TIMESTAMP_FORMAT) | ||||||
| @@ -1215,7 +1215,7 @@ class S3AclRequest(Request): | |||||||
|             self, container, obj, headers) |             self, container, obj, headers) | ||||||
|         resp = acl_handler.handle_acl(app, method) |         resp = acl_handler.handle_acl(app, method) | ||||||
|  |  | ||||||
|         # possible to skip recalling get_resposne_acl if resp is not |         # possible to skip recalling get_response_acl if resp is not | ||||||
|         # None (e.g. HEAD) |         # None (e.g. HEAD) | ||||||
|         if resp: |         if resp: | ||||||
|             return resp |             return resp | ||||||
|   | |||||||
| @@ -186,7 +186,7 @@ class Grantee(object): | |||||||
|         elif type == 'emailAddress': |         elif type == 'emailAddress': | ||||||
|             raise S3NotImplemented() |             raise S3NotImplemented() | ||||||
|         elif type == 'uri': |         elif type == 'uri': | ||||||
|             # retrun a subclass instance of Group class |             # return a subclass instance of Group class | ||||||
|             subclass = get_group_subclass_from_uri(value) |             subclass = get_group_subclass_from_uri(value) | ||||||
|             return subclass() |             return subclass() | ||||||
|         else: |         else: | ||||||
|   | |||||||
| @@ -97,7 +97,7 @@ class Connection(object): | |||||||
|         :param body: a string of data binary sent to S3 as a request body |         :param body: a string of data binary sent to S3 as a request body | ||||||
|         :param query: a string of HTTP query argument |         :param query: a string of HTTP query argument | ||||||
|  |  | ||||||
|         :returns: a tuple of (int(status_code), headers dict, resposne body) |         :returns: a tuple of (int(status_code), headers dict, response body) | ||||||
|         """ |         """ | ||||||
|         response = \ |         response = \ | ||||||
|             self.conn.make_request(method, bucket=bucket, key=obj, |             self.conn.make_request(method, bucket=bucket, key=obj, | ||||||
|   | |||||||
| @@ -51,7 +51,7 @@ class TestSwift3Bucket(Swift3FunctionalTestCase): | |||||||
|         self.assertTrue(headers['content-type'] is not None) |         self.assertTrue(headers['content-type'] is not None) | ||||||
|         self.assertEqual(headers['content-length'], str(len(body))) |         self.assertEqual(headers['content-length'], str(len(body))) | ||||||
|         # TODO; requires consideration |         # TODO; requires consideration | ||||||
|         # self.assertEquasl(headers['transfer-encoding'], 'chunked') |         # self.assertEqual(headers['transfer-encoding'], 'chunked') | ||||||
|  |  | ||||||
|         elem = fromstring(body, 'ListBucketResult') |         elem = fromstring(body, 'ListBucketResult') | ||||||
|         self.assertEqual(elem.find('Name').text, bucket) |         self.assertEqual(elem.find('Name').text, bucket) | ||||||
| @@ -100,7 +100,7 @@ class TestSwift3Bucket(Swift3FunctionalTestCase): | |||||||
|         self.assertTrue(headers['content-type'] is not None) |         self.assertTrue(headers['content-type'] is not None) | ||||||
|         self.assertEqual(headers['content-length'], str(len(body))) |         self.assertEqual(headers['content-length'], str(len(body))) | ||||||
|         # TODO; requires consideration |         # TODO; requires consideration | ||||||
|         # self.assertEquasl(headers['transfer-encoding'], 'chunked') |         # self.assertEqual(headers['transfer-encoding'], 'chunked') | ||||||
|  |  | ||||||
|         # DELETE Bucket |         # DELETE Bucket | ||||||
|         for obj in req_objects: |         for obj in req_objects: | ||||||
| @@ -289,17 +289,17 @@ class TestSwift3Bucket(Swift3FunctionalTestCase): | |||||||
|         status, headers, body = \ |         status, headers, body = \ | ||||||
|             self.conn.make_request('HEAD', 'bucket+invalid') |             self.conn.make_request('HEAD', 'bucket+invalid') | ||||||
|         self.assertEqual(status, 400) |         self.assertEqual(status, 400) | ||||||
|         self.assertEqual(body, '')  # sanifty |         self.assertEqual(body, '')  # sanity | ||||||
|  |  | ||||||
|         auth_error_conn = Connection(aws_secret_key='invalid') |         auth_error_conn = Connection(aws_secret_key='invalid') | ||||||
|         status, headers, body = \ |         status, headers, body = \ | ||||||
|             auth_error_conn.make_request('HEAD', 'bucket') |             auth_error_conn.make_request('HEAD', 'bucket') | ||||||
|         self.assertEqual(status, 403) |         self.assertEqual(status, 403) | ||||||
|         self.assertEqual(body, '')  # sanifty |         self.assertEqual(body, '')  # sanity | ||||||
|  |  | ||||||
|         status, headers, body = self.conn.make_request('HEAD', 'nothing') |         status, headers, body = self.conn.make_request('HEAD', 'nothing') | ||||||
|         self.assertEqual(status, 404) |         self.assertEqual(status, 404) | ||||||
|         self.assertEqual(body, '')  # sanifty |         self.assertEqual(body, '')  # sanity | ||||||
|  |  | ||||||
|     def test_delete_bucket_error(self): |     def test_delete_bucket_error(self): | ||||||
|         status, headers, body = \ |         status, headers, body = \ | ||||||
|   | |||||||
| @@ -202,7 +202,7 @@ class TestSwift3MultiUpload(Swift3FunctionalTestCase): | |||||||
|  |  | ||||||
|         elem = fromstring(body, 'ListPartsResult') |         elem = fromstring(body, 'ListPartsResult') | ||||||
|  |  | ||||||
|         # FIXME: COPY result drops mili/microseconds but GET doesn't |         # FIXME: COPY result drops milli/microseconds but GET doesn't | ||||||
|         last_modified_gets = [p.find('LastModified').text |         last_modified_gets = [p.find('LastModified').text | ||||||
|                               for p in elem.iterfind('Part')] |                               for p in elem.iterfind('Part')] | ||||||
|         self.assertEqual( |         self.assertEqual( | ||||||
| @@ -248,7 +248,7 @@ class TestSwift3MultiUpload(Swift3FunctionalTestCase): | |||||||
|             self.assertTrue(last_modified is not None) |             self.assertTrue(last_modified is not None) | ||||||
|             # TODO: sanity check |             # TODO: sanity check | ||||||
|             #       (kota_) How do we check the sanity? |             #       (kota_) How do we check the sanity? | ||||||
|             #       the last-modified header drops mili-seconds info |             #       the last-modified header drops milli-seconds info | ||||||
|             #       by the constraint of the format. |             #       by the constraint of the format. | ||||||
|             #       For now, we can do either the format check or round check |             #       For now, we can do either the format check or round check | ||||||
|             # last_modified_from_xml = mktime(last_modified) |             # last_modified_from_xml = mktime(last_modified) | ||||||
| @@ -501,7 +501,7 @@ class TestSwift3MultiUpload(Swift3FunctionalTestCase): | |||||||
|                                    query=query) |                                    query=query) | ||||||
|         self.assertEqual(get_error_code(body), 'MalformedXML') |         self.assertEqual(get_error_code(body), 'MalformedXML') | ||||||
|  |  | ||||||
|         # with ivalid etag in xml |         # with invalid etag in xml | ||||||
|         invalid_etag = 'invalid' |         invalid_etag = 'invalid' | ||||||
|         xml = self._gen_comp_xml([invalid_etag]) |         xml = self._gen_comp_xml([invalid_etag]) | ||||||
|         status, headers, body = \ |         status, headers, body = \ | ||||||
| @@ -613,7 +613,7 @@ class TestSwift3MultiUpload(Swift3FunctionalTestCase): | |||||||
|  |  | ||||||
|         elem = fromstring(body, 'ListPartsResult') |         elem = fromstring(body, 'ListPartsResult') | ||||||
|  |  | ||||||
|         # FIXME: COPY result drops mili/microseconds but GET doesn't |         # FIXME: COPY result drops milli/microseconds but GET doesn't | ||||||
|         last_modified_gets = [p.find('LastModified').text |         last_modified_gets = [p.find('LastModified').text | ||||||
|                               for p in elem.iterfind('Part')] |                               for p in elem.iterfind('Part')] | ||||||
|         self.assertEqual( |         self.assertEqual( | ||||||
| @@ -630,7 +630,7 @@ class TestSwift3MultiUpload(Swift3FunctionalTestCase): | |||||||
|         status, headers, body = \ |         status, headers, body = \ | ||||||
|             self.conn.make_request('DELETE', bucket, key, query=query) |             self.conn.make_request('DELETE', bucket, key, query=query) | ||||||
|  |  | ||||||
|         # sanities |         # sanity checks | ||||||
|         self.assertEqual(status, 204) |         self.assertEqual(status, 204) | ||||||
|         self.assertCommonResponseHeaders(headers) |         self.assertCommonResponseHeaders(headers) | ||||||
|         self.assertTrue('content-type' in headers) |         self.assertTrue('content-type' in headers) | ||||||
|   | |||||||
| @@ -100,7 +100,7 @@ class TestSwift3Object(Swift3FunctionalTestCase): | |||||||
|         self.assertEqual(status, 200) |         self.assertEqual(status, 200) | ||||||
|         elem = fromstring(body, 'ListBucketResult') |         elem = fromstring(body, 'ListBucketResult') | ||||||
|  |  | ||||||
|         # FIXME: COPY result drops mili/microseconds but GET doesn't |         # FIXME: COPY result drops milli/microseconds but GET doesn't | ||||||
|         self.assertEqual( |         self.assertEqual( | ||||||
|             elem.find('Contents').find("LastModified").text.rsplit('.', 1)[0], |             elem.find('Contents').find("LastModified").text.rsplit('.', 1)[0], | ||||||
|             last_modified_xml.rsplit('.', 1)[0]) |             last_modified_xml.rsplit('.', 1)[0]) | ||||||
| @@ -207,19 +207,19 @@ class TestSwift3Object(Swift3FunctionalTestCase): | |||||||
|         status, headers, body = \ |         status, headers, body = \ | ||||||
|             auth_error_conn.make_request('HEAD', self.bucket, obj) |             auth_error_conn.make_request('HEAD', self.bucket, obj) | ||||||
|         self.assertEqual(status, 403) |         self.assertEqual(status, 403) | ||||||
|         self.assertEqual(body, '')  # sanifty |         self.assertEqual(body, '')  # sanity | ||||||
|         self.assertEqual(headers['content-type'], 'application/xml') |         self.assertEqual(headers['content-type'], 'application/xml') | ||||||
|  |  | ||||||
|         status, headers, body = \ |         status, headers, body = \ | ||||||
|             self.conn.make_request('HEAD', self.bucket, 'invalid') |             self.conn.make_request('HEAD', self.bucket, 'invalid') | ||||||
|         self.assertEqual(status, 404) |         self.assertEqual(status, 404) | ||||||
|         self.assertEqual(body, '')  # sanifty |         self.assertEqual(body, '')  # sanity | ||||||
|         self.assertEqual(headers['content-type'], 'application/xml') |         self.assertEqual(headers['content-type'], 'application/xml') | ||||||
|  |  | ||||||
|         status, headers, body = \ |         status, headers, body = \ | ||||||
|             self.conn.make_request('HEAD', 'invalid', obj) |             self.conn.make_request('HEAD', 'invalid', obj) | ||||||
|         self.assertEqual(status, 404) |         self.assertEqual(status, 404) | ||||||
|         self.assertEqual(body, '')  # sanifty |         self.assertEqual(body, '')  # sanity | ||||||
|         self.assertEqual(headers['content-type'], 'application/xml') |         self.assertEqual(headers['content-type'], 'application/xml') | ||||||
|  |  | ||||||
|     def test_delete_object_error(self): |     def test_delete_object_error(self): | ||||||
|   | |||||||
| @@ -34,7 +34,7 @@ class TestSwift3Service(Swift3FunctionalTestCase): | |||||||
|         self.assertCommonResponseHeaders(headers) |         self.assertCommonResponseHeaders(headers) | ||||||
|         self.assertTrue(headers['content-type'] is not None) |         self.assertTrue(headers['content-type'] is not None) | ||||||
|         # TODO; requires consideration |         # TODO; requires consideration | ||||||
|         # self.assertEquasl(headers['transfer-encoding'], 'chunked') |         # self.assertEqual(headers['transfer-encoding'], 'chunked') | ||||||
|  |  | ||||||
|         elem = fromstring(body, 'ListAllMyBucketsResult') |         elem = fromstring(body, 'ListAllMyBucketsResult') | ||||||
|         buckets = elem.findall('./Buckets/Bucket') |         buckets = elem.findall('./Buckets/Bucket') | ||||||
|   | |||||||
| @@ -91,7 +91,7 @@ class TestSwift3Bucket(Swift3TestCase): | |||||||
|                                      'Date': self.get_date_header()}) |                                      'Date': self.get_date_header()}) | ||||||
|         status, headers, body = self.call_swift3(req) |         status, headers, body = self.call_swift3(req) | ||||||
|         self.assertEqual(status.split()[0], '404') |         self.assertEqual(status.split()[0], '404') | ||||||
|         self.assertEqual(body, '')  # sanifty |         self.assertEqual(body, '')  # sanity | ||||||
|  |  | ||||||
|     def test_bucket_HEAD_slash(self): |     def test_bucket_HEAD_slash(self): | ||||||
|         req = Request.blank('/junk/', |         req = Request.blank('/junk/', | ||||||
| @@ -470,7 +470,7 @@ class TestSwift3Bucket(Swift3TestCase): | |||||||
|  |  | ||||||
|     @s3acl |     @s3acl | ||||||
|     def test_bucket_DELETE_error_while_segment_bucket_delete(self): |     def test_bucket_DELETE_error_while_segment_bucket_delete(self): | ||||||
|         # An error occured while deleting segment objects |         # An error occurred while deleting segment objects | ||||||
|         self.swift.register('DELETE', '/v1/AUTH_test/bucket+segments/lily', |         self.swift.register('DELETE', '/v1/AUTH_test/bucket+segments/lily', | ||||||
|                             swob.HTTPServiceUnavailable, {}, json.dumps([])) |                             swob.HTTPServiceUnavailable, {}, json.dumps([])) | ||||||
|         # overwrite default HEAD to return x-container-object-count |         # overwrite default HEAD to return x-container-object-count | ||||||
| @@ -486,7 +486,7 @@ class TestSwift3Bucket(Swift3TestCase): | |||||||
|         self.assertEqual(status.split()[0], '503') |         self.assertEqual(status.split()[0], '503') | ||||||
|         called = [(method, path) for method, path, _ in |         called = [(method, path) for method, path, _ in | ||||||
|                   self.swift.calls_with_headers] |                   self.swift.calls_with_headers] | ||||||
|         # Don't delete original bucket when error occured in segment container |         # Don't delete original bucket when error occurred in segment container | ||||||
|         self.assertNotIn(('DELETE', '/v1/AUTH_test/bucket'), called) |         self.assertNotIn(('DELETE', '/v1/AUTH_test/bucket'), called) | ||||||
|  |  | ||||||
|     def _test_bucket_for_s3acl(self, method, account): |     def _test_bucket_for_s3acl(self, method, account): | ||||||
|   | |||||||
| @@ -810,7 +810,7 @@ class TestSwift3Middleware(Swift3TestCase): | |||||||
|         req.content_type = 'text/plain' |         req.content_type = 'text/plain' | ||||||
|         status, headers, body = self.call_swift3(req) |         status, headers, body = self.call_swift3(req) | ||||||
|         # FIXME: should this failed as 400 or pass via query auth? |         # FIXME: should this failed as 400 or pass via query auth? | ||||||
|         # for now, 403 forbbiden for safety |         # for now, 403 forbidden for safety | ||||||
|         self.assertEqual(status.split()[0], '403', body) |         self.assertEqual(status.split()[0], '403', body) | ||||||
|  |  | ||||||
|         # But if we are missing Signature in query param |         # But if we are missing Signature in query param | ||||||
|   | |||||||
| @@ -130,32 +130,32 @@ class TestSwift3Obj(Swift3TestCase): | |||||||
|                             swob.HTTPUnauthorized, {}, None) |                             swob.HTTPUnauthorized, {}, None) | ||||||
|         status, headers, body = self.call_swift3(req) |         status, headers, body = self.call_swift3(req) | ||||||
|         self.assertEqual(status.split()[0], '403') |         self.assertEqual(status.split()[0], '403') | ||||||
|         self.assertEqual(body, '')  # sanifty |         self.assertEqual(body, '')  # sanity | ||||||
|         self.swift.register('HEAD', '/v1/AUTH_test/bucket/object', |         self.swift.register('HEAD', '/v1/AUTH_test/bucket/object', | ||||||
|                             swob.HTTPForbidden, {}, None) |                             swob.HTTPForbidden, {}, None) | ||||||
|         status, headers, body = self.call_swift3(req) |         status, headers, body = self.call_swift3(req) | ||||||
|         self.assertEqual(status.split()[0], '403') |         self.assertEqual(status.split()[0], '403') | ||||||
|         self.assertEqual(body, '')  # sanifty |         self.assertEqual(body, '')  # sanity | ||||||
|         self.swift.register('HEAD', '/v1/AUTH_test/bucket/object', |         self.swift.register('HEAD', '/v1/AUTH_test/bucket/object', | ||||||
|                             swob.HTTPNotFound, {}, None) |                             swob.HTTPNotFound, {}, None) | ||||||
|         status, headers, body = self.call_swift3(req) |         status, headers, body = self.call_swift3(req) | ||||||
|         self.assertEqual(status.split()[0], '404') |         self.assertEqual(status.split()[0], '404') | ||||||
|         self.assertEqual(body, '')  # sanifty |         self.assertEqual(body, '')  # sanity | ||||||
|         self.swift.register('HEAD', '/v1/AUTH_test/bucket/object', |         self.swift.register('HEAD', '/v1/AUTH_test/bucket/object', | ||||||
|                             swob.HTTPPreconditionFailed, {}, None) |                             swob.HTTPPreconditionFailed, {}, None) | ||||||
|         status, headers, body = self.call_swift3(req) |         status, headers, body = self.call_swift3(req) | ||||||
|         self.assertEqual(status.split()[0], '412') |         self.assertEqual(status.split()[0], '412') | ||||||
|         self.assertEqual(body, '')  # sanifty |         self.assertEqual(body, '')  # sanity | ||||||
|         self.swift.register('HEAD', '/v1/AUTH_test/bucket/object', |         self.swift.register('HEAD', '/v1/AUTH_test/bucket/object', | ||||||
|                             swob.HTTPServerError, {}, None) |                             swob.HTTPServerError, {}, None) | ||||||
|         status, headers, body = self.call_swift3(req) |         status, headers, body = self.call_swift3(req) | ||||||
|         self.assertEqual(status.split()[0], '500') |         self.assertEqual(status.split()[0], '500') | ||||||
|         self.assertEqual(body, '')  # sanifty |         self.assertEqual(body, '')  # sanity | ||||||
|         self.swift.register('HEAD', '/v1/AUTH_test/bucket/object', |         self.swift.register('HEAD', '/v1/AUTH_test/bucket/object', | ||||||
|                             swob.HTTPServiceUnavailable, {}, None) |                             swob.HTTPServiceUnavailable, {}, None) | ||||||
|         status, headers, body = self.call_swift3(req) |         status, headers, body = self.call_swift3(req) | ||||||
|         self.assertEqual(status.split()[0], '500') |         self.assertEqual(status.split()[0], '500') | ||||||
|         self.assertEqual(body, '')  # sanifty |         self.assertEqual(body, '')  # sanity | ||||||
|  |  | ||||||
|     def test_object_HEAD(self): |     def test_object_HEAD(self): | ||||||
|         self._test_object_GETorHEAD('HEAD') |         self._test_object_GETorHEAD('HEAD') | ||||||
|   | |||||||
| @@ -48,7 +48,7 @@ def s3acl(func=None, s3acl_only=False): | |||||||
|  |  | ||||||
|         def call_func(failing_point=''): |         def call_func(failing_point=''): | ||||||
|             try: |             try: | ||||||
|                 # For maintainancibility, we patch 204 status for every |                 # For maintainability, we patch 204 status for every | ||||||
|                 # get_container_info. if you want, we can rewrite the |                 # get_container_info. if you want, we can rewrite the | ||||||
|                 # statement easily with nested decorator like as: |                 # statement easily with nested decorator like as: | ||||||
|                 # |                 # | ||||||
|   | |||||||
| @@ -87,13 +87,13 @@ class TestSwift3Utils(unittest.TestCase): | |||||||
|         # integer |         # integer | ||||||
|         ts = utils.S3Timestamp(1) |         ts = utils.S3Timestamp(1) | ||||||
|         self.assertEqual(expected, ts.s3xmlformat) |         self.assertEqual(expected, ts.s3xmlformat) | ||||||
|         # miliseconds unit should be floored |         # milliseconds unit should be floored | ||||||
|         ts = utils.S3Timestamp(1.1) |         ts = utils.S3Timestamp(1.1) | ||||||
|         self.assertEqual(expected, ts.s3xmlformat) |         self.assertEqual(expected, ts.s3xmlformat) | ||||||
|         # float (microseconds) should be floored too |         # float (microseconds) should be floored too | ||||||
|         ts = utils.S3Timestamp(1.000001) |         ts = utils.S3Timestamp(1.000001) | ||||||
|         self.assertEqual(expected, ts.s3xmlformat) |         self.assertEqual(expected, ts.s3xmlformat) | ||||||
|         # Bigger float (miliseconds) should be floored too |         # Bigger float (milliseconds) should be floored too | ||||||
|         ts = utils.S3Timestamp(1.9) |         ts = utils.S3Timestamp(1.9) | ||||||
|         self.assertEqual(expected, ts.s3xmlformat) |         self.assertEqual(expected, ts.s3xmlformat) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -161,13 +161,13 @@ def mktime(timestamp_str, time_format='%Y-%m-%dT%H:%M:%S'): | |||||||
|     mktime creates a float instance in epoch time really like as time.mktime |     mktime creates a float instance in epoch time really like as time.mktime | ||||||
|  |  | ||||||
|     the difference from time.mktime is allowing to 2 formats string for the |     the difference from time.mktime is allowing to 2 formats string for the | ||||||
|     argumtent for the S3 testing usage. |     argument for the S3 testing usage. | ||||||
|     TODO: support |     TODO: support | ||||||
|  |  | ||||||
|     :param timestamp_str: a string of timestamp formatted as |     :param timestamp_str: a string of timestamp formatted as | ||||||
|                           (a) RFC2822 (e.g. date header) |                           (a) RFC2822 (e.g. date header) | ||||||
|                           (b) %Y-%m-%dT%H:%M:%S (e.g. copy result) |                           (b) %Y-%m-%dT%H:%M:%S (e.g. copy result) | ||||||
|     :param time_format: a string of format to parase in (b) process |     :param time_format: a string of format to parse in (b) process | ||||||
|     :return : a float instance in epoch time |     :return : a float instance in epoch time | ||||||
|     """ |     """ | ||||||
|     try: |     try: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Tim Burke
					Tim Burke