Skip to content

Changed target of permission change to role #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tests/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,22 @@ async def test_permission_setting(bot):


# TODO : fix this
@pytest.mark.skip(reason="test is currently broken, probably set_permission_overrides doing something wrong.")
# @pytest.mark.skip(reason="test is currently broken, probably set_permission_overrides doing something wrong.")
@pytest.mark.asyncio
@pytest.mark.cogs("cogs.echo")
async def test_bot_send_not_allowed(bot):
"""tests, that a bot gets an Exception, if not allowed to send a message"""
g = bot.guilds[0]
c = g.text_channels[0]
r = g.roles[0]

await dpytest.set_permission_overrides(g.me, c, send_messages=False)
await dpytest.set_permission_overrides(r, c, send_messages=False)
with pytest.raises(discord.ext.commands.errors.CommandInvokeError):
await dpytest.message("!echo hello", channel=c)

assert dpytest.sent_queue.empty()

perm = PermissionOverwrite(send_messages=True, read_messages=True)
await dpytest.set_permission_overrides(g.me, c, perm)
await dpytest.set_permission_overrides(r, c, perm)
await dpytest.message("!echo hello", channel=c)
assert dpytest.verify().message().content("hello")