libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [36/46] libcloud git commit: linting fixes
Date Thu, 13 Apr 2017 09:33:42 GMT
linting fixes


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

Branch: refs/heads/trunk
Commit: 4f694b20b8d102c16915b1e5eb6006a8d4f76e6c
Parents: 5732852
Author: Anthony Shaw <anthonyshaw@apache.org>
Authored: Thu Apr 13 12:26:03 2017 +1000
Committer: Anthony Shaw <anthonyshaw@apache.org>
Committed: Thu Apr 13 12:26:03 2017 +1000

----------------------------------------------------------------------
 libcloud/test/__init__.py                        |  6 ++----
 libcloud/test/compute/__init__.py                |  1 -
 libcloud/test/compute/test_abiquo.py             |  4 ++--
 libcloud/test/compute/test_base.py               |  1 -
 libcloud/test/compute/test_dimensiondata_v2_4.py |  1 -
 libcloud/test/compute/test_opennebula.py         |  4 ----
 libcloud/test/compute/test_openstack.py          |  5 ++---
 libcloud/test/storage/test_atmos.py              | 11 -----------
 libcloud/test/storage/test_azure_blobs.py        | 13 +------------
 libcloud/test/storage/test_backblaze_b2.py       | 15 ++++-----------
 libcloud/test/storage/test_cloudfiles.py         | 15 ++-------------
 libcloud/test/storage/test_oss.py                |  9 +--------
 libcloud/test/storage/test_s3.py                 | 16 +++-------------
 13 files changed, 17 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4f694b20/libcloud/test/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/test/__init__.py b/libcloud/test/__init__.py
index 578b064..6691766 100644
--- a/libcloud/test/__init__.py
+++ b/libcloud/test/__init__.py
@@ -13,11 +13,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import sys
 import random
 import requests
 from libcloud.common.base import Response
-from libcloud.http import HttpLibResponseProxy
 from libcloud.http import LibcloudConnection
 from libcloud.utils.py3 import PY2
 
@@ -28,7 +26,7 @@ else:
 
 import requests_mock
 
-from libcloud.utils.py3 import (httplib, u)
+from libcloud.utils.py3 import httplib
 from libcloud.utils.py3 import urlparse
 from libcloud.utils.py3 import parse_qs
 from libcloud.utils.py3 import parse_qsl
@@ -118,7 +116,7 @@ class MockHttp(LibcloudConnection):
         super(MockHttp, self).__init__(*args, **kwargs)
 
     def _get_request(self, method, url, body=None, headers=None):
-         # Find a method we can use for this request
+        # Find a method we can use for this request
         parsed = urlparse.urlparse(url)
         _, _, path, _, query, _ = parsed
         qs = parse_qs(query)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4f694b20/libcloud/test/compute/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/__init__.py b/libcloud/test/compute/__init__.py
index 3b66846..7cfbc11 100644
--- a/libcloud/test/compute/__init__.py
+++ b/libcloud/test/compute/__init__.py
@@ -15,7 +15,6 @@
 
 from libcloud.compute.base import Node, NodeImage, NodeLocation, StorageVolume
 from libcloud.pricing import get_pricing
-from libcloud.test import unittest
 
 
 class TestCaseMixin():

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4f694b20/libcloud/test/compute/test_abiquo.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_abiquo.py b/libcloud/test/compute/test_abiquo.py
index 3141aa0..de95760 100644
--- a/libcloud/test/compute/test_abiquo.py
+++ b/libcloud/test/compute/test_abiquo.py
@@ -29,7 +29,7 @@ from libcloud.common.abiquo import ForbiddenError, get_href
 from libcloud.common.types import InvalidCredsError, LibcloudError
 from libcloud.compute.base import NodeLocation, NodeImage
 from libcloud.test.compute import TestCaseMixin
-from libcloud.test import MockHttp
+from libcloud.test import MockHttp, unittest
 from libcloud.test.file_fixtures import ComputeFileFixtures
 
 
@@ -45,7 +45,7 @@ class AbiquoNodeDriverTest(TestCaseMixin):
         """
         AbiquoNodeDriver.connectionCls.conn_class = AbiquoMockHttp
         cls.driver = AbiquoNodeDriver('son', 'goku',
-                                       'http://dummy.host.com/api')
+                                      'http://dummy.host.com/api')
 
     def test_unauthorized_controlled(self):
         """

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4f694b20/libcloud/test/compute/test_base.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_base.py b/libcloud/test/compute/test_base.py
index aa506b0..c3053c0 100644
--- a/libcloud/test/compute/test_base.py
+++ b/libcloud/test/compute/test_base.py
@@ -15,7 +15,6 @@
 import sys
 import unittest
 
-from libcloud.common.base import Response
 from libcloud.common.base import Connection, ConnectionKey, ConnectionUserAndKey
 from libcloud.common.types import LibcloudError
 from libcloud.compute.base import Node, NodeSize, NodeImage, NodeDriver, StorageVolume

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4f694b20/libcloud/test/compute/test_dimensiondata_v2_4.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_dimensiondata_v2_4.py b/libcloud/test/compute/test_dimensiondata_v2_4.py
index d9997e6..73c6b43 100644
--- a/libcloud/test/compute/test_dimensiondata_v2_4.py
+++ b/libcloud/test/compute/test_dimensiondata_v2_4.py
@@ -34,7 +34,6 @@ from libcloud.compute.drivers.dimensiondata import DimensionDataNodeDriver
as Di
 from libcloud.compute.drivers.dimensiondata import DimensionDataNic
 from libcloud.compute.base import Node, NodeAuthPassword, NodeLocation
 from libcloud.test import MockHttp, unittest
-from libcloud.test.compute import TestCaseMixin
 from libcloud.test.file_fixtures import ComputeFileFixtures
 from libcloud.test.secrets import DIMENSIONDATA_PARAMS
 from libcloud.utils.xml import fixxpath, findtext, findall

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4f694b20/libcloud/test/compute/test_opennebula.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_opennebula.py b/libcloud/test/compute/test_opennebula.py
index 368fae2..beae4be 100644
--- a/libcloud/test/compute/test_opennebula.py
+++ b/libcloud/test/compute/test_opennebula.py
@@ -30,15 +30,11 @@ from libcloud.utils.py3 import httplib
 from libcloud.compute.base import Node, NodeImage, NodeSize, NodeState
 from libcloud.compute.drivers.opennebula import OpenNebulaNodeDriver
 from libcloud.compute.drivers.opennebula import OpenNebulaNetwork
-from libcloud.compute.drivers.opennebula import OpenNebulaResponse
 from libcloud.compute.drivers.opennebula import OpenNebulaNodeSize
 from libcloud.compute.drivers.opennebula import ACTION
 import libcloud.compute.drivers.opennebula
 from libcloud.test.file_fixtures import ComputeFileFixtures
-from libcloud.common.types import InvalidCredsError
-from libcloud.common.base import Response
 from libcloud.test import MockHttp
-from libcloud.test.compute import TestCaseMixin
 
 from libcloud.test.secrets import OPENNEBULA_PARAMS
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4f694b20/libcloud/test/compute/test_openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py
index 416380d..7611392 100644
--- a/libcloud/test/compute/test_openstack.py
+++ b/libcloud/test/compute/test_openstack.py
@@ -38,7 +38,7 @@ from libcloud.compute.types import Provider, KeyPairDoesNotExistError, StorageVo
     VolumeSnapshotState
 from libcloud.compute.providers import get_driver
 from libcloud.compute.drivers.openstack import (
-    OpenStack_1_0_NodeDriver, OpenStack_1_0_Response,
+    OpenStack_1_0_NodeDriver,
     OpenStack_1_1_NodeDriver, OpenStackSecurityGroup,
     OpenStackSecurityGroupRule, OpenStack_1_1_FloatingIpPool,
     OpenStack_1_1_FloatingIpAddress, OpenStackKeyPair
@@ -46,8 +46,7 @@ from libcloud.compute.drivers.openstack import (
 from libcloud.compute.base import Node, NodeImage, NodeSize
 from libcloud.pricing import set_pricing, clear_pricing_data
 
-from libcloud.common.base import Response
-from libcloud.test import MockHttp, XML_HEADERS, make_response
+from libcloud.test import MockHttp, XML_HEADERS
 from libcloud.test.file_fixtures import ComputeFileFixtures, OpenStackFixtures
 from libcloud.test.compute import TestCaseMixin
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4f694b20/libcloud/test/storage/test_atmos.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_atmos.py b/libcloud/test/storage/test_atmos.py
index b6d9eb6..7579ab7 100644
--- a/libcloud/test/storage/test_atmos.py
+++ b/libcloud/test/storage/test_atmos.py
@@ -747,9 +747,6 @@ class AtmosMockHttp(MockHttp, unittest.TestCase):
         }
         return (httplib.OK, '', headers, httplib.responses[httplib.OK])
 
-    def _rest_namespace_fbc_ftu(self, method, url, body, headers):
-        return (httplib.CREATED, '', {}, httplib.responses[httplib.CREATED])
-
     def _rest_namespace_foo_bar_container_foo_bar_object(self, method, url,
                                                          body, headers):
         body = generate_random_data(1000)
@@ -761,14 +758,6 @@ class AtmosMockHttp(MockHttp, unittest.TestCase):
         body = generate_random_data(1000)
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
-    def _rest_namespace_foo_bar_container_foo_bar_object_NOT_FOUND(
-        self, method,
-        url, body,
-            headers):
-        body = self.fixtures.load('not_found.xml')
-        return (httplib.NOT_FOUND, body, {},
-                httplib.responses[httplib.NOT_FOUND])
-
     def _rest_namespace_fbc_ftu(self, method, url, body, headers):
         return (httplib.CREATED, '', {}, httplib.responses[httplib.CREATED])
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4f694b20/libcloud/test/storage/test_azure_blobs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_azure_blobs.py b/libcloud/test/storage/test_azure_blobs.py
index 0e607fe..eb12c0d 100644
--- a/libcloud/test/storage/test_azure_blobs.py
+++ b/libcloud/test/storage/test_azure_blobs.py
@@ -39,7 +39,7 @@ from libcloud.storage.drivers.azure_blobs import AzureBlobsStorageDriver
 from libcloud.storage.drivers.azure_blobs import AZURE_BLOCK_MAX_SIZE
 from libcloud.storage.drivers.azure_blobs import AZURE_PAGE_CHUNK_SIZE
 
-from libcloud.test import MockHttp, generate_random_data # pylint: disable-msg=E0611
+from libcloud.test import MockHttp, generate_random_data  # pylint: disable-msg=E0611
 from libcloud.test.file_fixtures import StorageFileFixtures  # pylint: disable-msg=E0611
 from libcloud.test.secrets import STORAGE_AZURE_BLOBS_PARAMS
 
@@ -329,17 +329,6 @@ class AzureBlobsMockHttp(MockHttp):
                 headers,
                 httplib.responses[httplib.CREATED])
 
-    def _foo_bar_container_foo_test_upload(self, method, url, body, headers):
-        # test_upload_object_success
-        body = ''
-        headers = {}
-        headers['etag'] = '0x8CFB877BB56A6FB'
-        headers['content-md5'] = 'd4fe4c9829f7ca1cc89db7ad670d2bbd'
-        return (httplib.CREATED,
-                body,
-                headers,
-                httplib.responses[httplib.CREATED])
-
     def _foo_bar_container_foo_bar_object(self, method, url, body, headers):
         # test_upload_object_invalid_file_size
         body = generate_random_data(1000)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4f694b20/libcloud/test/storage/test_backblaze_b2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_backblaze_b2.py b/libcloud/test/storage/test_backblaze_b2.py
index 8cec528..b678d19 100644
--- a/libcloud/test/storage/test_backblaze_b2.py
+++ b/libcloud/test/storage/test_backblaze_b2.py
@@ -158,10 +158,10 @@ class BackblazeB2MockHttp(MockHttp):
     def _b2api_v1_b2_authorize_account(self, method, url, body, headers):
         if method == 'GET':
             body = json.dumps({
-            'accountId': 'test',
-            'apiUrl': 'test',
-            'downloadUrl': 'test',
-            'authorizationToken': 'test'
+                'accountId': 'test',
+                'apiUrl': 'test',
+                'downloadUrl': 'test',
+                'authorizationToken': 'test'
             })
         else:
             raise AssertionError('Unsupported method')
@@ -240,13 +240,6 @@ class BackblazeB2MockHttp(MockHttp):
             raise AssertionError('Unsupported method')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
-    def _file_test00001_2_txt(self, method, url, body, headers):
-        # test_download_object
-        if method == 'GET':
-            body = 'ab'
-        else:
-            raise AssertionError('Unsupported method')
-        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
 if __name__ == '__main__':
     sys.exit(unittest.main())

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4f694b20/libcloud/test/storage/test_cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_cloudfiles.py b/libcloud/test/storage/test_cloudfiles.py
index 7e665f4..594323c 100644
--- a/libcloud/test/storage/test_cloudfiles.py
+++ b/libcloud/test/storage/test_cloudfiles.py
@@ -29,7 +29,7 @@ from libcloud.utils.py3 import b
 from libcloud.utils.py3 import httplib
 from libcloud.utils.py3 import urlquote
 
-from libcloud.common.types import LibcloudError, MalformedResponseError
+from libcloud.common.types import MalformedResponseError
 from libcloud.storage.base import CHUNK_SIZE, Container, Object
 from libcloud.storage.types import ContainerAlreadyExistsError
 from libcloud.storage.types import ContainerDoesNotExistError
@@ -686,7 +686,7 @@ class CloudFilesTests(unittest.TestCase):
         ]
         logged_data = []
 
-        class InterceptResponse(CloudFilesMockRawResponse):
+        class InterceptResponse(MockHttp):
             def __init__(self, connection, response=None):
                 super(InterceptResponse, self).__init__(connection=connection,
                                                         response=response)
@@ -1110,17 +1110,6 @@ class CloudFilesMockHttp(MockHttp, unittest.TestCase):
                     self.base_headers,
                     httplib.responses[httplib.OK])
 
-    def _v1_MossoCloudFS_foo_bar_container_foo_bar_object_NOT_FOUND(
-            self, method, url, body, headers):
-
-        if method == 'DELETE':
-            # test_delete_object_success
-            body = self.fixtures.load('list_container_objects_empty.json')
-            headers = self.base_headers
-            status_code = httplib.NOT_FOUND
-
-        return (status_code, body, headers, httplib.responses[httplib.OK])
-
     def _v1_MossoCloudFS_py3_img_or_vid(self, method, url, body, headers):
         headers = {'etag': 'e2378cace8712661ce7beec3d9362ef6'}
         headers.update(self.base_headers)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4f694b20/libcloud/test/storage/test_oss.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_oss.py b/libcloud/test/storage/test_oss.py
index 830fb74..142eda7 100644
--- a/libcloud/test/storage/test_oss.py
+++ b/libcloud/test/storage/test_oss.py
@@ -240,7 +240,7 @@ class OSSMockHttp(MockHttp, unittest.TestCase):
                 headers,
                 httplib.responses[httplib.OK])
 
-    def _foo_test_stream_data_multipart(self, method, url, body, headers):
+    def _foo_test_stream_data_multipart_HASH(self, method, url, body, headers):
         headers = {'etag': '"0cc175b9c0f1b6a831c399e269772661"'}
         TEST_UPLOAD_ID = '0004B9894A22E5B1888A1E29F8236E2D'
 
@@ -340,13 +340,6 @@ class OSSMockHttp(MockHttp, unittest.TestCase):
                 headers,
                 httplib.responses[httplib.OK])
 
-    def _foo_bar_object_not_found(self, method, url, body, headers):
-        # test_upload_object_not_found
-        return (httplib.NOT_FOUND,
-                body,
-                headers,
-                httplib.responses[httplib.NOT_FOUND])
-
     def _foo_test_upload_invalid_hash1(self, method, url, body, headers):
         body = ''
         headers = {}

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4f694b20/libcloud/test/storage/test_s3.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_s3.py b/libcloud/test/storage/test_s3.py
index 10fa0a0..ed4f971 100644
--- a/libcloud/test/storage/test_s3.py
+++ b/libcloud/test/storage/test_s3.py
@@ -48,7 +48,7 @@ from libcloud.storage.drivers.s3 import S3APNEStorageDriver
 from libcloud.storage.drivers.s3 import CHUNK_SIZE
 from libcloud.utils.py3 import b
 
-from libcloud.test import MockHttp # pylint: disable-msg=E0611
+from libcloud.test import MockHttp  # pylint: disable-msg=E0611
 from libcloud.test import unittest, make_response, generate_random_data
 from libcloud.test.file_fixtures import StorageFileFixtures  # pylint: disable-msg=E0611
 from libcloud.test.secrets import STORAGE_S3_PARAMS
@@ -365,16 +365,6 @@ class S3MockHttp(MockHttp):
                 headers,
                 httplib.responses[httplib.OK])
 
-    def _foo_bar_container_foo_test_stream_data(self, method, url, body,
-                                                headers):
-        # test_upload_object_via_stream
-        body = ''
-        headers = {'etag': '"0cc175b9c0f1b6a831c399e269772661"'}
-        return (httplib.OK,
-                body,
-                headers,
-                httplib.responses[httplib.OK])
-
 
 class S3Tests(unittest.TestCase):
     driver_type = S3StorageDriver
@@ -543,7 +533,7 @@ class S3Tests(unittest.TestCase):
 
         self.assertEqual(obj.name, 'test')
         self.assertEqual(obj.container.name, 'test2')
-        self.assertEqual(obj.size, '12345' )
+        self.assertEqual(obj.size, '12345')
         self.assertEqual(obj.hash, 'e31208wqsdoj329jd')
         self.assertEqual(obj.extra['last_modified'],
                          'Thu, 13 Sep 2012 07:13:22 GMT')
@@ -772,7 +762,7 @@ class S3Tests(unittest.TestCase):
                         request_path=None, request_method=None,
                         headers=None, file_path=None, stream=None):
             return {'response': make_response(200,
-                                             headers={'etag': '0cc175b9c0f1b6a831c399e269772661'}),
+                                              headers={'etag': '0cc175b9c0f1b6a831c399e269772661'}),
                     'bytes_transferred': 1000,
                     'data_hash': '0cc175b9c0f1b6a831c399e269772661'}
         self.mock_response_klass.type = None


Mime
View raw message