summaryrefslogtreecommitdiff
path: root/tests/httpwrappers
diff options
context:
space:
mode:
Diffstat (limited to 'tests/httpwrappers')
-rw-r--r--tests/httpwrappers/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py
index 9b9b19e180..4e705e2aeb 100644
--- a/tests/httpwrappers/tests.py
+++ b/tests/httpwrappers/tests.py
@@ -407,6 +407,15 @@ class HttpResponseTests(unittest.TestCase):
r.write(b'def')
self.assertEqual(r.content, b'abcdef')
+ def test_stream_interface(self):
+ r = HttpResponse('asdf')
+ self.assertEqual(r.getvalue(), b'asdf')
+
+ r = HttpResponse()
+ self.assertEqual(r.writable(), True)
+ r.writelines(['foo\n', 'bar\n', 'baz\n'])
+ self.assertEqual(r.content, b'foo\nbar\nbaz\n')
+
def test_unsafe_redirect(self):
bad_urls = [
'data:text/html,<script>window.alert("xss")</script>',
@@ -537,6 +546,9 @@ class StreamingHttpResponseTests(TestCase):
with self.assertRaises(Exception):
r.tell()
+ r = StreamingHttpResponse(iter(['hello', 'world']))
+ self.assertEqual(r.getvalue(), b'helloworld')
+
class FileCloseTests(TestCase):