aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-06-05 14:04:06 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-06-05 14:04:06 +0300
commitf92338ef18d1bc5d11405a5d9e6ede4f9e080110 (patch)
tree122a1d6868c94cd6091c75237aa34d349370cdb9 /tests
parentMerge branch 'main' into voicechannel-mute (diff)
Properly Handles Indefinite Silences
Fixes a bug that stopped the duration `forever` from getting used as a valid duration for silence. Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/exts/moderation/test_silence.py7
-rw-r--r--tests/bot/test_converters.py2
2 files changed, 8 insertions, 1 deletions
diff --git a/tests/bot/exts/moderation/test_silence.py b/tests/bot/exts/moderation/test_silence.py
index a7ea733c5..59a5893ef 100644
--- a/tests/bot/exts/moderation/test_silence.py
+++ b/tests/bot/exts/moderation/test_silence.py
@@ -641,6 +641,13 @@ class SilenceTests(unittest.IsolatedAsyncioTestCase):
await self.cog.silence.callback(self.cog, ctx, None, None)
self.cog.scheduler.schedule_later.assert_not_called()
+ async def test_indefinite_silence(self):
+ """Test silencing a channel forever."""
+ with mock.patch.object(self.cog, "_schedule_unsilence") as unsilence:
+ ctx = MockContext(channel=self.text_channel)
+ await self.cog.silence.callback(self.cog, ctx, -1)
+ unsilence.assert_awaited_once_with(ctx, ctx.channel, None)
+
@autospec(silence.Silence, "unsilence_timestamps", pass_mocks=False)
class UnsilenceTests(unittest.IsolatedAsyncioTestCase):
diff --git a/tests/bot/test_converters.py b/tests/bot/test_converters.py
index 4af84dde5..2a1c4e543 100644
--- a/tests/bot/test_converters.py
+++ b/tests/bot/test_converters.py
@@ -291,7 +291,7 @@ class ConverterTests(unittest.IsolatedAsyncioTestCase):
("10", 10),
("5m", 5),
("5M", 5),
- ("forever", None),
+ ("forever", -1),
)
converter = HushDurationConverter()
for minutes_string, expected_minutes in test_values: