aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhalcy <halcy@ARARAGI-KUN>2022-11-21 22:17:20 +0200
committerhalcy <halcy@ARARAGI-KUN>2022-11-21 22:17:20 +0200
commit1d5b308016b8762d255290add53f84dbd6f7d439 (patch)
treeaffb5c96cef67360910386786dfb19b576b67a7f
parent6d4ec618f2f02a20874973647f34cbca9e9936cc (diff)
downloadmastodon.py-1d5b308016b8762d255290add53f84dbd6f7d439.tar.gz
Add more streaming events, some tests
-rw-r--r--mastodon/streaming.py105
-rw-r--r--tests/cassettes/test_stream_user.yaml527
-rw-r--r--tests/cassettes/test_stream_user_direct.yaml720
-rw-r--r--tests/test_streaming.py28
4 files changed, 826 insertions, 554 deletions
diff --git a/mastodon/streaming.py b/mastodon/streaming.py
index 08f5670..ed09705 100644
--- a/mastodon/streaming.py
+++ b/mastodon/streaming.py
@@ -22,18 +22,50 @@ class StreamListener(object):
22 Mastodon.hashtag_stream().""" 22 Mastodon.hashtag_stream()."""
23 23
24 def on_update(self, status): 24 def on_update(self, status):
25 """A new status has appeared. 'status' is the parsed JSON dictionary 25 """A new status has appeared. `status` is the parsed `status dict`
26 describing the status.""" 26 describing the status."""
27 pass 27 pass
28 28
29 def on_delete(self, status_id):
30 """A status has been deleted. `status_id` is the status' integer ID."""
31 pass
32
33 def on_notification(self, notification):
34 """A new notification. `notification` is the parsed `notification dict`
35 describing the notification."""
36 pass
37
38 def on_filters_changed(self):
39 """Filters have changed. Does not contain a payload, you will have to
40 refetch filters yourself."""
41 pass
42
43 def on_conversation(self, conversation):
44 """A direct message (in the direct stream) has been received. `conversation`
45 is the parsed `conversation dict` dictionary describing the conversation"""
46 pass
47
48 def on_announcement(self, annoucement):
49 """A new announcement has been published. `announcement` is the parsed
50 `announcement dict` describing the newly posted announcement."""
51 pass
52
53 def on_announcement_reaction(self, TODO):
54 """Someone has reacted to an announcement. TODO: what is payload lol"""
55 pass
56
57 def on_announcement_delete(self, annoucement_id):
58 """An announcement has been deleted. `annoucement_id` is the id of the
59 deleted announcement."""
60 pass
61
29 def on_status_update(self, status): 62 def on_status_update(self, status):
30 """A status has been edited. 'status' is the parsed JSON dictionary 63 """A status has been edited. 'status' is the parsed JSON dictionary
31 describing the updated status.""" 64 describing the updated status."""
32 pass 65 pass
33 66
34 def on_notification(self, notification): 67 def on_encrypted_message(self, unclear):
35 """A new notification. 'notification' is the parsed JSON dictionary 68 """An encrypted message has been received. Currently unused."""
36 describing the notification."""
37 pass 69 pass
38 70
39 def on_abort(self, err): 71 def on_abort(self, err):
@@ -47,15 +79,6 @@ class StreamListener(object):
47 """ 79 """
48 pass 80 pass
49 81
50 def on_delete(self, status_id):
51 """A status has been deleted. status_id is the status' integer ID."""
52 pass
53
54 def on_conversation(self, conversation):
55 """A direct message (in the direct stream) has been received. conversation
56 contains the resulting conversation dict."""
57 pass
58
59 def on_unknown_event(self, name, unknown_event=None): 82 def on_unknown_event(self, name, unknown_event=None):
60 """An unknown mastodon API event has been received. The name contains the event-name and unknown_event 83 """An unknown mastodon API event has been received. The name contains the event-name and unknown_event
61 contains the content of the unknown event. 84 contains the content of the unknown event.
@@ -148,8 +171,7 @@ class StreamListener(object):
148 for_stream = json.loads(event['stream']) 171 for_stream = json.loads(event['stream'])
149 except: 172 except:
150 for_stream = None 173 for_stream = None
151 payload = json.loads( 174 payload = json.loads(data, object_hook=Mastodon._Mastodon__json_hooks)
152 data, object_hook=Mastodon._Mastodon__json_hooks)
153 except KeyError as err: 175 except KeyError as err:
154 exception = MastodonMalformedEventError( 176 exception = MastodonMalformedEventError(
155 'Missing field', err.args[0], event) 177 'Missing field', err.args[0], event)
@@ -188,11 +210,13 @@ class StreamListener(object):
188 handler(name, payload, for_stream) 210 handler(name, payload, for_stream)
189 else: 211 else:
190 if handler != self.on_unknown_event: 212 if handler != self.on_unknown_event:
191 handler(payload) 213 if handler == self.on_filters_changed:
214 handler()
215 else:
216 handler(payload)
192 else: 217 else:
193 handler(name, payload) 218 handler(name, payload)
194 219
195
196class CallbackStreamListener(StreamListener): 220class CallbackStreamListener(StreamListener):
197 """ 221 """
198 Simple callback stream handler class. 222 Simple callback stream handler class.
@@ -202,15 +226,34 @@ class CallbackStreamListener(StreamListener):
202 for diagnostics. 226 for diagnostics.
203 """ 227 """
204 228
205 def __init__(self, update_handler=None, local_update_handler=None, delete_handler=None, notification_handler=None, conversation_handler=None, unknown_event_handler=None, status_update_handler=None): 229 def __init__(self,
230 update_handler=None,
231 local_update_handler=None,
232 delete_handler=None,
233 notification_handler=None,
234 conversation_handler=None,
235 unknown_event_handler=None,
236 status_update_handler=None,
237 filters_changed_handler=None,
238 announcement_handler=None,
239 announcement_reaction_handler=None,
240 announcement_delete_handler=None,
241 encryted_message_handler=None
242
243 ):
206 super(CallbackStreamListener, self).__init__() 244 super(CallbackStreamListener, self).__init__()
207 self.update_handler = update_handler 245 self.update_handler = update_handler
208 self.local_update_handler = local_update_handler 246 self.local_update_handler = local_update_handler
209 self.delete_handler = delete_handler 247 self.delete_handler = delete_handler
210 self.notification_handler = notification_handler 248 self.notification_handler = notification_handler
249 self.filters_changed_handler = filters_changed_handler
211 self.conversation_handler = conversation_handler 250 self.conversation_handler = conversation_handler
212 self.unknown_event_handler = unknown_event_handler 251 self.unknown_event_handler = unknown_event_handler
213 self.status_update_handler = status_update_handler 252 self.status_update_handler = status_update_handler
253 self.announcement_handler = announcement_handler
254 self.announcement_reaction_handler = announcement_reaction_handler
255 self.announcement_delete_handler = announcement_delete_handler
256 self.encryted_message_handler = encryted_message_handler
214 257
215 def on_update(self, status): 258 def on_update(self, status):
216 if self.update_handler is not None: 259 if self.update_handler is not None:
@@ -233,14 +276,34 @@ class CallbackStreamListener(StreamListener):
233 if self.notification_handler is not None: 276 if self.notification_handler is not None:
234 self.notification_handler(notification) 277 self.notification_handler(notification)
235 278
279 def on_filters_changed(self):
280 if self.filters_changed_handler is not None:
281 self.filters_changed_handler()
282
236 def on_conversation(self, conversation): 283 def on_conversation(self, conversation):
237 if self.conversation_handler is not None: 284 if self.conversation_handler is not None:
238 self.conversation_handler(conversation) 285 self.conversation_handler(conversation)
239 286
240 def on_unknown_event(self, name, unknown_event=None): 287 def on_announcement(self, annoucement):
241 if self.unknown_event_handler is not None: 288 if self.announcement_handler is not None:
242 self.unknown_event_handler(name, unknown_event) 289 self.announcement_handler(annoucement)
290
291 def on_announcement_reaction(self, TODO):
292 if self.announcement_reaction_handler is not None:
293 self.announcement_reaction_handler(TODO)
294
295 def on_announcement_delete(self, annoucement_id):
296 if self.announcement_delete_handler is not None:
297 self.announcement_delete_handler(annoucement_id)
243 298
244 def on_status_update(self, status): 299 def on_status_update(self, status):
245 if self.status_update_handler is not None: 300 if self.status_update_handler is not None:
246 self.status_update_handler(status) 301 self.status_update_handler(status)
302
303 def on_encrypted_message(self, unclear):
304 if self.encryted_message_handler is not None:
305 self.encryted_message_handler(unclear)
306
307 def on_unknown_event(self, name, unknown_event=None):
308 if self.unknown_event_handler is not None:
309 self.unknown_event_handler(name, unknown_event) \ No newline at end of file
diff --git a/tests/cassettes/test_stream_user.yaml b/tests/cassettes/test_stream_user.yaml
deleted file mode 100644
index fd4562d..0000000
--- a/tests/cassettes/test_stream_user.yaml
+++ /dev/null
@@ -1,527 +0,0 @@
1interactions:
2- request:
3 body: null
4 headers:
5 Accept:
6 - '*/*'
7 Accept-Encoding:
8 - gzip, deflate
9 Authorization:
10 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
11 Connection:
12 - keep-alive
13 User-Agent:
14 - tests/v311
15 method: GET
16 uri: http://localhost:3000/api/v1/accounts/verify_credentials
17 response:
18 body:
19 string: '{"id":"109367691027217373","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-19T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"last_status_at":"2022-11-19","noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"3","name":"Owner","permissions":"1048575","color":"","highlighted":true}}'
20 headers:
21 Cache-Control:
22 - no-store
23 Content-Security-Policy:
24 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
25 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
26 style-src ''self'' http://localhost:3000 ''nonce-O3ZNtzAEPVPHGw7XRXG94g=='';
27 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
28 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
29 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
30 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
31 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
32 worker-src ''self'' blob: http://localhost:3000'
33 Content-Type:
34 - application/json; charset=utf-8
35 ETag:
36 - W/"5b9093665afc2a342b309f69154704b3"
37 Referrer-Policy:
38 - strict-origin-when-cross-origin
39 Transfer-Encoding:
40 - chunked
41 Vary:
42 - Accept, Origin
43 X-Content-Type-Options:
44 - nosniff
45 X-Download-Options:
46 - noopen
47 X-Frame-Options:
48 - SAMEORIGIN
49 X-Permitted-Cross-Domain-Policies:
50 - none
51 X-Request-Id:
52 - 3edc1043-eef2-49a4-8d0b-60a1f8124f46
53 X-Runtime:
54 - '0.013476'
55 X-XSS-Protection:
56 - 1; mode=block
57 status:
58 code: 200
59 message: OK
60- request:
61 body: null
62 headers:
63 Accept:
64 - '*/*'
65 Accept-Encoding:
66 - gzip, deflate
67 Authorization:
68 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
69 Connection:
70 - keep-alive
71 Content-Length:
72 - '0'
73 User-Agent:
74 - tests/v311
75 method: POST
76 uri: http://localhost:3000/api/v1/accounts/109367691027217373/unfollow
77 response:
78 body:
79 string: '{"id":"109367691027217373","following":false,"showing_reblogs":false,"notifying":false,"languages":null,"followed_by":false,"blocking":false,"blocked_by":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false,"endorsed":false,"note":"top
80 ebayer gerne wieder"}'
81 headers:
82 Cache-Control:
83 - no-store
84 Content-Security-Policy:
85 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
86 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
87 style-src ''self'' http://localhost:3000 ''nonce-m+JYKcVWVLPax0N7LqNvTg=='';
88 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
89 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
90 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
91 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
92 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
93 worker-src ''self'' blob: http://localhost:3000'
94 Content-Type:
95 - application/json; charset=utf-8
96 ETag:
97 - W/"08cbbe52317052ef8ec82a9714a02c24"
98 Referrer-Policy:
99 - strict-origin-when-cross-origin
100 Transfer-Encoding:
101 - chunked
102 Vary:
103 - Accept, Origin
104 X-Content-Type-Options:
105 - nosniff
106 X-Download-Options:
107 - noopen
108 X-Frame-Options:
109 - SAMEORIGIN
110 X-Permitted-Cross-Domain-Policies:
111 - none
112 X-Request-Id:
113 - 0d91aac4-11aa-4ea2-9340-0d7988465036
114 X-Runtime:
115 - '0.014779'
116 X-XSS-Protection:
117 - 1; mode=block
118 status:
119 code: 200
120 message: OK
121- request:
122 body: null
123 headers:
124 Accept:
125 - '*/*'
126 Accept-Encoding:
127 - gzip, deflate
128 Authorization:
129 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
130 Connection:
131 - keep-alive
132 User-Agent:
133 - tests/v311
134 method: GET
135 uri: http://localhost:3000/api/v1/instance/
136 response:
137 body:
138 string: '{"uri":"localhost:3000","title":"Mastodon","short_description":"","description":"","email":"","version":"4.0.0rc2","urls":{"streaming_api":"ws://localhost:4000"},"stats":{"user_count":4,"status_count":4,"domain_count":0},"thumbnail":"http://localhost:3000/packs/media/images/preview-6399aebd96ccf025654e2977454f168f.png","languages":["en"],"registrations":true,"approval_required":false,"invites_enabled":true,"configuration":{"accounts":{"max_featured_tags":10},"statuses":{"max_characters":500,"max_media_attachments":4,"characters_reserved_per_url":23},"media_attachments":{"supported_mime_types":["image/jpeg","image/png","image/gif","image/heic","image/heif","image/webp","image/avif","video/webm","video/mp4","video/quicktime","video/ogg","audio/wave","audio/wav","audio/x-wav","audio/x-pn-wave","audio/vnd.wave","audio/ogg","audio/vorbis","audio/mpeg","audio/mp3","audio/webm","audio/flac","audio/aac","audio/m4a","audio/x-m4a","audio/mp4","audio/3gpp","video/x-ms-asf"],"image_size_limit":10485760,"image_matrix_limit":16777216,"video_size_limit":41943040,"video_frame_rate_limit":60,"video_matrix_limit":2304000},"polls":{"max_options":4,"max_characters_per_option":50,"min_expiration":300,"max_expiration":2629746}},"contact_account":null,"rules":[]}'
139 headers:
140 Cache-Control:
141 - max-age=180, public
142 Content-Security-Policy:
143 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
144 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
145 style-src ''self'' http://localhost:3000 ''nonce-ZUQGY+4miQDPh7ObVRADdQ=='';
146 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
147 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
148 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
149 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
150 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
151 worker-src ''self'' blob: http://localhost:3000'
152 Content-Type:
153 - application/json; charset=utf-8
154 Date:
155 - Sat, 19 Nov 2022 00:44:18 GMT
156 ETag:
157 - W/"bccac95ee3a5b2a47f646f4b8052d0de"
158 Referrer-Policy:
159 - strict-origin-when-cross-origin
160 Transfer-Encoding:
161 - chunked
162 Vary:
163 - Accept, Origin
164 X-Content-Type-Options:
165 - nosniff
166 X-Download-Options:
167 - noopen
168 X-Frame-Options:
169 - SAMEORIGIN
170 X-Permitted-Cross-Domain-Policies:
171 - none
172 X-Request-Id:
173 - fcbd5fba-98a8-4732-8f0f-2208d6ad5d1b
174 X-Runtime:
175 - '0.014583'
176 X-XSS-Protection:
177 - 1; mode=block
178 status:
179 code: 200
180 message: OK
181- request:
182 body: status=only+real+cars+respond.
183 headers:
184 Accept:
185 - '*/*'
186 Accept-Encoding:
187 - gzip, deflate
188 Authorization:
189 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
190 Connection:
191 - keep-alive
192 Content-Length:
193 - '30'
194 Content-Type:
195 - application/x-www-form-urlencoded
196 User-Agent:
197 - tests/v311
198 method: POST
199 uri: http://localhost:3000/api/v1/statuses
200 response:
201 body:
202 string: '{"id":"109367699921291445","created_at":"2022-11-19T00:44:23.351Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109367699921291445","url":"http://localhost:3000/@mastodonpy_test/109367699921291445","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eonly
203 real cars respond.\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
204 test suite","website":null},"account":{"id":"109367691239664003","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John
205 Lennon","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-19T00:00:00.000Z","note":"\u003cp\u003eI
206 walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/109/367/691/239/664/003/original/1063e26998b14a98.jpg","avatar_static":"http://localhost:3000/system/accounts/avatars/109/367/691/239/664/003/original/1063e26998b14a98.jpg","header":"http://localhost:3000/system/accounts/headers/109/367/691/239/664/003/original/a07903ff76e88927.jpg","header_static":"http://localhost:3000/system/accounts/headers/109/367/691/239/664/003/original/a07903ff76e88927.jpg","followers_count":0,"following_count":0,"statuses_count":4,"last_status_at":"2022-11-19","noindex":false,"emojis":[],"fields":[{"name":"bread","value":"toasty.","verified_at":null},{"name":"lasagna","value":"no!!!","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
207 headers:
208 Cache-Control:
209 - no-store
210 Content-Security-Policy:
211 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
212 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
213 style-src ''self'' http://localhost:3000 ''nonce-yaxVWTVsScKR3xUZ4eF6vg=='';
214 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
215 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
216 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
217 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
218 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
219 worker-src ''self'' blob: http://localhost:3000'
220 Content-Type:
221 - application/json; charset=utf-8
222 ETag:
223 - W/"34d28289bc71d5b9c6804423f47d6487"
224 Referrer-Policy:
225 - strict-origin-when-cross-origin
226 Transfer-Encoding:
227 - chunked
228 Vary:
229 - Accept, Origin
230 X-Content-Type-Options:
231 - nosniff
232 X-Download-Options:
233 - noopen
234 X-Frame-Options:
235 - SAMEORIGIN
236 X-Permitted-Cross-Domain-Policies:
237 - none
238 X-RateLimit-Limit:
239 - '300'
240 X-RateLimit-Remaining:
241 - '197'
242 X-RateLimit-Reset:
243 - '2022-11-19T03:00:00.373872Z'
244 X-Request-Id:
245 - 11cb9926-88b8-4cea-a8e7-9d789c2caace
246 X-Runtime:
247 - '0.036137'
248 X-XSS-Protection:
249 - 1; mode=block
250 status:
251 code: 200
252 message: OK
253- request:
254 body: status=%40mastodonpy_test+beep+beep+I%27m+a+jeep
255 headers:
256 Accept:
257 - '*/*'
258 Accept-Encoding:
259 - gzip, deflate
260 Authorization:
261 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
262 Connection:
263 - keep-alive
264 Content-Length:
265 - '48'
266 Content-Type:
267 - application/x-www-form-urlencoded
268 User-Agent:
269 - tests/v311
270 method: POST
271 uri: http://localhost:3000/api/v1/statuses
272 response:
273 body:
274 string: '{"id":"109367699924056287","created_at":"2022-11-19T00:44:23.392Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/109367699924056287","url":"http://localhost:3000/@admin/109367699924056287","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003e\u003cspan
275 class=\"h-card\"\u003e\u003ca href=\"http://localhost:3000/@mastodonpy_test\"
276 class=\"u-url mention\"\u003e@\u003cspan\u003emastodonpy_test\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
277 beep beep I\u0026#39;m a jeep\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
278 test suite","website":null},"account":{"id":"109367691027217373","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-19T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":2,"last_status_at":"2022-11-19","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"109367691239664003","username":"mastodonpy_test","url":"http://localhost:3000/@mastodonpy_test","acct":"mastodonpy_test"}],"tags":[],"emojis":[],"card":null,"poll":null}'
279 headers:
280 Cache-Control:
281 - no-store
282 Content-Security-Policy:
283 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
284 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
285 style-src ''self'' http://localhost:3000 ''nonce-ikjD+DBbQitYrSnFeAsFpQ=='';
286 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
287 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
288 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
289 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
290 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
291 worker-src ''self'' blob: http://localhost:3000'
292 Content-Type:
293 - application/json; charset=utf-8
294 ETag:
295 - W/"dea24ce5a1114ebcc070153368ae7c87"
296 Referrer-Policy:
297 - strict-origin-when-cross-origin
298 Transfer-Encoding:
299 - chunked
300 Vary:
301 - Accept, Origin
302 X-Content-Type-Options:
303 - nosniff
304 X-Download-Options:
305 - noopen
306 X-Frame-Options:
307 - SAMEORIGIN
308 X-Permitted-Cross-Domain-Policies:
309 - none
310 X-RateLimit-Limit:
311 - '300'
312 X-RateLimit-Remaining:
313 - '292'
314 X-RateLimit-Reset:
315 - '2022-11-19T03:00:00.420318Z'
316 X-Request-Id:
317 - 09808480-5f85-4056-a5cf-66d77d39387f
318 X-Runtime:
319 - '0.041923'
320 X-XSS-Protection:
321 - 1; mode=block
322 status:
323 code: 200
324 message: OK
325- request:
326 body: status=on+the+internet%2C+nobody+knows+you%27re+a+plane
327 headers:
328 Accept:
329 - '*/*'
330 Accept-Encoding:
331 - gzip, deflate
332 Authorization:
333 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
334 Connection:
335 - keep-alive
336 Content-Length:
337 - '55'
338 Content-Type:
339 - application/x-www-form-urlencoded
340 User-Agent:
341 - tests/v311
342 method: POST
343 uri: http://localhost:3000/api/v1/statuses
344 response:
345 body:
346 string: '{"id":"109367699926909097","created_at":"2022-11-19T00:44:23.437Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/109367699926909097","url":"http://localhost:3000/@admin/109367699926909097","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eon
347 the internet, nobody knows you\u0026#39;re a plane\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
348 test suite","website":null},"account":{"id":"109367691027217373","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-19T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2022-11-19","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
349 headers:
350 Cache-Control:
351 - no-store
352 Content-Security-Policy:
353 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
354 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
355 style-src ''self'' http://localhost:3000 ''nonce-QISgLKOQMPvBkfABjB8gDg=='';
356 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
357 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
358 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
359 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
360 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
361 worker-src ''self'' blob: http://localhost:3000'
362 Content-Type:
363 - application/json; charset=utf-8
364 ETag:
365 - W/"a7417f75daa14f0c89ad7b07ba17b650"
366 Referrer-Policy:
367 - strict-origin-when-cross-origin
368 Transfer-Encoding:
369 - chunked
370 Vary:
371 - Accept, Origin
372 X-Content-Type-Options:
373 - nosniff
374 X-Download-Options:
375 - noopen
376 X-Frame-Options:
377 - SAMEORIGIN
378 X-Permitted-Cross-Domain-Policies:
379 - none
380 X-RateLimit-Limit:
381 - '300'
382 X-RateLimit-Remaining:
383 - '291'
384 X-RateLimit-Reset:
385 - '2022-11-19T03:00:00.458817Z'
386 X-Request-Id:
387 - 8a0b34ba-9b12-48fd-8537-95e26592ac9b
388 X-Runtime:
389 - '0.033981'
390 X-XSS-Protection:
391 - 1; mode=block
392 status:
393 code: 200
394 message: OK
395- request:
396 body: null
397 headers:
398 Accept:
399 - '*/*'
400 Accept-Encoding:
401 - gzip, deflate
402 Authorization:
403 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
404 Connection:
405 - keep-alive
406 Content-Length:
407 - '0'
408 User-Agent:
409 - tests/v311
410 method: DELETE
411 uri: http://localhost:3000/api/v1/statuses/109367699921291445
412 response:
413 body:
414 string: '{"id":"109367699921291445","created_at":"2022-11-19T00:44:23.351Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109367699921291445","url":"http://localhost:3000/@mastodonpy_test/109367699921291445","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"only
415 real cars respond.","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
416 test suite","website":null},"account":{"id":"109367691239664003","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John
417 Lennon","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-19T00:00:00.000Z","note":"\u003cp\u003eI
418 walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/109/367/691/239/664/003/original/1063e26998b14a98.jpg","avatar_static":"http://localhost:3000/system/accounts/avatars/109/367/691/239/664/003/original/1063e26998b14a98.jpg","header":"http://localhost:3000/system/accounts/headers/109/367/691/239/664/003/original/a07903ff76e88927.jpg","header_static":"http://localhost:3000/system/accounts/headers/109/367/691/239/664/003/original/a07903ff76e88927.jpg","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2022-11-19","noindex":false,"emojis":[],"fields":[{"name":"bread","value":"toasty.","verified_at":null},{"name":"lasagna","value":"no!!!","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
419 headers:
420 Cache-Control:
421 - no-store
422 Content-Security-Policy:
423 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
424 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
425 style-src ''self'' http://localhost:3000 ''nonce-aDzpwxogW5FIyDBCXY45YA=='';
426 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
427 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
428 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
429 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
430 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
431 worker-src ''self'' blob: http://localhost:3000'
432 Content-Type:
433 - application/json; charset=utf-8
434 ETag:
435 - W/"caecd1af13a79dfcf8be78c44af330fc"
436 Referrer-Policy:
437 - strict-origin-when-cross-origin
438 Transfer-Encoding:
439 - chunked
440 Vary:
441 - Accept, Origin
442 X-Content-Type-Options:
443 - nosniff
444 X-Download-Options:
445 - noopen
446 X-Frame-Options:
447 - SAMEORIGIN
448 X-Permitted-Cross-Domain-Policies:
449 - none
450 X-Request-Id:
451 - ec084bf8-c76b-469e-b1fd-135c04b71403
452 X-Runtime:
453 - '0.035232'
454 X-XSS-Protection:
455 - 1; mode=block
456 status:
457 code: 200
458 message: OK
459- request:
460 body: null
461 headers:
462 Accept:
463 - '*/*'
464 Accept-Encoding:
465 - gzip, deflate
466 Authorization:
467 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
468 Connection:
469 - keep-alive
470 User-Agent:
471 - tests/v311
472 method: GET
473 uri: http://localhost:4000/api/v1/streaming/user
474 response:
475 body:
476 string: ':)
477
478 event: update
479
480 data: {"id":"109367699921291445","created_at":"2022-11-19T00:44:23.351Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109367699921291445","url":"http://localhost:3000/@mastodonpy_test/109367699921291445","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"content":"<p>only
481 real cars respond.</p>","reblog":null,"application":{"name":"Mastodon.py test
482 suite","website":null},"account":{"id":"109367691239664003","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John
483 Lennon","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-19T00:00:00.000Z","note":"<p>I
484 walk funny</p>","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/109/367/691/239/664/003/original/1063e26998b14a98.jpg","avatar_static":"http://localhost:3000/system/accounts/avatars/109/367/691/239/664/003/original/1063e26998b14a98.jpg","header":"http://localhost:3000/system/accounts/headers/109/367/691/239/664/003/original/a07903ff76e88927.jpg","header_static":"http://localhost:3000/system/accounts/headers/109/367/691/239/664/003/original/a07903ff76e88927.jpg","followers_count":0,"following_count":0,"statuses_count":4,"last_status_at":"2022-11-19","noindex":false,"emojis":[],"fields":[{"name":"bread","value":"toasty.","verified_at":null},{"name":"lasagna","value":"no!!!","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"filtered":[]}
485
486
487 event: notification
488
489 data: {"id":"17","type":"mention","created_at":"2022-11-19T00:44:23.807Z","account":{"id":"109367691027217373","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-19T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2022-11-19","noindex":false,"emojis":[],"fields":[]},"status":{"id":"109367699924056287","created_at":"2022-11-19T00:44:23.392Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/109367699924056287","url":"http://localhost:3000/@admin/109367699924056287","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"content":"<p><span
490 class=\"h-card\"><a href=\"http://localhost:3000/@mastodonpy_test\" class=\"u-url
491 mention\">@<span>mastodonpy_test</span></a></span> beep beep I&#39;m a jeep</p>","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
492 test suite","website":null},"account":{"id":"109367691027217373","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-19T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2022-11-19","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"109367691239664003","username":"mastodonpy_test","url":"http://localhost:3000/@mastodonpy_test","acct":"mastodonpy_test"}],"tags":[],"emojis":[],"card":null,"poll":null}}
493
494
495 event: delete
496
497 data: 109367699921291445
498
499
500 :'
501 headers:
502 Access-Control-Allow-Headers:
503 - Authorization, Accept, Cache-Control
504 Access-Control-Allow-Methods:
505 - GET, OPTIONS
506 Access-Control-Allow-Origin:
507 - '*'
508 Cache-Control:
509 - no-store
510 Connection:
511 - keep-alive
512 Content-Type:
513 - text/event-stream
514 Date:
515 - Sat, 19 Nov 2022 00:44:18 GMT
516 Keep-Alive:
517 - timeout=5
518 Transfer-Encoding:
519 - chunked
520 X-Powered-By:
521 - Express
522 X-Request-Id:
523 - a22d2bc5-865d-4c8d-a980-1d7da5af8e95
524 status:
525 code: 200
526 message: OK
527version: 1
diff --git a/tests/cassettes/test_stream_user_direct.yaml b/tests/cassettes/test_stream_user_direct.yaml
new file mode 100644
index 0000000..0cbfab4
--- /dev/null
+++ b/tests/cassettes/test_stream_user_direct.yaml
@@ -0,0 +1,720 @@
1interactions:
2- request:
3 body: null
4 headers:
5 Accept:
6 - '*/*'
7 Accept-Encoding:
8 - gzip, deflate
9 Authorization:
10 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
11 Connection:
12 - keep-alive
13 User-Agent:
14 - tests/v311
15 method: GET
16 uri: http://localhost:3000/api/v1/accounts/verify_credentials
17 response:
18 body:
19 string: '{"id":"109383529410918485","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":16,"last_status_at":"2022-11-21","noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"3","name":"Owner","permissions":"1048575","color":"","highlighted":true}}'
20 headers:
21 Cache-Control:
22 - no-store
23 Content-Security-Policy:
24 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
25 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
26 style-src ''self'' http://localhost:3000 ''nonce-ET94sC1kcWUi3ZBoLTM2wg=='';
27 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
28 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
29 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
30 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
31 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
32 worker-src ''self'' blob: http://localhost:3000'
33 Content-Type:
34 - application/json; charset=utf-8
35 ETag:
36 - W/"144b02ef94a45f45c374fb3a8922aaec"
37 Referrer-Policy:
38 - strict-origin-when-cross-origin
39 Transfer-Encoding:
40 - chunked
41 Vary:
42 - Accept, Origin
43 X-Content-Type-Options:
44 - nosniff
45 X-Download-Options:
46 - noopen
47 X-Frame-Options:
48 - SAMEORIGIN
49 X-Permitted-Cross-Domain-Policies:
50 - none
51 X-Request-Id:
52 - 25cbb607-979c-4224-9225-03d1a3d1457c
53 X-Runtime:
54 - '0.013782'
55 X-XSS-Protection:
56 - 1; mode=block
57 status:
58 code: 200
59 message: OK
60- request:
61 body: null
62 headers:
63 Accept:
64 - '*/*'
65 Accept-Encoding:
66 - gzip, deflate
67 Authorization:
68 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
69 Connection:
70 - keep-alive
71 Content-Length:
72 - '0'
73 User-Agent:
74 - tests/v311
75 method: POST
76 uri: http://localhost:3000/api/v1/accounts/109383529410918485/unfollow
77 response:
78 body:
79 string: '{"id":"109383529410918485","following":false,"showing_reblogs":false,"notifying":false,"languages":null,"followed_by":false,"blocking":false,"blocked_by":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false,"endorsed":false,"note":""}'
80 headers:
81 Cache-Control:
82 - no-store
83 Content-Security-Policy:
84 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
85 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
86 style-src ''self'' http://localhost:3000 ''nonce-+u1X84vonzotT6Qef/iMHw=='';
87 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
88 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
89 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
90 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
91 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
92 worker-src ''self'' blob: http://localhost:3000'
93 Content-Type:
94 - application/json; charset=utf-8
95 ETag:
96 - W/"7efb245175d0201afa91b82fea1ccd29"
97 Referrer-Policy:
98 - strict-origin-when-cross-origin
99 Transfer-Encoding:
100 - chunked
101 Vary:
102 - Accept, Origin
103 X-Content-Type-Options:
104 - nosniff
105 X-Download-Options:
106 - noopen
107 X-Frame-Options:
108 - SAMEORIGIN
109 X-Permitted-Cross-Domain-Policies:
110 - none
111 X-Request-Id:
112 - 0ca7ed70-c4df-4871-a7ec-113d51508d49
113 X-Runtime:
114 - '0.012556'
115 X-XSS-Protection:
116 - 1; mode=block
117 status:
118 code: 200
119 message: OK
120- request:
121 body: null
122 headers:
123 Accept:
124 - '*/*'
125 Accept-Encoding:
126 - gzip, deflate
127 Authorization:
128 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
129 Connection:
130 - keep-alive
131 User-Agent:
132 - tests/v311
133 method: GET
134 uri: http://localhost:3000/api/v1/instance/
135 response:
136 body:
137 string: '{"uri":"localhost:3000","title":"Mastodon","short_description":"","description":"","email":"","version":"4.0.0rc2","urls":{"streaming_api":"ws://localhost:4000"},"stats":{"user_count":4,"status_count":17,"domain_count":0},"thumbnail":"http://localhost:3000/packs/media/images/preview-6399aebd96ccf025654e2977454f168f.png","languages":["en"],"registrations":true,"approval_required":false,"invites_enabled":true,"configuration":{"accounts":{"max_featured_tags":10},"statuses":{"max_characters":500,"max_media_attachments":4,"characters_reserved_per_url":23},"media_attachments":{"supported_mime_types":["image/jpeg","image/png","image/gif","image/heic","image/heif","image/webp","image/avif","video/webm","video/mp4","video/quicktime","video/ogg","audio/wave","audio/wav","audio/x-wav","audio/x-pn-wave","audio/vnd.wave","audio/ogg","audio/vorbis","audio/mpeg","audio/mp3","audio/webm","audio/flac","audio/aac","audio/m4a","audio/x-m4a","audio/mp4","audio/3gpp","video/x-ms-asf"],"image_size_limit":10485760,"image_matrix_limit":16777216,"video_size_limit":41943040,"video_frame_rate_limit":60,"video_matrix_limit":2304000},"polls":{"max_options":4,"max_characters_per_option":50,"min_expiration":300,"max_expiration":2629746}},"contact_account":null,"rules":[]}'
138 headers:
139 Cache-Control:
140 - max-age=180, public
141 Content-Security-Policy:
142 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
143 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
144 style-src ''self'' http://localhost:3000 ''nonce-5JMlVRDK8VKwBMhHf7JP8A=='';
145 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
146 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
147 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
148 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
149 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
150 worker-src ''self'' blob: http://localhost:3000'
151 Content-Type:
152 - application/json; charset=utf-8
153 Date:
154 - Mon, 21 Nov 2022 20:13:56 GMT
155 ETag:
156 - W/"7792b9fe75ecfce5f9baf0e462140af6"
157 Referrer-Policy:
158 - strict-origin-when-cross-origin
159 Transfer-Encoding:
160 - chunked
161 Vary:
162 - Accept, Origin
163 X-Content-Type-Options:
164 - nosniff
165 X-Download-Options:
166 - noopen
167 X-Frame-Options:
168 - SAMEORIGIN
169 X-Permitted-Cross-Domain-Policies:
170 - none
171 X-Request-Id:
172 - 2a6765ba-92fa-4fa5-adfa-29f4a073fd8c
173 X-Runtime:
174 - '0.014781'
175 X-XSS-Protection:
176 - 1; mode=block
177 status:
178 code: 200
179 message: OK
180- request:
181 body: null
182 headers:
183 Accept:
184 - '*/*'
185 Accept-Encoding:
186 - gzip, deflate
187 Authorization:
188 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
189 Connection:
190 - keep-alive
191 User-Agent:
192 - tests/v311
193 method: GET
194 uri: http://localhost:3000/api/v1/instance/
195 response:
196 body:
197 string: '{"uri":"localhost:3000","title":"Mastodon","short_description":"","description":"","email":"","version":"4.0.0rc2","urls":{"streaming_api":"ws://localhost:4000"},"stats":{"user_count":4,"status_count":17,"domain_count":0},"thumbnail":"http://localhost:3000/packs/media/images/preview-6399aebd96ccf025654e2977454f168f.png","languages":["en"],"registrations":true,"approval_required":false,"invites_enabled":true,"configuration":{"accounts":{"max_featured_tags":10},"statuses":{"max_characters":500,"max_media_attachments":4,"characters_reserved_per_url":23},"media_attachments":{"supported_mime_types":["image/jpeg","image/png","image/gif","image/heic","image/heif","image/webp","image/avif","video/webm","video/mp4","video/quicktime","video/ogg","audio/wave","audio/wav","audio/x-wav","audio/x-pn-wave","audio/vnd.wave","audio/ogg","audio/vorbis","audio/mpeg","audio/mp3","audio/webm","audio/flac","audio/aac","audio/m4a","audio/x-m4a","audio/mp4","audio/3gpp","video/x-ms-asf"],"image_size_limit":10485760,"image_matrix_limit":16777216,"video_size_limit":41943040,"video_frame_rate_limit":60,"video_matrix_limit":2304000},"polls":{"max_options":4,"max_characters_per_option":50,"min_expiration":300,"max_expiration":2629746}},"contact_account":null,"rules":[]}'
198 headers:
199 Cache-Control:
200 - max-age=180, public
201 Content-Security-Policy:
202 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
203 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
204 style-src ''self'' http://localhost:3000 ''nonce-TavEqr9+UNgt+zhP741V1w=='';
205 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
206 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
207 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
208 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
209 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
210 worker-src ''self'' blob: http://localhost:3000'
211 Content-Type:
212 - application/json; charset=utf-8
213 Date:
214 - Mon, 21 Nov 2022 20:13:56 GMT
215 ETag:
216 - W/"7792b9fe75ecfce5f9baf0e462140af6"
217 Referrer-Policy:
218 - strict-origin-when-cross-origin
219 Transfer-Encoding:
220 - chunked
221 Vary:
222 - Accept, Origin
223 X-Content-Type-Options:
224 - nosniff
225 X-Download-Options:
226 - noopen
227 X-Frame-Options:
228 - SAMEORIGIN
229 X-Permitted-Cross-Domain-Policies:
230 - none
231 X-Request-Id:
232 - 402737ac-96c3-4d4a-91a4-a1b804de990f
233 X-Runtime:
234 - '0.015024'
235 X-XSS-Protection:
236 - 1; mode=block
237 status:
238 code: 200
239 message: OK
240- request:
241 body: status=only+real+cars+respond.
242 headers:
243 Accept:
244 - '*/*'
245 Accept-Encoding:
246 - gzip, deflate
247 Authorization:
248 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
249 Connection:
250 - keep-alive
251 Content-Length:
252 - '30'
253 Content-Type:
254 - application/x-www-form-urlencoded
255 User-Agent:
256 - tests/v311
257 method: POST
258 uri: http://localhost:3000/api/v1/statuses
259 response:
260 body:
261 string: '{"id":"109383623709269987","created_at":"2022-11-21T20:14:01.073Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109383623709269987","url":"http://localhost:3000/@mastodonpy_test/109383623709269987","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eonly
262 real cars respond.\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
263 test suite","website":null},"account":{"id":"109383529633422716","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":2,"last_status_at":"2022-11-21","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
264 headers:
265 Cache-Control:
266 - no-store
267 Content-Security-Policy:
268 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
269 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
270 style-src ''self'' http://localhost:3000 ''nonce-Zsmmvt1eANHAkGfCQKOf6g=='';
271 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
272 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
273 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
274 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
275 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
276 worker-src ''self'' blob: http://localhost:3000'
277 Content-Type:
278 - application/json; charset=utf-8
279 ETag:
280 - W/"e71985ba86e5e8d1bc4bcdab8da2c25d"
281 Referrer-Policy:
282 - strict-origin-when-cross-origin
283 Transfer-Encoding:
284 - chunked
285 Vary:
286 - Accept, Origin
287 X-Content-Type-Options:
288 - nosniff
289 X-Download-Options:
290 - noopen
291 X-Frame-Options:
292 - SAMEORIGIN
293 X-Permitted-Cross-Domain-Policies:
294 - none
295 X-RateLimit-Limit:
296 - '300'
297 X-RateLimit-Remaining:
298 - '285'
299 X-RateLimit-Reset:
300 - '2022-11-21T21:00:00.103374Z'
301 X-Request-Id:
302 - 157d7170-a9f4-497f-ba94-dbd4ab917866
303 X-Runtime:
304 - '0.043576'
305 X-XSS-Protection:
306 - 1; mode=block
307 status:
308 code: 200
309 message: OK
310- request:
311 body: status=%40mastodonpy_test+beep+beep+I%27m+a+jeep
312 headers:
313 Accept:
314 - '*/*'
315 Accept-Encoding:
316 - gzip, deflate
317 Authorization:
318 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
319 Connection:
320 - keep-alive
321 Content-Length:
322 - '48'
323 Content-Type:
324 - application/x-www-form-urlencoded
325 User-Agent:
326 - tests/v311
327 method: POST
328 uri: http://localhost:3000/api/v1/statuses
329 response:
330 body:
331 string: '{"id":"109383623712389313","created_at":"2022-11-21T20:14:01.120Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/109383623712389313","url":"http://localhost:3000/@admin/109383623712389313","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003e\u003cspan
332 class=\"h-card\"\u003e\u003ca href=\"http://localhost:3000/@mastodonpy_test\"
333 class=\"u-url mention\"\u003e@\u003cspan\u003emastodonpy_test\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
334 beep beep I\u0026#39;m a jeep\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
335 test suite","website":null},"account":{"id":"109383529410918485","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":17,"last_status_at":"2022-11-21","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"109383529633422716","username":"mastodonpy_test","url":"http://localhost:3000/@mastodonpy_test","acct":"mastodonpy_test"}],"tags":[],"emojis":[],"card":null,"poll":null}'
336 headers:
337 Cache-Control:
338 - no-store
339 Content-Security-Policy:
340 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
341 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
342 style-src ''self'' http://localhost:3000 ''nonce-k7kmLJMj7sp9WP2u0pnraQ=='';
343 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
344 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
345 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
346 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
347 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
348 worker-src ''self'' blob: http://localhost:3000'
349 Content-Type:
350 - application/json; charset=utf-8
351 ETag:
352 - W/"b35f9915f1cece26792c44debca04eba"
353 Referrer-Policy:
354 - strict-origin-when-cross-origin
355 Transfer-Encoding:
356 - chunked
357 Vary:
358 - Accept, Origin
359 X-Content-Type-Options:
360 - nosniff
361 X-Download-Options:
362 - noopen
363 X-Frame-Options:
364 - SAMEORIGIN
365 X-Permitted-Cross-Domain-Policies:
366 - none
367 X-RateLimit-Limit:
368 - '300'
369 X-RateLimit-Remaining:
370 - '280'
371 X-RateLimit-Reset:
372 - '2022-11-21T21:00:00.149734Z'
373 X-Request-Id:
374 - d3d2d232-2fa5-49fa-8772-3b3b67064f54
375 X-Runtime:
376 - '0.041829'
377 X-XSS-Protection:
378 - 1; mode=block
379 status:
380 code: 200
381 message: OK
382- request:
383 body: status=on+the+internet%2C+nobody+knows+you%27re+a+plane
384 headers:
385 Accept:
386 - '*/*'
387 Accept-Encoding:
388 - gzip, deflate
389 Authorization:
390 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
391 Connection:
392 - keep-alive
393 Content-Length:
394 - '55'
395 Content-Type:
396 - application/x-www-form-urlencoded
397 User-Agent:
398 - tests/v311
399 method: POST
400 uri: http://localhost:3000/api/v1/statuses
401 response:
402 body:
403 string: '{"id":"109383623715420903","created_at":"2022-11-21T20:14:01.169Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/109383623715420903","url":"http://localhost:3000/@admin/109383623715420903","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eon
404 the internet, nobody knows you\u0026#39;re a plane\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
405 test suite","website":null},"account":{"id":"109383529410918485","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":18,"last_status_at":"2022-11-21","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
406 headers:
407 Cache-Control:
408 - no-store
409 Content-Security-Policy:
410 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
411 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
412 style-src ''self'' http://localhost:3000 ''nonce-9+Q9FOAegtpbnJdbGAkEug=='';
413 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
414 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
415 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
416 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
417 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
418 worker-src ''self'' blob: http://localhost:3000'
419 Content-Type:
420 - application/json; charset=utf-8
421 ETag:
422 - W/"3c61174bb890d47140b41b069ab12ac9"
423 Referrer-Policy:
424 - strict-origin-when-cross-origin
425 Transfer-Encoding:
426 - chunked
427 Vary:
428 - Accept, Origin
429 X-Content-Type-Options:
430 - nosniff
431 X-Download-Options:
432 - noopen
433 X-Frame-Options:
434 - SAMEORIGIN
435 X-Permitted-Cross-Domain-Policies:
436 - none
437 X-RateLimit-Limit:
438 - '300'
439 X-RateLimit-Remaining:
440 - '279'
441 X-RateLimit-Reset:
442 - '2022-11-21T21:00:00.191358Z'
443 X-Request-Id:
444 - ed13758c-2add-437f-b536-aa2ae20a5053
445 X-Runtime:
446 - '0.037447'
447 X-XSS-Protection:
448 - 1; mode=block
449 status:
450 code: 200
451 message: OK
452- request:
453 body: status=%40mastodonpy_test_2+pssssst&visibility=direct
454 headers:
455 Accept:
456 - '*/*'
457 Accept-Encoding:
458 - gzip, deflate
459 Authorization:
460 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
461 Connection:
462 - keep-alive
463 Content-Length:
464 - '53'
465 Content-Type:
466 - application/x-www-form-urlencoded
467 User-Agent:
468 - tests/v311
469 method: POST
470 uri: http://localhost:3000/api/v1/statuses
471 response:
472 body:
473 string: '{"id":"109383623718220008","created_at":"2022-11-21T20:14:01.210Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109383623718220008","url":"http://localhost:3000/@mastodonpy_test/109383623718220008","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"content":"\u003cp\u003e\u003cspan
474 class=\"h-card\"\u003e\u003ca href=\"http://localhost:3000/@mastodonpy_test_2\"
475 class=\"u-url mention\"\u003e@\u003cspan\u003emastodonpy_test_2\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
476 pssssst\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
477 test suite","website":null},"account":{"id":"109383529633422716","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":2,"last_status_at":"2022-11-21","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"109383529748114399","username":"mastodonpy_test_2","url":"http://localhost:3000/@mastodonpy_test_2","acct":"mastodonpy_test_2"}],"tags":[],"emojis":[],"card":null,"poll":null}'
478 headers:
479 Cache-Control:
480 - no-store
481 Content-Security-Policy:
482 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
483 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
484 style-src ''self'' http://localhost:3000 ''nonce-NMEtgbxDe9RTVEV5T0VkFQ=='';
485 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
486 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
487 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
488 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
489 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
490 worker-src ''self'' blob: http://localhost:3000'
491 Content-Type:
492 - application/json; charset=utf-8
493 ETag:
494 - W/"a1283cb3e5a11bb0564976ccbb7ebff5"
495 Referrer-Policy:
496 - strict-origin-when-cross-origin
497 Transfer-Encoding:
498 - chunked
499 Vary:
500 - Accept, Origin
501 X-Content-Type-Options:
502 - nosniff
503 X-Download-Options:
504 - noopen
505 X-Frame-Options:
506 - SAMEORIGIN
507 X-Permitted-Cross-Domain-Policies:
508 - none
509 X-RateLimit-Limit:
510 - '300'
511 X-RateLimit-Remaining:
512 - '284'
513 X-RateLimit-Reset:
514 - '2022-11-21T21:00:00.235386Z'
515 X-Request-Id:
516 - dc8e6c3d-f368-47a0-88cc-cd1a7c48ad46
517 X-Runtime:
518 - '0.039590'
519 X-XSS-Protection:
520 - 1; mode=block
521 status:
522 code: 200
523 message: OK
524- request:
525 body: status=%40mastodonpy_test+pssssst%21&in_reply_to_id=109383623718220008&visibility=direct
526 headers:
527 Accept:
528 - '*/*'
529 Accept-Encoding:
530 - gzip, deflate
531 Authorization:
532 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_3
533 Connection:
534 - keep-alive
535 Content-Length:
536 - '88'
537 Content-Type:
538 - application/x-www-form-urlencoded
539 User-Agent:
540 - tests/v311
541 method: POST
542 uri: http://localhost:3000/api/v1/statuses
543 response:
544 body:
545 string: '{"id":"109383623721213270","created_at":"2022-11-21T20:14:01.254Z","in_reply_to_id":"109383623718220008","in_reply_to_account_id":"109383529633422716","sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test_2/statuses/109383623721213270","url":"http://localhost:3000/@mastodonpy_test_2/109383623721213270","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"content":"\u003cp\u003e\u003cspan
546 class=\"h-card\"\u003e\u003ca href=\"http://localhost:3000/@mastodonpy_test\"
547 class=\"u-url mention\"\u003e@\u003cspan\u003emastodonpy_test\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
548 pssssst!\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
549 test suite","website":null},"account":{"id":"109383529748114399","username":"mastodonpy_test_2","acct":"mastodonpy_test_2","display_name":"","locked":false,"bot":false,"discoverable":true,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test_2","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"109383529633422716","username":"mastodonpy_test","url":"http://localhost:3000/@mastodonpy_test","acct":"mastodonpy_test"}],"tags":[],"emojis":[],"card":null,"poll":null}'
550 headers:
551 Cache-Control:
552 - no-store
553 Content-Security-Policy:
554 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
555 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
556 style-src ''self'' http://localhost:3000 ''nonce-7YEjO6vMIqTvJKy3sj/xIA=='';
557 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
558 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
559 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
560 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
561 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
562 worker-src ''self'' blob: http://localhost:3000'
563 Content-Type:
564 - application/json; charset=utf-8
565 ETag:
566 - W/"59913e3afba82470c492a1dc9244a397"
567 Referrer-Policy:
568 - strict-origin-when-cross-origin
569 Transfer-Encoding:
570 - chunked
571 Vary:
572 - Accept, Origin
573 X-Content-Type-Options:
574 - nosniff
575 X-Download-Options:
576 - noopen
577 X-Frame-Options:
578 - SAMEORIGIN
579 X-Permitted-Cross-Domain-Policies:
580 - none
581 X-RateLimit-Limit:
582 - '300'
583 X-RateLimit-Remaining:
584 - '294'
585 X-RateLimit-Reset:
586 - '2022-11-21T21:00:00.280471Z'
587 X-Request-Id:
588 - 8680daf1-f5f8-479a-a914-eff562c2e6e6
589 X-Runtime:
590 - '0.039804'
591 X-XSS-Protection:
592 - 1; mode=block
593 status:
594 code: 200
595 message: OK
596- request:
597 body: null
598 headers:
599 Accept:
600 - '*/*'
601 Accept-Encoding:
602 - gzip, deflate
603 Authorization:
604 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
605 Connection:
606 - keep-alive
607 Content-Length:
608 - '0'
609 User-Agent:
610 - tests/v311
611 method: DELETE
612 uri: http://localhost:3000/api/v1/statuses/109383623709269987
613 response:
614 body:
615 string: '{"id":"109383623709269987","created_at":"2022-11-21T20:14:01.073Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109383623709269987","url":"http://localhost:3000/@mastodonpy_test/109383623709269987","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"only
616 real cars respond.","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
617 test suite","website":null},"account":{"id":"109383529633422716","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"last_status_at":"2022-11-21","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
618 headers:
619 Cache-Control:
620 - no-store
621 Content-Security-Policy:
622 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
623 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
624 style-src ''self'' http://localhost:3000 ''nonce-1cfdgJeSR3MyZA7YkUvM6A=='';
625 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
626 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
627 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
628 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
629 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
630 worker-src ''self'' blob: http://localhost:3000'
631 Content-Type:
632 - application/json; charset=utf-8
633 ETag:
634 - W/"d42a2551941b52102f8958f3e13b0f6b"
635 Referrer-Policy:
636 - strict-origin-when-cross-origin
637 Transfer-Encoding:
638 - chunked
639 Vary:
640 - Accept, Origin
641 X-Content-Type-Options:
642 - nosniff
643 X-Download-Options:
644 - noopen
645 X-Frame-Options:
646 - SAMEORIGIN
647 X-Permitted-Cross-Domain-Policies:
648 - none
649 X-Request-Id:
650 - 4afaa85a-3032-4072-95b5-e39f5c021080
651 X-Runtime:
652 - '0.025629'
653 X-XSS-Protection:
654 - 1; mode=block
655 status:
656 code: 200
657 message: OK
658- request:
659 body: null
660 headers:
661 Accept:
662 - '*/*'
663 Accept-Encoding:
664 - gzip, deflate
665 Authorization:
666 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
667 Connection:
668 - keep-alive
669 User-Agent:
670 - tests/v311
671 method: GET
672 uri: http://localhost:4000/api/v1/streaming/direct
673 response:
674 body:
675 string: ':)
676
677 event: conversation
678
679 data: {"id":"17","unread":false,"accounts":[{"id":"109383529748114399","username":"mastodonpy_test_2","acct":"mastodonpy_test_2","display_name":"","locked":false,"bot":false,"discoverable":true,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test_2","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"emojis":[],"fields":[]}],"last_status":{"id":"109383623718220008","created_at":"2022-11-21T20:14:01.210Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109383623718220008","url":"http://localhost:3000/@mastodonpy_test/109383623718220008","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"content":"<p><span
680 class=\"h-card\"><a href=\"http://localhost:3000/@mastodonpy_test_2\" class=\"u-url
681 mention\">@<span>mastodonpy_test_2</span></a></span> pssssst</p>","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
682 test suite","website":null},"account":{"id":"109383529633422716","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":2,"last_status_at":"2022-11-21","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"109383529748114399","username":"mastodonpy_test_2","url":"http://localhost:3000/@mastodonpy_test_2","acct":"mastodonpy_test_2"}],"tags":[],"emojis":[],"card":null,"poll":null}}
683
684
685 event: conversation
686
687 data: {"id":"17","unread":true,"accounts":[{"id":"109383529748114399","username":"mastodonpy_test_2","acct":"mastodonpy_test_2","display_name":"","locked":false,"bot":false,"discoverable":true,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test_2","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"emojis":[],"fields":[]}],"last_status":{"id":"109383623721213270","created_at":"2022-11-21T20:14:01.254Z","in_reply_to_id":"109383623718220008","in_reply_to_account_id":"109383529633422716","sensitive":false,"spoiler_text":"","visibility":"direct","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test_2/statuses/109383623721213270","url":"http://localhost:3000/@mastodonpy_test_2/109383623721213270","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"content":"<p><span
688 class=\"h-card\"><a href=\"http://localhost:3000/@mastodonpy_test\" class=\"u-url
689 mention\">@<span>mastodonpy_test</span></a></span> pssssst!</p>","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
690 test suite","website":null},"account":{"id":"109383529748114399","username":"mastodonpy_test_2","acct":"mastodonpy_test_2","display_name":"","locked":false,"bot":false,"discoverable":true,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test_2","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[{"id":"109383529633422716","username":"mastodonpy_test","url":"http://localhost:3000/@mastodonpy_test","acct":"mastodonpy_test"}],"tags":[],"emojis":[],"card":null,"poll":null}}
691
692
693 :'
694 headers:
695 Access-Control-Allow-Headers:
696 - Authorization, Accept, Cache-Control
697 Access-Control-Allow-Methods:
698 - GET, OPTIONS
699 Access-Control-Allow-Origin:
700 - '*'
701 Cache-Control:
702 - no-store
703 Connection:
704 - keep-alive
705 Content-Type:
706 - text/event-stream
707 Date:
708 - Mon, 21 Nov 2022 20:13:56 GMT
709 Keep-Alive:
710 - timeout=5
711 Transfer-Encoding:
712 - chunked
713 X-Powered-By:
714 - Express
715 X-Request-Id:
716 - f1606fe5-1e3e-4204-9a7a-e0a16cb080f1
717 status:
718 code: 200
719 message: OK
720version: 1
diff --git a/tests/test_streaming.py b/tests/test_streaming.py
index 53a71ee..721fabc 100644
--- a/tests/test_streaming.py
+++ b/tests/test_streaming.py
@@ -308,21 +308,31 @@ def test_multiline_payload():
308 assert listener.updates == [{"foo": "bar"}] 308 assert listener.updates == [{"foo": "bar"}]
309 309
310@pytest.mark.vcr(match_on=['path']) 310@pytest.mark.vcr(match_on=['path'])
311def test_stream_user(api, api2): 311def test_stream_user_direct(api, api2, api3):
312 patch_streaming() 312 patch_streaming()
313 313
314 # Make sure we are in the right state to not receive updates from api2 314 # Make sure we are in the right state to not receive updates from api2
315 user = api2.account_verify_credentials() 315 user = api2.account_verify_credentials()
316 api.account_unfollow(user) 316 api.account_unfollow(user)
317 time.sleep(2) 317 time.sleep(2)
318 318
319 updates = [] 319 updates = []
320 local_updates = []
320 notifications = [] 321 notifications = []
321 deletes = [] 322 deletes = []
323 conversations = []
322 listener = CallbackStreamListener( 324 listener = CallbackStreamListener(
323 update_handler = lambda x: updates.append(x), 325 update_handler = lambda x: updates.append(x),
326 local_update_handler = lambda x: local_updates.append(x),
324 notification_handler = lambda x: notifications.append(x), 327 notification_handler = lambda x: notifications.append(x),
325 delete_handler = lambda x: deletes.append(x) 328 delete_handler = lambda x: deletes.append(x),
329 conversation_handler = lambda x: conversations.append(x),
330 status_update_handler = lambda x: 0, # TODO
331 filters_changed_handler = lambda x: 0,
332 announcement_handler = lambda x: 0,
333 announcement_reaction_handler = lambda x: 0,
334 announcement_delete_handler = lambda x: 0,
335 encryted_message_handler = lambda x: 0,
326 ) 336 )
327 337
328 posted = [] 338 posted = []
@@ -331,6 +341,8 @@ def test_stream_user(api, api2):
331 posted.append(api.status_post("only real cars respond.")) 341 posted.append(api.status_post("only real cars respond."))
332 posted.append(api2.status_post("@mastodonpy_test beep beep I'm a jeep")) 342 posted.append(api2.status_post("@mastodonpy_test beep beep I'm a jeep"))
333 posted.append(api2.status_post("on the internet, nobody knows you're a plane")) 343 posted.append(api2.status_post("on the internet, nobody knows you're a plane"))
344 posted.append(api.status_post("@mastodonpy_test_2 pssssst", visibility="direct"))
345 posted.append(api3.status_post("@mastodonpy_test pssssst!", visibility="direct", in_reply_to_id=posted[-1]))
334 time.sleep(1) 346 time.sleep(1)
335 api.status_delete(posted[0]) 347 api.status_delete(posted[0])
336 time.sleep(10) 348 time.sleep(10)
@@ -340,13 +352,17 @@ def test_stream_user(api, api2):
340 t.start() 352 t.start()
341 353
342 stream = api.stream_user(listener, run_async=True) 354 stream = api.stream_user(listener, run_async=True)
355 stream2 = api.stream_direct(listener, run_async=True)
343 time.sleep(20) 356 time.sleep(20)
344 stream.close() 357 stream.close()
358 stream2.close()
345 359
346 assert len(updates) == 1 360 assert len(updates) == 2
347 assert len(notifications) == 1 361 assert len(local_updates) == 2
362 assert len(notifications) == 2
348 assert len(deletes) == 1 363 assert len(deletes) == 1
349 364 assert len(conversations) == 2
365
350 assert updates[0].id == posted[0].id 366 assert updates[0].id == posted[0].id
351 assert deletes[0] == posted[0].id 367 assert deletes[0] == posted[0].id
352 assert notifications[0].status.id == posted[1].id 368 assert notifications[0].status.id == posted[1].id
Powered by cgit v1.2.3 (git 2.41.0)