[Inteproxy-commits] r350 - in branches/compression: . test
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Thu Feb 23 16:22:26 CET 2012
Author: aheinecke
Date: 2012-02-23 16:22:26 +0100 (Thu, 23 Feb 2012)
New Revision: 350
Modified:
branches/compression/ChangeLog
branches/compression/test/test_inteproxy.py
Log:
Add TestInteProxyCompressedConnection to test content-encodings
A test for compression on a chunked connection is missing, yet
Modified: branches/compression/ChangeLog
===================================================================
--- branches/compression/ChangeLog 2012-02-22 17:58:14 UTC (rev 349)
+++ branches/compression/ChangeLog 2012-02-23 15:22:26 UTC (rev 350)
@@ -1,3 +1,9 @@
+2012-02-23 Andre Heinecke <aheinecke at intevation.de>
+
+ * M test/test_inteproxy.py:
+ Add TestInteProxyCompressedConnection to test
+ messages with content-encoding deflate and gzip
+
2012-02-22 Andre Heinecke <aheinecke at intevation.de>
* M inteproxy/proxycore.py:
Modified: branches/compression/test/test_inteproxy.py
===================================================================
--- branches/compression/test/test_inteproxy.py 2012-02-22 17:58:14 UTC (rev 349)
+++ branches/compression/test/test_inteproxy.py 2012-02-23 15:22:26 UTC (rev 350)
@@ -521,3 +521,39 @@
self.assertEquals(response.status, 200)
data = response.read()
self.assertEquals(data, "some text")
+
+class TestInteProxyCompressedConnection(ServerTest):
+ remote_contents = [
+ ("/plain", [("Content-Type", "text/plain")], "not encoded"),
+ ("/gzip", [("Content-Type", "text/plain"),
+ ("Content-Encoding", "gzip")],
+ base64.b64decode("H4sICNwRRk8AA2Zvby50eHQAS8vP5wIAqGUyfgQAAAA=")),
+ ("/deflate", [("Content-Type", "text/plain"),
+ ("Content-Encoding", "deflate")],
+ base64.b64decode("S8vPBwA="))]
+
+
+ def test_plain(self):
+ http = httplib.HTTPConnection("localhost", self.server.server_port)
+ http.request("GET", self.remote_server_base_url + "plain")
+ response = http.getresponse()
+ self.assertEquals(response.status, 200)
+ data = response.read()
+ self.assertEquals(data, "not encoded")
+
+ def test_deflate(self):
+ http = httplib.HTTPConnection("localhost", self.server.server_port)
+ http.request("GET", self.remote_server_base_url + "deflate")
+ response = http.getresponse()
+ self.assertEquals(response.status, 200)
+ data = response.read()
+ self.assertEquals(data, "foo")
+
+ def test_gzip(self):
+ http = httplib.HTTPConnection("localhost", self.server.server_port)
+ http.request("GET", self.remote_server_base_url + "gzip")
+ response = http.getresponse()
+ self.assertEquals(response.status, 200)
+ data = response.read()
+ self.assertEquals(data, "foo\n")
+
More information about the Inteproxy-commits
mailing list