def test_users_in_room_is_only_one(self): self.assert_in_room(False) act = self.activity_for_join() api.on_join(act, as_parser(act)) self.assert_in_room(True) act = self.activity_for_users_in_room() response_data = api.on_users_in_room(act, as_parser(act)) self.assertEqual(1, len(response_data[1]['object']['attachments']))
def test_users_in_room_is_correct_id(self): self.assert_in_room(False) act = self.activity_for_join() api.on_join(act, as_parser(act)) self.assert_in_room(True) act = self.activity_for_users_in_room() response_data = api.on_users_in_room(act, as_parser(act)) self.assertEqual(BaseTest.USER_ID, response_data[1]['object']['attachments'][0]['id'])
def test_users_in_room_status_code_200(self): self.create_channel_and_room() self.assert_in_room(False) act = self.activity_for_join() api.on_join(act, as_parser(act)) self.assert_in_room(True) act = self.activity_for_users_in_room() response_data = api.on_users_in_room(act, as_parser(act)) self.assertEqual(200, response_data[0])
def test_users_in_room_is_correct_name(self): self.assert_in_room(False) act = self.activity_for_join() api.on_join(act, as_parser(act)) self.assert_in_room(True) act = self.activity_for_users_in_room() response_data = api.on_users_in_room(act, as_parser(act)) self.assertEqual( ApiUsersInRoomTest.USER_NAME, b64d(response_data[1]['object']['attachments'][0]['displayName']))
def on_users_in_room(data: dict, activity: Activity) -> (int, Union[str, dict, None]): return api.on_users_in_room(data, activity)
def test_users_in_room_attachments_empty_when_no_user_in_room(self): self.assert_in_room(False) act = self.activity_for_users_in_room() response_data = api.on_users_in_room(act, as_parser(act)) self.assertEqual(0, len(response_data[1]['object']['attachments']))
def test_users_in_room_status_code_200_when_empty(self): self.assert_in_room(False) act = self.activity_for_users_in_room() response_data = api.on_users_in_room(act, as_parser(act)) self.assertEqual(200, response_data[0])