aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-10-11 14:53:33 +0300
committerGravatar ks129 <[email protected]>2020-10-11 14:53:33 +0300
commitb8855bced0913f087d25d571fe9a5ccf7f5e1727 (patch)
treea13dcb7cc6986fffb542c646615a629902f3d3f1 /tests
parentShorten voice ban reason and create test for it (diff)
Create test for voice ban pardon when user not found
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/exts/moderation/infraction/test_infractions.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/bot/exts/moderation/infraction/test_infractions.py b/tests/bot/exts/moderation/infraction/test_infractions.py
index a6ebe2162..ae8c1d35e 100644
--- a/tests/bot/exts/moderation/infraction/test_infractions.py
+++ b/tests/bot/exts/moderation/infraction/test_infractions.py
@@ -64,6 +64,7 @@ class VoiceBanTests(unittest.IsolatedAsyncioTestCase):
self.bot = MockBot()
self.mod = MockMember(top_role=10)
self.user = MockMember(top_role=1, roles=[MockRole(id=123456)])
+ self.guild = MockGuild()
self.ctx = MockContext(bot=self.bot, author=self.mod)
self.cog = Infractions(self.bot)
@@ -170,3 +171,9 @@ class VoiceBanTests(unittest.IsolatedAsyncioTestCase):
self.cog._voice_verified_role, reason=textwrap.shorten("foobar" * 3000, 512, placeholder="...")
)
self.cog.apply_infraction.assert_awaited_once_with(self.ctx, {"foo": "bar"}, self.user, "my_return_value")
+
+ async def test_voice_unban_user_not_found(self):
+ """Should include info to return dict when user was not found from guild."""
+ self.guild.get_member.return_value = None
+ result = await self.cog.pardon_voice_ban(self.user.id, self.guild, "foobar")
+ self.assertEqual(result, {"Failure": "User was not found in the guild."})