libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [05/20] libcloud git commit: remove OSS code paths that are unreachable
Date Fri, 05 May 2017 11:46:24 GMT
remove OSS code paths that are unreachable


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/01c3a944
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/01c3a944
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/01c3a944

Branch: refs/heads/trunk
Commit: 01c3a944e4b4b6ce983982ad0a7784be9fc2c55d
Parents: cc6812d
Author: Anthony Shaw <anthonyshaw@apache.org>
Authored: Fri May 5 15:27:51 2017 +1000
Committer: Anthony Shaw <anthonyshaw@apache.org>
Committed: Fri May 5 15:27:51 2017 +1000

----------------------------------------------------------------------
 libcloud/test/storage/test_oss.py | 119 +--------------------------------
 1 file changed, 2 insertions(+), 117 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/01c3a944/libcloud/test/storage/test_oss.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_oss.py b/libcloud/test/storage/test_oss.py
index e796c03..8547880 100644
--- a/libcloud/test/storage/test_oss.py
+++ b/libcloud/test/storage/test_oss.py
@@ -235,61 +235,7 @@ class OSSMockHttp(MockHttp, unittest.TestCase):
                 body,
                 headers,
                 httplib.responses[httplib.OK])
-
-    def _foo_test_stream_data_multipart_HASH(self, method, url, body, headers):
-        headers = {'etag': '"0cc175b9c0f1b6a831c399e269772661"'}
-        TEST_UPLOAD_ID = '0004B9894A22E5B1888A1E29F8236E2D'
-
-        query_string = urlparse.urlsplit(url).query
-        query = parse_qs(query_string)
-
-        if not query.get('uploadId', False):
-            self.fail('Request doesnt contain uploadId query parameter')
-
-        upload_id = query['uploadId'][0]
-        if upload_id != TEST_UPLOAD_ID:
-            self.fail('first uploadId doesnt match')
-
-        if method == 'PUT':
-            # PUT is used for uploading the part. part number is mandatory
-            if not query.get('partNumber', False):
-                self.fail('Request is missing partNumber query parameter')
-
-            body = ''
-            return (httplib.OK,
-                    body,
-                    headers,
-                    httplib.responses[httplib.OK])
-
-        elif method == 'DELETE':
-            # DELETE is done for aborting the upload
-            body = ''
-            return (httplib.NO_CONTENT,
-                    body,
-                    headers,
-                    httplib.responses[httplib.NO_CONTENT])
-
-        else:
-            commit = ET.fromstring(body)
-            count = 0
-
-            for part in commit.findall('Part'):
-                count += 1
-                part_no = part.find('PartNumber').text
-                etag = part.find('ETag').text
-
-                self.assertEqual(part_no, str(count))
-                self.assertEqual(etag, headers['etag'])
-
-            # Make sure that manifest contains at least one part
-            self.assertTrue(count >= 1)
-
-            body = self.fixtures.load('complete_multipart_upload.xml')
-            return (httplib.OK,
-                    body,
-                    headers,
-                    httplib.responses[httplib.OK])
-
+  
     def _list_multipart(self, method, url, body, headers):
         query_string = urlparse.urlsplit(url).query
         query = parse_qs(query_string)
@@ -304,22 +250,6 @@ class OSSMockHttp(MockHttp, unittest.TestCase):
                 headers,
                 httplib.responses[httplib.OK])
 
-    def parse_body(self):
-        if len(self.body) == 0 and not self.parse_zero_length_body:
-            return self.body
-
-        try:
-            if PY3:
-                parser = ET.XMLParser(encoding='utf-8')
-                body = ET.XML(self.body.encode('utf-8'), parser=parser)
-            else:
-                body = ET.XML(self.body)
-        except:
-            raise MalformedResponseError("Failed to parse XML",
-                                         body=self.body,
-                                         driver=self.connection.driver)
-        return body
-
     def _foo_bar_object(self, method, url, body, headers):
         # test_download_object_success
         body = generate_random_data(1000)
@@ -336,36 +266,8 @@ class OSSMockHttp(MockHttp, unittest.TestCase):
                 headers,
                 httplib.responses[httplib.OK])
 
-    def _foo_test_upload_invalid_hash1(self, method, url, body, headers):
-        body = ''
+    def _foo_test_stream_data_multipart(self, method, url, body, headers):
         headers = {}
-        headers['etag'] = '"foobar"'
-        # test_upload_object_invalid_hash1
-        return (httplib.OK,
-                body,
-                headers,
-                httplib.responses[httplib.OK])
-
-    def _foo_test_upload(self, method, url, body, headers):
-        # test_upload_object_success
-        body = ''
-        headers = {'etag': '"0CC175B9C0F1B6A831C399E269772661"'}
-        return (httplib.OK,
-                body,
-                headers,
-                httplib.responses[httplib.OK])
-
-    def _foo_test_upload_acl(self, method, url, body, headers):
-        # test_upload_object_with_acl
-        body = ''
-        headers = {'etag': '"0CC175B9C0F1B6A831C399E269772661"'}
-        return (httplib.OK,
-                body,
-                headers,
-                httplib.responses[httplib.OK])
-
-    def _foo_test_stream_data(self, method, url, body, headers):
-        # test_upload_object_via_stream
         body = ''
         headers = {'etag': '"0cc175b9c0f1b6a831c399e269772661"'}
         return (httplib.OK,
@@ -373,23 +275,6 @@ class OSSMockHttp(MockHttp, unittest.TestCase):
                 headers,
                 httplib.responses[httplib.OK])
 
-    def _foo_test_stream_data_multipart(self, method, url, body, headers):
-        headers = {}
-        # POST is done for initiating multipart upload
-        if method == 'POST':
-            body = self.fixtures.load('initiate_multipart_upload.xml')
-            return (httplib.OK,
-                    body,
-                    headers,
-                    httplib.responses[httplib.OK])
-        else:
-            body = ''
-            headers = {'etag': '"0cc175b9c0f1b6a831c399e269772661"'}
-            return (httplib.OK,
-                    body,
-                    headers,
-                    httplib.responses[httplib.OK])
-
 
 class OSSStorageDriverTestCase(unittest.TestCase):
     driver_type = OSSStorageDriver


Mime
View raw message