aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar mbaruh <[email protected]>2022-11-01 20:57:09 +0200
committerGravatar mbaruh <[email protected]>2022-11-01 20:57:09 +0200
commitc20398233a4a792e3207d52765aaf530a468351a (patch)
treedf2f05962c594a6f02fcfdfbd01afd39430f22d8 /tests
parentAdd antispam filter list and duplicates filter (diff)
Add the rest of the antispam rules
This is mostly a copy-paste of the implementations in the old system into the new system's structure. The mentions rule required changing the `triggers_on` method to async.
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/exts/filtering/test_filters.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/bot/exts/filtering/test_filters.py b/tests/bot/exts/filtering/test_filters.py
index 214637b52..29b50188a 100644
--- a/tests/bot/exts/filtering/test_filters.py
+++ b/tests/bot/exts/filtering/test_filters.py
@@ -5,7 +5,7 @@ from bot.exts.filtering._filters.token import TokenFilter
from tests.helpers import MockMember, MockMessage, MockTextChannel
-class FilterTests(unittest.TestCase):
+class FilterTests(unittest.IsolatedAsyncioTestCase):
"""Test functionality of the token filter."""
def setUp(self) -> None:
@@ -14,7 +14,7 @@ class FilterTests(unittest.TestCase):
message = MockMessage(author=member, channel=channel)
self.ctx = FilterContext(Event.MESSAGE, member, channel, "", message)
- def test_token_filter_triggers(self):
+ async def test_token_filter_triggers(self):
"""The filter should evaluate to True only if its token is found in the context content."""
test_cases = (
(r"hi", "oh hi there", True),
@@ -37,5 +37,5 @@ class FilterTests(unittest.TestCase):
"additional_field": "{}" # noqa: P103
})
self.ctx.content = content
- result = filter_.triggered_on(self.ctx)
+ result = await filter_.triggered_on(self.ctx)
self.assertEqual(result, expected)