aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhalcy <halcy@ARARAGI-KUN>2022-11-22 01:30:43 +0200
committerhalcy <halcy@ARARAGI-KUN>2022-11-22 01:30:43 +0200
commit8865d1123e88b4e8cd5893a7d37c49fffb960853 (patch)
treeed23d92b6e53811b63cb20beb82c3bb0f5eb07cc /tests/test_streaming.py
parentbf96add20c56b23d6c6a7e56de7caf67f0d8d421 (diff)
downloadmastodon.py-8865d1123e88b4e8cd5893a7d37c49fffb960853.tar.gz
Fix some tests, fix a pleroma specific date parsing issue
Diffstat (limited to 'tests/test_streaming.py')
-rw-r--r--tests/test_streaming.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/test_streaming.py b/tests/test_streaming.py
index 721fabc..9b96ab8 100644
--- a/tests/test_streaming.py
+++ b/tests/test_streaming.py
@@ -321,13 +321,14 @@ def test_stream_user_direct(api, api2, api3):
321 notifications = [] 321 notifications = []
322 deletes = [] 322 deletes = []
323 conversations = [] 323 conversations = []
324 edits = []
324 listener = CallbackStreamListener( 325 listener = CallbackStreamListener(
325 update_handler = lambda x: updates.append(x), 326 update_handler = lambda x: updates.append(x),
326 local_update_handler = lambda x: local_updates.append(x), 327 local_update_handler = lambda x: local_updates.append(x),
327 notification_handler = lambda x: notifications.append(x), 328 notification_handler = lambda x: notifications.append(x),
328 delete_handler = lambda x: deletes.append(x), 329 delete_handler = lambda x: deletes.append(x),
329 conversation_handler = lambda x: conversations.append(x), 330 conversation_handler = lambda x: conversations.append(x),
330 status_update_handler = lambda x: 0, # TODO 331 status_update_handler = lambda x: edits.append(x),
331 filters_changed_handler = lambda x: 0, 332 filters_changed_handler = lambda x: 0,
332 announcement_handler = lambda x: 0, 333 announcement_handler = lambda x: 0,
333 announcement_reaction_handler = lambda x: 0, 334 announcement_reaction_handler = lambda x: 0,
@@ -342,10 +343,13 @@ def test_stream_user_direct(api, api2, api3):
342 posted.append(api2.status_post("@mastodonpy_test beep beep I'm a jeep")) 343 posted.append(api2.status_post("@mastodonpy_test beep beep I'm a jeep"))
343 posted.append(api2.status_post("on the internet, nobody knows you're a plane")) 344 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(api.status_post("@mastodonpy_test_2 pssssst", visibility="direct"))
346 time.sleep(1)
345 posted.append(api3.status_post("@mastodonpy_test pssssst!", visibility="direct", in_reply_to_id=posted[-1])) 347 posted.append(api3.status_post("@mastodonpy_test pssssst!", visibility="direct", in_reply_to_id=posted[-1]))
348 time.sleep(2)
349 api.status_update(posted[0], "only real animals respond.")
346 time.sleep(1) 350 time.sleep(1)
347 api.status_delete(posted[0]) 351 api.status_delete(posted[0])
348 time.sleep(10) 352 time.sleep(7)
349 streaming_close() 353 streaming_close()
350 354
351 t = threading.Thread(args=(), target=do_activities) 355 t = threading.Thread(args=(), target=do_activities)
@@ -353,7 +357,7 @@ def test_stream_user_direct(api, api2, api3):
353 357
354 stream = api.stream_user(listener, run_async=True) 358 stream = api.stream_user(listener, run_async=True)
355 stream2 = api.stream_direct(listener, run_async=True) 359 stream2 = api.stream_direct(listener, run_async=True)
356 time.sleep(20) 360 time.sleep(25)
357 stream.close() 361 stream.close()
358 stream2.close() 362 stream2.close()
359 363
@@ -362,6 +366,7 @@ def test_stream_user_direct(api, api2, api3):
362 assert len(notifications) == 2 366 assert len(notifications) == 2
363 assert len(deletes) == 1 367 assert len(deletes) == 1
364 assert len(conversations) == 2 368 assert len(conversations) == 2
369 assert len(edits) == 1
365 370
366 assert updates[0].id == posted[0].id 371 assert updates[0].id == posted[0].id
367 assert deletes[0] == posted[0].id 372 assert deletes[0] == posted[0].id
Powered by cgit v1.2.3 (git 2.41.0)