def test_execute_send_exception(): vkontakte = VkontakteLongpoll(token="token") attachment = vkontakte._make_attachment(ATTACHMENTS["image"]) attachment = attachment._replace(id=None) with pytest.raises(ValueError): asyncio.get_event_loop().run_until_complete( vkontakte.execute_send(1, "text", attachment, {}))
async def test(): vkontakte = VkontakteLongpoll(token="token", session=aiohttp.ClientSession()) for k, v in ATTACHMENTS.items(): attachment = vkontakte._make_attachment(v) if k == "graffiti": assert attachment.file is None continue assert attachment.type == k assert attachment.file is None if k in ("video", "graffiti"): continue assert await attachment.get_file() == "content" assert next(mock_read.side_effect, None) is None