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 2016/04/05 13:17:16 UTC

[25/33] libcloud git commit: Fix iter methods for storage tests

Fix iter methods for storage tests


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

Branch: refs/heads/requests
Commit: 52778e53b8a92f41132fe8595853835bd4ae56e0
Parents: 2195434
Author: anthony-shaw <an...@gmail.com>
Authored: Fri Apr 1 09:27:47 2016 +1100
Committer: anthony-shaw <an...@gmail.com>
Committed: Fri Apr 1 09:27:47 2016 +1100

----------------------------------------------------------------------
 libcloud/test/__init__.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/52778e53/libcloud/test/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/test/__init__.py b/libcloud/test/__init__.py
index 17e1f2f..068de27 100644
--- a/libcloud/test/__init__.py
+++ b/libcloud/test/__init__.py
@@ -89,15 +89,16 @@ class MockResponse(object):
         self.body = body
         self.headers = headers or self.headers
         self.reason = reason or self.reason
+        self.body_iter = iter(self.body) if self.body is not None else None
 
     def read(self, *args, **kwargs):
         return self.body
 
     def next(self):
         if sys.version_info >= (2, 5) and sys.version_info <= (2, 6):
-            return self.body.next()
+            return self.body_iter.next()
         else:
-            return next(self.body)
+            return next(self.body_iter)
 
     def __next__(self):
         return self.next()