aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-08-17 19:17:51 -0700
committerGravatar MarkKoz <[email protected]>2020-08-17 19:17:51 -0700
commit5eec1c2db319ccdb1f71c1a25fa541eeb7a2707a (patch)
tree477e9402cd86d78162fb6ddf7fee1789dd88783a
parentSilence tests: add a test for the time cache (diff)
Silence tests: add a test for caching permanent times
-rw-r--r--tests/bot/cogs/moderation/test_silence.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/bot/cogs/moderation/test_silence.py b/tests/bot/cogs/moderation/test_silence.py
index 1ae17177f..2e756a88f 100644
--- a/tests/bot/cogs/moderation/test_silence.py
+++ b/tests/bot/cogs/moderation/test_silence.py
@@ -235,6 +235,12 @@ class SilenceTests(unittest.IsolatedAsyncioTestCase):
self.cog.muted_channel_times.set.assert_awaited_once_with(ctx.channel.id, timestamp)
datetime_mock.now.assert_called_once_with(tz=timezone.utc) # Ensure it's using an aware dt.
+ async def test_cached_indefinite_time(self):
+ """A value of -1 was cached for a permanent silence."""
+ ctx = MockContext(channel=self.channel)
+ await self.cog.silence.callback(self.cog, ctx, None)
+ self.cog.muted_channel_times.set.assert_awaited_once_with(ctx.channel.id, -1)
+
@autospec(Silence, "muted_channel_times", pass_mocks=False)
class UnsilenceTests(unittest.IsolatedAsyncioTestCase):