dpytest icon indicating copy to clipboard operation
dpytest copied to clipboard

Adding support for creating custom emojis

Open swarajd opened this issue 3 years ago • 0 comments

I need the functionality of creating custom emojis for test guilds. I have the following test case:

@pytest.mark.asyncio
async def test_taking_an_L(bot):

    config = dpytest.get_config()
    guild = config.guilds[0]

    # create an emoji with an empty PNG
    await guild.create_custom_emoji(
        name="myemoji", 
        image=b'\x89\x50\x4E\x47\x0D\x0A\x1A\x0A'
    )

    reg_mem = await dpytest.member_join()
    message = await dpytest.message(content="content to test on", member=reg_mem)
    assert "myemoji" in [r.emoji for r in message.reactions]

However, this functionality is not yet added as per this error log: https://pastebin.com/XVaGUTjJ

shorter error log as follows:

NotImplementedError: Operation occured that isn't captured by the tests framework. This is dpytest's fault, please reportan issue on github. Debug Info: POST https://discord.com/api/v7/guilds/980629415211958283/emojis with {'json': {'name': 'puyrun', 'image': 'data:image/png;base64,iVBORw0KGgo=', 'roles': []}, 'reason': None}

swarajd avatar May 30 '22 00:05 swarajd