libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [1/4] libcloud git commit: add test to show LIBCLOUD-910 failure
Date Thu, 06 Apr 2017 02:33:07 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk fce25cd6a -> f6aaee21b


add test to show LIBCLOUD-910 failure


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

Branch: refs/heads/trunk
Commit: 4e5ddfbf2ab6c3bbaf7b2092ce3094dff54d5b59
Parents: c62d7c9
Author: Anthony Shaw <anthonyshaw@apache.org>
Authored: Thu Apr 6 11:16:32 2017 +1000
Committer: Anthony Shaw <anthonyshaw@apache.org>
Committed: Thu Apr 6 11:16:32 2017 +1000

----------------------------------------------------------------------
 libcloud/test/test_logging_connection.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4e5ddfbf/libcloud/test/test_logging_connection.py
----------------------------------------------------------------------
diff --git a/libcloud/test/test_logging_connection.py b/libcloud/test/test_logging_connection.py
index e7088a4..ed1fc5a 100644
--- a/libcloud/test/test_logging_connection.py
+++ b/libcloud/test/test_logging_connection.py
@@ -15,11 +15,13 @@
 
 import sys
 from io import StringIO
+import zlib
 import requests_mock
 
 import libcloud
 from libcloud.test import unittest
 from libcloud.common.base import Connection
+from libcloud.utils.py3 import b
 from libcloud.httplib_ssl import LibcloudConnection
 from libcloud.utils.loggingconnection import LoggingConnection
 
@@ -49,5 +51,20 @@ class TestLoggingConnection(unittest.TestCase):
         self.assertIn('-i -X GET', log)
         self.assertIn('data', log)
 
+    def test_debug_log_class_handles_request_with_compression(self):
+        with StringIO() as fh:
+            libcloud.enable_debug(fh)
+            conn = Connection(url='http://test.com/')
+            conn.connect()
+            self.assertEqual(conn.connection.host, 'http://test.com')
+            with requests_mock.mock() as m:
+                m.get('http://test.com/test', content=zlib.compress(b'test'),
+                      headers={'content-encoding': 'zlib'})
+                conn.request('/test')
+            log = fh.getvalue()
+        self.assertTrue(isinstance(conn.connection, LoggingConnection))
+        self.assertIn('-i -X GET', log)
+        self.assertIn('data', log)
+
 if __name__ == '__main__':
     sys.exit(unittest.main())


Mime
View raw message