From 628b61701bd3573bca7b08c920415cdaad9ac828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Gr=C3=BCb?= Date: Fri, 9 Oct 2020 15:11:29 +0200 Subject: [PATCH 1/2] Fixed gzip tests by comparing decompressed values --- influxdb/tests/client_test.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/influxdb/tests/client_test.py b/influxdb/tests/client_test.py index e511ca9b..0c017f3f 100644 --- a/influxdb/tests/client_test.py +++ b/influxdb/tests/client_test.py @@ -248,8 +248,8 @@ def test_write_gzip(self): ) self.assertEqual( - m.last_request.body, - compressed.getvalue(), + gzip.decompress(m.last_request.body), + gzip.decompress(compressed.getvalue()), ) def test_write_points_gzip(self): @@ -276,9 +276,10 @@ def test_write_points_gzip(self): b'cpu_load_short,host=server01,region=us-west ' b'value=0.64 1257894000123456000\n' ) + self.assertEqual( - m.last_request.body, - compressed.getvalue(), + gzip.decompress(m.last_request.body), + gzip.decompress(compressed.getvalue()), ) def test_write_points_toplevel_attributes(self): From ed548b408ebce9fd655aa5ff52625d439b7cdf6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Gr=C3=BCb?= Date: Fri, 9 Oct 2020 16:05:32 +0200 Subject: [PATCH 2/2] Python 2.7 compliant test version --- influxdb/tests/client_test.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/influxdb/tests/client_test.py b/influxdb/tests/client_test.py index 0c017f3f..7f1091cb 100644 --- a/influxdb/tests/client_test.py +++ b/influxdb/tests/client_test.py @@ -246,10 +246,11 @@ def test_write_gzip(self): b"cpu_load_short,host=server01,region=us-west " b"value=0.64 1257894000000000000\n" ) + compressed.seek(0) self.assertEqual( - gzip.decompress(m.last_request.body), - gzip.decompress(compressed.getvalue()), + gzip.GzipFile(fileobj=io.BytesIO(m.last_request.body)).read(), + gzip.GzipFile(fileobj=compressed).read() ) def test_write_points_gzip(self): @@ -276,10 +277,11 @@ def test_write_points_gzip(self): b'cpu_load_short,host=server01,region=us-west ' b'value=0.64 1257894000123456000\n' ) + compressed.seek(0) self.assertEqual( - gzip.decompress(m.last_request.body), - gzip.decompress(compressed.getvalue()), + gzip.GzipFile(fileobj=io.BytesIO(m.last_request.body)).read(), + gzip.GzipFile(fileobj=compressed).read() ) def test_write_points_toplevel_attributes(self): pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy