aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcodl <[email protected]>2017-11-28 13:50:57 +0100
committercodl <[email protected]>2017-11-28 13:50:57 +0100
commit59c4e4d4f803cde3ea2c7bbd5e34bdeade13e652 (patch)
tree9344bd11b0a41967b87321c8f752dd94065479ac
parent32adb8ce4b8f1987cf99f01635d195d6ead5483d (diff)
downloadmastodon.py-59c4e4d4f803cde3ea2c7bbd5e34bdeade13e652.tar.gz
fix streaming tests
-rw-r--r--tests/test_streaming.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/test_streaming.py b/tests/test_streaming.py
index 1f8d75f..33a3f9a 100644
--- a/tests/test_streaming.py
+++ b/tests/test_streaming.py
@@ -1,7 +1,9 @@
1import six 1import six
2import pytest 2import pytest
3import itertools 3import itertools
4from mastodon.streaming import StreamListener, MalformedEventError 4from mastodon.streaming import StreamListener
5from mastodon.Mastodon import MastodonMalformedEventError
6
5 7
6 8
7class Listener(StreamListener): 9class Listener(StreamListener):
@@ -20,6 +22,9 @@ class Listener(StreamListener):
20 def on_delete(self, status_id): 22 def on_delete(self, status_id):
21 self.deletes.append(status_id) 23 self.deletes.append(status_id)
22 24
25 def on_blahblah(self, data):
26 pass
27
23 def handle_heartbeat(self): 28 def handle_heartbeat(self):
24 self.heartbeats += 1 29 self.heartbeats += 1
25 30
@@ -101,7 +106,7 @@ def test_unknown_event():
101 106
102def test_missing_event_name(): 107def test_missing_event_name():
103 listener = Listener() 108 listener = Listener()
104 with pytest.raises(MalformedEventError): 109 with pytest.raises(MastodonMalformedEventError):
105 listener.handle_stream_([ 110 listener.handle_stream_([
106 'data: {}', 111 'data: {}',
107 '', 112 '',
@@ -115,7 +120,7 @@ def test_missing_event_name():
115 120
116def test_missing_data(): 121def test_missing_data():
117 listener = Listener() 122 listener = Listener()
118 with pytest.raises(MalformedEventError): 123 with pytest.raises(MastodonMalformedEventError):
119 listener.handle_stream_([ 124 listener.handle_stream_([
120 'event: update', 125 'event: update',
121 '', 126 '',
@@ -169,7 +174,7 @@ def test_valid_utf8():
169def test_invalid_utf8(): 174def test_invalid_utf8():
170 """Cat Face With Tears O""" 175 """Cat Face With Tears O"""
171 listener = Listener() 176 listener = Listener()
172 with pytest.raises(MalformedEventError): 177 with pytest.raises(MastodonMalformedEventError):
173 listener.handle_stream_([ 178 listener.handle_stream_([
174 'event: update', 179 'event: update',
175 'data: {"foo": "\xF0\x9F\x98"}', 180 'data: {"foo": "\xF0\x9F\x98"}',
Powered by cgit v1.2.3 (git 2.41.0)