async def test_demote_owner(stream_service, room_membership_api):
    user_id = 12345
    room_id = "room_id"
    await stream_service.demote_owner_to_room_participant(
        user_id, room_id)  # check no exception raised

    room_membership_api.v1_room_id_membership_demote_owner_post.assert_called_once_with(
        id=room_id, payload=UserId(id=user_id), session_token=SESSION_TOKEN)
async def test_remove_member_from_room(stream_service, room_membership_api):
    user_id = 1234456
    room_id = "room_id"
    await stream_service.remove_member_from_room(user_id, room_id
                                                 )  # check no exception raised

    room_membership_api.v1_room_id_membership_remove_post.assert_called_once_with(
        payload=UserId(id=user_id), id=room_id, session_token=SESSION_TOKEN)
Beispiel #3
0
    async def promote_user_to_room_owner(self, user_id: int, room_id: str):
        """Promotes user to owner of the chat room.
        Wraps the `Promote Owner <https://developers.symphony.com/restapi/reference#promote-owner>`_ endpoint.

        :param user_id: the id of the user to be promoted as owner.
        :param room_id: the room id.
        :return: None
        """
        await self._room_membership_api.v1_room_id_membership_promote_owner_post(
            id=room_id,
            payload=UserId(id=user_id),
            session_token=await self._auth_session.session_token)
Beispiel #4
0
    async def remove_member_from_room(self, user_id: int, room_id: str):
        """Removes a member from an existing room.
        Wraps the `Remove Member <https://developers.symphony.com/restapi/reference#remove-member>`_ endpoint.

        :param user_id: the id of the user to be removed from the room.
        :param room_id: the id of the room from which to remove the user.
        :return: None
        """
        await self._room_membership_api.v1_room_id_membership_remove_post(
            payload=UserId(id=user_id),
            id=room_id,
            session_token=await self._auth_session.session_token)
Beispiel #5
0
    async def add_member_to_room(self, user_id: int, room_id: str):
        """Adds a member to an existing room.
        Wraps the `Add Member <https://developers.symphony.com/restapi/reference#add-member>`_ endpoint.

        :param user_id: the id of the user to be added to the room.
        :param room_id: the id of the room in which to add the user.
        :return: None
        """
        await self._room_membership_api.v1_room_id_membership_add_post(
            payload=UserId(id=user_id),
            id=room_id,
            session_token=await self._auth_session.session_token)
Beispiel #6
0
    async def demote_owner_to_room_participant(self, user_id: int,
                                               room_id: str):
        """Demotes room owner to a participant in the chat room.
        Wraps the `Demote Owner <https://developers.symphony.com/restapi/reference#demote-owner>`_ endpoint.

        :param user_id: the id of the room owner to be demoted.
        :param room_id: the room id.
        :return: None
        """
        await self._room_membership_api.v1_room_id_membership_demote_owner_post(
            id=room_id,
            payload=UserId(id=user_id),
            session_token=await self._auth_session.session_token)