You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2017/04/13 09:33:34 UTC
[28/46] libcloud git commit: fix encoding issues
fix encoding issues
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/69cb28db
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/69cb28db
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/69cb28db
Branch: refs/heads/trunk
Commit: 69cb28dba6da6d3a872fe461d95ef109eacebcd4
Parents: 404e73a
Author: Anthony Shaw <an...@apache.org>
Authored: Wed Apr 12 15:37:00 2017 +1000
Committer: Anthony Shaw <an...@apache.org>
Committed: Wed Apr 12 15:37:00 2017 +1000
----------------------------------------------------------------------
libcloud/test/__init__.py | 3 +--
libcloud/test/compute/test_cloudsigma_v2_0.py | 2 +-
libcloud/test/compute/test_ecp.py | 2 +-
libcloud/test/dns/fixtures/buddyns/list_zones.json | 2 +-
libcloud/test/file_fixtures.py | 13 +++++++------
libcloud/test/storage/test_azure_blobs.py | 2 +-
6 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/69cb28db/libcloud/test/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/test/__init__.py b/libcloud/test/__init__.py
index 6371843..d5c295b 100644
--- a/libcloud/test/__init__.py
+++ b/libcloud/test/__init__.py
@@ -220,11 +220,10 @@ class MockConnection(object):
StorageMockHttp = MockHttp
-def make_response(status=200, headers={}, body=None, connection=None):
+def make_response(status=200, headers={}, connection=None):
response = requests.Response()
response.status_code = status
response.headers = headers
- response.text = body
return Response(response, connection)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/69cb28db/libcloud/test/compute/test_cloudsigma_v2_0.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_cloudsigma_v2_0.py b/libcloud/test/compute/test_cloudsigma_v2_0.py
index 307eedc..b50216b 100644
--- a/libcloud/test/compute/test_cloudsigma_v2_0.py
+++ b/libcloud/test/compute/test_cloudsigma_v2_0.py
@@ -440,7 +440,7 @@ class CloudSigmaAPI20IndirectTestCase(CloudSigmaAPI20BaseTestCase,
driver_kwargs = {'api_version': '2.0'}
-class CloudSigmaMockHttp(MockHttp):
+class CloudSigmaMockHttp(MockHttp, unittest.TestCase):
fixtures = ComputeFileFixtures('cloudsigma_2_0')
def _api_2_0_servers_detail_INVALID_CREDS(self, method, url, body, headers):
http://git-wip-us.apache.org/repos/asf/libcloud/blob/69cb28db/libcloud/test/compute/test_ecp.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ecp.py b/libcloud/test/compute/test_ecp.py
index 93fdc71..e8032a6 100644
--- a/libcloud/test/compute/test_ecp.py
+++ b/libcloud/test/compute/test_ecp.py
@@ -30,7 +30,7 @@ class ECPTests(unittest.TestCase, TestCaseMixin):
def setUp(self):
ECPNodeDriver.connectionCls.conn_class = ECPMockHttp
- self.driver = ECPNodeDriver(*ECP_PARAMS)
+ self.driver = ECPNodeDriver(*ECP_PARAMS, host='dummy')
def test_list_nodes(self):
nodes = self.driver.list_nodes()
http://git-wip-us.apache.org/repos/asf/libcloud/blob/69cb28db/libcloud/test/dns/fixtures/buddyns/list_zones.json
----------------------------------------------------------------------
diff --git a/libcloud/test/dns/fixtures/buddyns/list_zones.json b/libcloud/test/dns/fixtures/buddyns/list_zones.json
index 7397e6a..0465dd5 100644
--- a/libcloud/test/dns/fixtures/buddyns/list_zones.json
+++ b/libcloud/test/dns/fixtures/buddyns/list_zones.json
@@ -14,5 +14,5 @@
"master" : "154.15.200.6",
"serial" : 1383743519,
"status": "google.de/status/",
- "delegation": "/api/v2/zone/b�cher.de/delegation/"
+ "delegation": "/api/v2/zone/b?cher.de/delegation/"
} ]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/libcloud/blob/69cb28db/libcloud/test/file_fixtures.py
----------------------------------------------------------------------
diff --git a/libcloud/test/file_fixtures.py b/libcloud/test/file_fixtures.py
index 59f8e2e..502dec5 100644
--- a/libcloud/test/file_fixtures.py
+++ b/libcloud/test/file_fixtures.py
@@ -17,6 +17,7 @@
from __future__ import with_statement
import os
+import codecs
from libcloud.utils.py3 import PY3
from libcloud.utils.py3 import u
@@ -43,13 +44,13 @@ class FileFixtures(object):
path = os.path.join(self.root, file)
if os.path.exists(path):
if PY3:
- kwargs = {'encoding': 'utf-8'}
+ with open(path, 'r', encoding='utf-8') as fh:
+ content = fh.read()
+ return u(content)
else:
- kwargs = {}
-
- with open(path, 'r', **kwargs) as fh:
- content = fh.read()
- return u(content)
+ with codecs.open(path, 'r', 'utf-8') as fh:
+ content = fh.read()
+ return content
else:
raise IOError(path)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/69cb28db/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 7fb770f..0e607fe 100644
--- a/libcloud/test/storage/test_azure_blobs.py
+++ b/libcloud/test/storage/test_azure_blobs.py
@@ -78,7 +78,7 @@ class AzureBlobsMockHttp(MockHttp):
def _test_container_EMPTY(self, method, url, body, headers):
if method == 'DELETE':
- body = ''
+ body = u''
return (httplib.ACCEPTED,
body,
self.base_headers,