diff options
author | codl <[email protected]> | 2017-11-28 13:50:57 +0100 |
---|---|---|
committer | codl <[email protected]> | 2017-11-28 13:50:57 +0100 |
commit | 59c4e4d4f803cde3ea2c7bbd5e34bdeade13e652 (patch) | |
tree | 9344bd11b0a41967b87321c8f752dd94065479ac | |
parent | 32adb8ce4b8f1987cf99f01635d195d6ead5483d (diff) | |
download | mastodon.py-59c4e4d4f803cde3ea2c7bbd5e34bdeade13e652.tar.gz |
fix streaming tests
-rw-r--r-- | tests/test_streaming.py | 13 |
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 @@ | |||
1 | import six | 1 | import six |
2 | import pytest | 2 | import pytest |
3 | import itertools | 3 | import itertools |
4 | from mastodon.streaming import StreamListener, MalformedEventError | 4 | from mastodon.streaming import StreamListener |
5 | from mastodon.Mastodon import MastodonMalformedEventError | ||
6 | |||
5 | 7 | ||
6 | 8 | ||
7 | class Listener(StreamListener): | 9 | class 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 | ||
102 | def test_missing_event_name(): | 107 | def 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 | ||
116 | def test_missing_data(): | 121 | def 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(): | |||
169 | def test_invalid_utf8(): | 174 | def 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"}', |