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/01/09 04:53:01 UTC
[41/51] [abbrv] libcloud git commit: more test fixing
more test fixing
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/6f38f8bd
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/6f38f8bd
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/6f38f8bd
Branch: refs/heads/trunk
Commit: 6f38f8bdb7b78b6e729a96038d644855773d53ac
Parents: e09a96b
Author: Anthony Shaw <an...@apache.org>
Authored: Sun Jan 8 20:03:01 2017 +1100
Committer: Anthony Shaw <an...@apache.org>
Committed: Sun Jan 8 20:03:01 2017 +1100
----------------------------------------------------------------------
libcloud/storage/base.py | 1 +
libcloud/test/__init__.py | 25 +++++--------------------
libcloud/test/compute/test_vcloud.py | 2 +-
3 files changed, 7 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f38f8bd/libcloud/storage/base.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/base.py b/libcloud/storage/base.py
index 29b84fb..96a657d 100644
--- a/libcloud/storage/base.py
+++ b/libcloud/storage/base.py
@@ -645,6 +645,7 @@ class StorageDriver(BaseDriver):
self._get_hash_function())
if not response.success():
+ print(response.success())
raise LibcloudError(
value='Object upload failed, Perhaps a timeout?', driver=self)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f38f8bd/libcloud/test/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/test/__init__.py b/libcloud/test/__init__.py
index 3909d2e..e154aa2 100644
--- a/libcloud/test/__init__.py
+++ b/libcloud/test/__init__.py
@@ -158,7 +158,7 @@ class MockRawResponse(BaseMockHttpObject):
type = None
responseCls = MockResponse
- def __init__(self, connection, path=None):
+ def __init__(self, connection, response=None):
super(MockRawResponse, self).__init__()
self._data = []
self._current_item = 0
@@ -166,8 +166,8 @@ class MockRawResponse(BaseMockHttpObject):
self._status = None
self._headers = None
self._reason = None
- self._path = path
self.connection = connection
+ self.iter_content = self.next
def next(self):
if self._current_item == len(self._data):
@@ -223,7 +223,7 @@ class MockRawResponse(BaseMockHttpObject):
if not self._response:
meth_name = self._get_method_name(type=self.type,
use_param=False, qs=None,
- path=self._path if self._path else self.connection.action)
+ path=self.connection.action)
meth = getattr(self, meth_name.replace('%', '_'))
result = meth(self.connection.method, None, None, None)
self._status, self._body, self._headers, self._reason = result
@@ -380,23 +380,8 @@ class MockConnection(object):
class StorageMockHttp(MockHttp):
def prepared_request(self, method, url, body=None, headers=None, raw=False,
stream=False):
- # Find a method we can use for this request
- parsed = urlparse.urlparse(url)
- scheme, netloc, path, params, query, fragment = parsed
- qs = parse_qs(query)
- if path.endswith('/'):
- path = path[:-1]
- meth_name = self._get_method_name(type=self.type,
- use_param=self.use_param,
- qs=qs, path=path)
- meth = getattr(self, meth_name.replace('%', '_'))
-
- if self.test and isinstance(self.test, LibcloudTestCase):
- self.test._add_visited_url(url=url)
- self.test._add_executed_mock_method(method_name=meth_name)
-
- status, body, headers, reason = meth(method, url, body, headers)
- self.response = self.rawResponseCls(MockConnection(action=method), path=path)
+ self.action = url
+ self.response = self.rawResponseCls(self)
def putrequest(self, method, action, skip_host=0, skip_accept_encoding=0):
pass
http://git-wip-us.apache.org/repos/asf/libcloud/blob/6f38f8bd/libcloud/test/compute/test_vcloud.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_vcloud.py b/libcloud/test/compute/test_vcloud.py
index fe4bf1d..28124bb 100644
--- a/libcloud/test/compute/test_vcloud.py
+++ b/libcloud/test/compute/test_vcloud.py
@@ -521,7 +521,7 @@ class VCloud_1_5_MockHttp(MockHttp, unittest.TestCase):
fixtures = ComputeFileFixtures('vcloud_1_5')
- def request(self, method, url, body=None, headers=None, raw=False):
+ def request(self, method, url, body=None, headers=None, raw=False, stream=False):
self.assertTrue(url.startswith('/api/'),
('"%s" is invalid. Needs to '
'start with "/api". The passed URL should be just '