aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar kwzrd <[email protected]>2020-06-20 13:13:45 +0200
committerGravatar kwzrd <[email protected]>2020-06-20 13:13:45 +0200
commit98b8947ab7865e33f18da8e2a62b26405676e8e4 (patch)
tree4fca326fbec565d725a691646b0ee68d2ddf4c71 /tests
parentIncidents: simplify set operation in `has_signals` (diff)
Incidents: try-except Signal creation
Suggested by Mark during review. This follows the "ask for forgiveness rather than permission" paradigm, ends up being less code to read, and may be seen as more logical / safer. The `ALLOWED_EMOJI` set was renamed to `ALL_SIGNALS` as this now better communicates the set's purpose. Tests adjusted as appropriate. Co-authored-by: MarkKoz <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/cogs/moderation/test_incidents.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/bot/cogs/moderation/test_incidents.py b/tests/bot/cogs/moderation/test_incidents.py
index 55b15ec9e..862736785 100644
--- a/tests/bot/cogs/moderation/test_incidents.py
+++ b/tests/bot/cogs/moderation/test_incidents.py
@@ -131,17 +131,17 @@ class TestOwnReactions(unittest.TestCase):
self.assertSetEqual(incidents.own_reactions(message), {"A", "B"})
-@patch("bot.cogs.moderation.incidents.ALLOWED_EMOJI", {"A", "B"})
+@patch("bot.cogs.moderation.incidents.ALL_SIGNALS", {"A", "B"})
class TestHasSignals(unittest.TestCase):
"""
Assertions for the `has_signals` function.
- We patch `ALLOWED_EMOJI` globally. Each test function then patches `own_reactions`
+ We patch `ALL_SIGNALS` globally. Each test function then patches `own_reactions`
as appropriate.
"""
def test_has_signals_true(self):
- """True when `own_reactions` returns all emoji in `ALLOWED_EMOJI`."""
+ """True when `own_reactions` returns all emoji in `ALL_SIGNALS`."""
message = MockMessage()
own_reactions = MagicMock(return_value={"A", "B"})
@@ -149,7 +149,7 @@ class TestHasSignals(unittest.TestCase):
self.assertTrue(incidents.has_signals(message))
def test_has_signals_false(self):
- """False when `own_reactions` does not return all emoji in `ALLOWED_EMOJI`."""
+ """False when `own_reactions` does not return all emoji in `ALL_SIGNALS`."""
message = MockMessage()
own_reactions = MagicMock(return_value={"A", "C"})