@@ -93,11 +93,6 @@ def handle_notitifcation(_notification):
9393 await asyncio .gather (notifier_task , return_exceptions = True )
9494
9595
96- @pytest .fixture
97- def room_api ():
98- return FishjamClient (FISHJAM_ID , FISHJAM_MANAGEMENT_TOKEN )
99-
100-
10196@pytest .fixture
10297def notifier ():
10398 notifier = FishjamNotifier (
@@ -115,15 +110,17 @@ async def test_room_created_deleted(
115110 ):
116111 event_checks = [ServerMessageRoomCreated , ServerMessageRoomDeleted ]
117112
113+ room_id_future : asyncio .Future = asyncio .get_event_loop ().create_future ()
118114 assert_task = asyncio .ensure_future (
119- assert_events (notifier , event_checks .copy ())
115+ assert_events (notifier , event_checks .copy (), room_id_future = room_id_future )
120116 )
121117 notifier_task = asyncio .ensure_future (notifier .connect ())
122118 try :
123119 await notifier .wait_ready ()
124120
125121 options = RoomOptions (webhook_url = WEBHOOK_URL )
126122 room = room_api .create_room (options = options )
123+ room_id_future .set_result (room .id )
127124
128125 room_api .delete_room (room .id )
129126
@@ -148,8 +145,9 @@ async def test_peer_connected_disconnected(
148145 ServerMessageRoomDeleted ,
149146 ]
150147
148+ room_id_future : asyncio .Future = asyncio .get_event_loop ().create_future ()
151149 assert_task = asyncio .ensure_future (
152- assert_events (notifier , event_checks .copy ())
150+ assert_events (notifier , event_checks .copy (), room_id_future = room_id_future )
153151 )
154152 notifier_task = asyncio .ensure_future (notifier .connect ())
155153 tasks = [assert_task , notifier_task ]
@@ -158,6 +156,7 @@ async def test_peer_connected_disconnected(
158156
159157 options = RoomOptions (webhook_url = WEBHOOK_URL )
160158 room = room_api .create_room (options = options )
159+ room_id_future .set_result (room .id )
161160
162161 peer , token = room_api .create_peer (room .id )
163162 peer_socket = PeerSocket (fishjam_url = FISHJAM_ID )
@@ -189,8 +188,9 @@ async def test_peer_connected_room_deleted(
189188 ServerMessageRoomDeleted ,
190189 ]
191190
191+ room_id_future : asyncio .Future = asyncio .get_event_loop ().create_future ()
192192 assert_task = asyncio .ensure_future (
193- assert_events (notifier , event_checks .copy ())
193+ assert_events (notifier , event_checks .copy (), room_id_future = room_id_future )
194194 )
195195 notifier_task = asyncio .ensure_future (notifier .connect ())
196196 tasks = [assert_task , notifier_task ]
@@ -199,6 +199,7 @@ async def test_peer_connected_room_deleted(
199199
200200 options = RoomOptions (webhook_url = WEBHOOK_URL )
201201 room = room_api .create_room (options = options )
202+ room_id_future .set_result (room .id )
202203 _peer , token = room_api .create_peer (room .id )
203204
204205 peer_socket = PeerSocket (fishjam_url = FISHJAM_ID )
@@ -217,7 +218,7 @@ async def test_peer_connected_room_deleted(
217218
218219 self .assert_webhook_events (event_checks , event_queue , room .id )
219220
220- def assert_webhook_events (self , event_checks , event_queue , room_id , timeout = 60 ):
221+ def assert_webhook_events (self , event_checks , event_queue , room_id , timeout = 15 ):
221222 deadline = time .monotonic () + timeout
222223 received = []
223224
0 commit comments