dpytest icon indicating copy to clipboard operation
dpytest copied to clipboard

'create_text_channel' ignores 'overwrites' argument

Open coolwind0202 opened this issue 4 years ago • 0 comments

I wrote a test using create_text_channel() function.

I passed overwrites argument to the function.

Then I realized the overwrites was not be reflected.

I executed following code:

@pytest.mark.asyncio
async def test(bot: discord.Client):
    test_guild: discord.Guild = bot.guilds[0]
    role: discord.Role = await test_guild.create_role(name='Role new', mentionable=True)

    perm = discord.PermissionOverwrite(read_messages=True)
    channel: discord.TextChannel = await test_guild.create_text_channel(name='New Channel', overwrites={ role: perm })
    result: discord.PermissionOverwrite = channel.overwrites[role]
    
    assert perm == result

Test session info:

================================== FAILURES ===================================
____________________________________ test _____________________________________

bot = <discord.client.Client object at 0x000001FC78E89670>

    @pytest.mark.asyncio
    async def test(bot: discord.Client):
        test_guild: discord.Guild = bot.guilds[0]
        role: discord.Role = await test_guild.create_role(name='Role new', mentionable=True)
    
        perm = discord.PermissionOverwrite(read_messages=True)
        channel: discord.TextChannel = await test_guild.create_text_channel(name='New Channel', overwrites={ role: perm })
        result: discord.PermissionOverwrite = channel.overwrites[role]
    
>       assert perm == result
E       assert <discord.perm...001FC78E7C910> == <discord.perm...001FC78E7CA60>
E         Use -v to get the full diff

tests\test_channel\test_text_channel.py:40: AssertionError

coolwind0202 avatar Jul 16 '21 08:07 coolwind0202