aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-08-17 13:18:58 -0700
committerGravatar MarkKoz <[email protected]>2020-08-17 13:27:19 -0700
commit3182bacc342fd87313ffb22742947576d887f73b (patch)
tree74f2596159ea42d431a9a301c33a42ba658239a9
parentSilence tests: replace obsolete cog_unload tests (diff)
Silence tests: fix silence cache test for overwrites
-rw-r--r--tests/bot/cogs/moderation/test_silence.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/bot/cogs/moderation/test_silence.py b/tests/bot/cogs/moderation/test_silence.py
index 807bb09a0..6f0cd880d 100644
--- a/tests/bot/cogs/moderation/test_silence.py
+++ b/tests/bot/cogs/moderation/test_silence.py
@@ -184,12 +184,15 @@ class SilenceTests(unittest.IsolatedAsyncioTestCase):
await self.cog._silence(channel, False, None)
self.cog.notifier.add_channel.assert_not_called()
- async def test_silence_private_added_muted_channel(self):
- """Channel was added to `muted_channels` on silence."""
+ async def test_silence_private_cached_perms(self):
+ """Channel's previous overwrites were cached when silenced."""
channel = MockTextChannel()
- with mock.patch.object(self.cog, "muted_channels") as muted_channels:
- await self.cog._silence(channel, False, None)
- muted_channels.add.assert_called_once_with(channel)
+ overwrite = PermissionOverwrite(send_messages=True, add_reactions=None)
+ overwrite_json = '{"send_messages": true, "add_reactions": null}'
+ channel.overwrites_for.return_value = overwrite
+
+ await self.cog._silence(channel, False, None)
+ self.cog.muted_channel_perms.set.assert_called_once_with(channel.id, overwrite_json)
async def test_unsilence_private_for_false(self):
"""Permissions are not set and `False` is returned in an unsilenced channel."""