From 4f3afa85b2c2ee6266c6b72da57586d37bc49fda Mon Sep 17 00:00:00 2001 From: otariidae Date: Tue, 25 Oct 2022 01:21:53 +0900 Subject: [PATCH] improve tests --- backend/multicaster/test_one_to_multiple_cast_skyway.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/multicaster/test_one_to_multiple_cast_skyway.py b/backend/multicaster/test_one_to_multiple_cast_skyway.py index c521bbe6..5dbae5e4 100644 --- a/backend/multicaster/test_one_to_multiple_cast_skyway.py +++ b/backend/multicaster/test_one_to_multiple_cast_skyway.py @@ -52,10 +52,7 @@ async def test_connect_sender_with_invalid_sender_token(self) -> None: ) ) await asyncio.sleep(WAIT_STATE_CHANGE_SEC) - self.assertIn(DUMMY_ROOM_ID, rooms) - self.assertIsNone(rooms[DUMMY_ROOM_ID]["sender_socket"]) - self.assertEqual(len(rooms[DUMMY_ROOM_ID]["connections"]), 0) - self.assertEqual(rooms[DUMMY_ROOM_ID]["connect_num"], 0) + self.assertNotIn(DUMMY_ROOM_ID, rooms) await asyncio.sleep(WAIT_STATE_CHANGE_SEC) self.assertNotIn(DUMMY_ROOM_ID, rooms) @@ -81,10 +78,14 @@ async def test_connect_sender_with_valid_sender_token(self) -> None: await asyncio.sleep(WAIT_STATE_CHANGE_SEC) self.assertIn(DUMMY_ROOM_ID, rooms) self.assertIsNotNone(rooms[DUMMY_ROOM_ID]["sender_socket"]) + self.assertEqual(len(rooms[DUMMY_ROOM_ID]["connections"]), 1) + self.assertEqual(rooms[DUMMY_ROOM_ID]["connect_num"], 0) self.assertEqual( rooms[DUMMY_ROOM_ID]["skyway_room_id"], DUMMY_SKYWAY_ROOM_ID ) self.assertEqual(rooms[DUMMY_ROOM_ID]["peer_id"], DUMMY_PEER_ID) + await asyncio.sleep(WAIT_STATE_CHANGE_SEC) + self.assertNotIn(DUMMY_ROOM_ID, rooms) @patch("one_to_multiple_cast_skyway.SENDER_TOKEN", DUMMY_SENDER_TOKEN) async def test_connect_receiver(self) -> None: