diff options
author | 2020-05-07 19:13:45 +0200 | |
---|---|---|
committer | 2020-05-07 19:13:45 +0200 | |
commit | 90d2ce0e3717d4ddf79eb986e22f7542ca1770e1 (patch) | |
tree | 4b50d0a0477a9fa7f81e0a9be7f77108d622d83e /tests | |
parent | AntiMalware Tests - Added unittests for deletion of message and ignoring of dms (diff) |
AntiMalware Tests - Added unittest for messages send by staff
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bot/cogs/test_antimalware.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/bot/cogs/test_antimalware.py b/tests/bot/cogs/test_antimalware.py index ebf3a1277..e3fd477fa 100644 --- a/tests/bot/cogs/test_antimalware.py +++ b/tests/bot/cogs/test_antimalware.py @@ -3,7 +3,8 @@ import unittest from unittest.mock import AsyncMock from bot.cogs import antimalware -from tests.helpers import MockAttachment, MockBot, MockMessage +from bot.constants import Roles +from tests.helpers import MockAttachment, MockBot, MockMessage, MockRole class AntiMalwareCogTests(unittest.TestCase): @@ -38,3 +39,13 @@ class AntiMalwareCogTests(unittest.TestCase): coroutine = self.cog.on_message(self.message) asyncio.run(coroutine) self.message.delete.assert_called_once() + + def test_message_send_by_staff(self): + """A message send by a member of staff should be ignored.""" + moderator_role = MockRole(name="Moderator", id=Roles.moderators) + self.message.author.roles.append(moderator_role) + attachment = MockAttachment(filename="python.asdfsff") + self.message.attachments = [attachment] + coroutine = self.cog.on_message(self.message) + asyncio.run(coroutine) + self.message.delete.assert_not_called() |