Debian Codegraph @

tests/streaming_test.py

raw
1 from io import BytesIO
2
3 from errbot.backends.base import Stream
4 from errbot.backends.test import TestPerson
5 from errbot.streaming import Tee
6
7
8 class StreamingClient(object):
9 def callback_stream(self, stream):
10 self.response = stream.read()
11
12
13 def test_streaming():
14 canary = b"this is my test" * 1000
15 source = Stream(TestPerson("[email protected]"), BytesIO(canary))
16 clients = [StreamingClient() for _ in range(50)]
17 Tee(source, clients).run()
18 for client in clients:
19 assert client.response == canary