libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [1/8] libcloud git commit: add test to show it doesn't work as it used to
Date Fri, 13 Jan 2017 00:42:45 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk faf0a5a5c -> f4c00ea09


add test to show it doesn't work as it used to


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

Branch: refs/heads/trunk
Commit: d979b922360fb64f35b4bf4d75e5c9ff69694911
Parents: 3dd6d01
Author: Anthony Shaw <anthonyshaw@apache.org>
Authored: Tue Jan 10 16:55:09 2017 +1100
Committer: Anthony Shaw <anthonyshaw@apache.org>
Committed: Tue Jan 10 16:55:09 2017 +1100

----------------------------------------------------------------------
 libcloud/test/test_response_classes.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/d979b922/libcloud/test/test_response_classes.py
----------------------------------------------------------------------
diff --git a/libcloud/test/test_response_classes.py b/libcloud/test/test_response_classes.py
index 37d2386..d1e1179 100644
--- a/libcloud/test/test_response_classes.py
+++ b/libcloud/test/test_response_classes.py
@@ -19,7 +19,7 @@ import unittest
 import requests
 import requests_mock
 
-from libcloud.common.base import XmlResponse, JsonResponse
+from libcloud.common.base import XmlResponse, JsonResponse, RawResponse, Connection
 from libcloud.common.types import MalformedResponseError
 from libcloud.httplib_ssl import LibcloudConnection
 
@@ -94,6 +94,18 @@ class ResponseClassesTests(unittest.TestCase):
         parsed = response.parse_body()
         self.assertEqual(parsed, '')
 
+    def test_RawResponse_class_read_method(self):
+        TEST_DATA = '1234abcd'
+        
+        conn = Connection(host='mock.com', port=80, secure=False)
+        conn.connect()
+        adapter = requests_mock.Adapter()
+        conn.connection.session.mount('mock', adapter)
+        adapter.register_uri('GET', 'http://test.com/raw_data', text=TEST_DATA)
+        
+        response = conn.request('/raw_data', raw=True)
+        data = response.response.read()
+        self.assertEqual(data, TEST_DATA)
 
 if __name__ == '__main__':
     sys.exit(unittest.main())


Mime
View raw message