async def test_alias_already_exists(self):

        with amock.patch(api_string.format("set_room_alias")) as patched_alias:
            patched_alias.side_effect = MatrixRequestError(409)

            await self.connector._send_room_address(
                events.RoomAddress(target="!test:localhost", address="hello"))
示例#2
0
    async def test_respond_room_address(self):
        event = events.RoomAddress("#test:localhost", target="!test:localhost")
        with amock.patch(api_string.format("set_room_alias")) as patched_send:
            patched_send.return_value = asyncio.Future()
            patched_send.return_value.set_result({})

            await self.connector.send(event)

            assert patched_send.called_once_with("!test:localhost", "#test:localhost")