aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2020-03-08 19:40:34 +0100
committerGravatar Numerlor <[email protected]>2020-03-08 19:40:34 +0100
commitd4253e106771f90a983717a994349d52337b2de9 (patch)
tree9109ca2459ebe120e92c4ee45f2e08539a681ce1 /tests
parentAdd handling for shh/unshh for `CommandNotFound`. (diff)
Add tests for FirstHash class.
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/cogs/moderation/__init__.py0
-rw-r--r--tests/bot/cogs/moderation/test_silence.py25
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/bot/cogs/moderation/__init__.py b/tests/bot/cogs/moderation/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/bot/cogs/moderation/__init__.py
diff --git a/tests/bot/cogs/moderation/test_silence.py b/tests/bot/cogs/moderation/test_silence.py
new file mode 100644
index 000000000..2a06f5944
--- /dev/null
+++ b/tests/bot/cogs/moderation/test_silence.py
@@ -0,0 +1,25 @@
+import unittest
+
+from bot.cogs.moderation.silence import FirstHash
+
+
+class FirstHashTests(unittest.TestCase):
+ def setUp(self) -> None:
+ self.test_cases = (
+ (FirstHash(0, 4), FirstHash(0, 5)),
+ (FirstHash("string", None), FirstHash("string", True))
+ )
+
+ def test_hashes_equal(self):
+ """Check hashes equal with same first item."""
+
+ for tuple1, tuple2 in self.test_cases:
+ with self.subTest(tuple1=tuple1, tuple2=tuple2):
+ self.assertEqual(hash(tuple1), hash(tuple2))
+
+ def test_eq(self):
+ """Check objects are equal with same first item."""
+
+ for tuple1, tuple2 in self.test_cases:
+ with self.subTest(tuple1=tuple1, tuple2=tuple2):
+ self.assertTrue(tuple1 == tuple2)