diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_streaming.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/test_streaming.py b/tests/test_streaming.py index 33a3f9a..ac8e691 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py | |||
@@ -30,7 +30,18 @@ class Listener(StreamListener): | |||
30 | 30 | ||
31 | def handle_stream_(self, lines): | 31 | def handle_stream_(self, lines): |
32 | """Test helper to avoid littering all tests with six.b().""" | 32 | """Test helper to avoid littering all tests with six.b().""" |
33 | return self.handle_stream(map(six.b, lines)) | 33 | class MockResponse(): |
34 | def __init__(self, data): | ||
35 | self.data = data | ||
36 | |||
37 | def iter_content(self, chunk_size): | ||
38 | for line in self.data: | ||
39 | for byte in line: | ||
40 | bytearr = bytearray() | ||
41 | bytearr.append(byte) | ||
42 | yield(bytearr) | ||
43 | yield(b'\n') | ||
44 | return self.handle_stream(MockResponse(map(six.b, lines))) | ||
34 | 45 | ||
35 | 46 | ||
36 | def test_heartbeat(): | 47 | def test_heartbeat(): |