aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_http.py23
-rw-r--r--test/test_tcp.py6
2 files changed, 28 insertions, 1 deletions
diff --git a/test/test_http.py b/test/test_http.py
index 0174a4aa..0b83e65a 100644
--- a/test/test_http.py
+++ b/test/test_http.py
@@ -64,7 +64,28 @@ def test_read_http_body_response():
h = odict.ODictCaseless()
h["content-length"] = [7]
s = cStringIO.StringIO("testing")
- assert http.read_http_body_response(s, h, False, None) == "testing"
+ assert http.read_http_body_response(s, h, None) == "testing"
+
+
+ h = odict.ODictCaseless()
+ s = cStringIO.StringIO("testing")
+ assert not http.read_http_body_response(s, h, None)
+
+ h = odict.ODictCaseless()
+ h["connection"] = ["close"]
+ s = cStringIO.StringIO("testing")
+ assert http.read_http_body_response(s, h, None) == "testing"
+
+
+def test_get_header_tokens():
+ h = odict.ODictCaseless()
+ assert http.get_header_tokens(h, "foo") == []
+ h["foo"] = ["bar"]
+ assert http.get_header_tokens(h, "foo") == ["bar"]
+ h["foo"] = ["bar, voing"]
+ assert http.get_header_tokens(h, "foo") == ["bar", "voing"]
+ h["foo"] = ["bar, voing", "oink"]
+ assert http.get_header_tokens(h, "foo") == ["bar", "voing", "oink"]
def test_read_http_body_request():
diff --git a/test/test_tcp.py b/test/test_tcp.py
index d6235b01..67c56a37 100644
--- a/test/test_tcp.py
+++ b/test/test_tcp.py
@@ -239,3 +239,9 @@ class TestFileLike:
s = cStringIO.StringIO("foobar\nfoobar")
s = tcp.FileLike(s)
assert s.readline(3) == "foo"
+
+ def test_limitless(self):
+ s = cStringIO.StringIO("f"*(50*1024))
+ s = tcp.FileLike(s)
+ ret = s.read(-1)
+ assert len(ret) == 50 * 1024