コード例 #1
0
async def test_is_allowed_to_change_colour_false(utils_cog):
    await dpytest.message(KoalaBot.COMMAND_PREFIX + "store_ctx")
    ctx: commands.Context = utils_cog.get_last_ctx()
    roles = await make_list_of_roles(ctx.guild, 1)
    role = roles[0]
    DBManager.add_colour_change_role_perms(ctx.guild.id, role.id)
    assert not ColourRole.is_allowed_to_change_colour(ctx)
コード例 #2
0
async def test_is_allowed_to_change_colour_true():
    await dpytest.message(KoalaBot.COMMAND_PREFIX + "store_ctx")
    ctx: commands.Context = utils_cog.get_last_ctx()
    roles = await make_list_of_roles(ctx.guild, 1)
    role = roles[0]
    member: discord.Member = ctx.author
    DBManager.add_colour_change_role_perms(ctx.guild.id, role.id)
    await member.add_roles(role)
    assert ColourRole.is_allowed_to_change_colour(ctx)
コード例 #3
0
async def test_is_allowed_to_change_colour_no_guild_roles(utils_cog):
    await dpytest.message(KoalaBot.COMMAND_PREFIX + "store_ctx")
    ctx: commands.Context = utils_cog.get_last_ctx()
    assert not ColourRole.is_allowed_to_change_colour(ctx)