aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/bot/rules/test_attachments.py16
-rw-r--r--tests/bot/rules/test_links.py18
-rw-r--r--tests/bot/rules/test_mentions.py16
3 files changed, 25 insertions, 25 deletions
diff --git a/tests/bot/rules/test_attachments.py b/tests/bot/rules/test_attachments.py
index 0af5ff0dc..419336417 100644
--- a/tests/bot/rules/test_attachments.py
+++ b/tests/bot/rules/test_attachments.py
@@ -11,7 +11,7 @@ class Case(NamedTuple):
total_attachments: int
-def msg(author: str, total_attachments: int) -> MockMessage:
+def make_msg(author: str, total_attachments: int) -> MockMessage:
"""Builds a message with `total_attachments` attachments."""
return MockMessage(author=author, attachments=list(range(total_attachments)))
@@ -26,9 +26,9 @@ class AttachmentRuleTests(unittest.TestCase):
async def test_allows_messages_without_too_many_attachments(self):
"""Messages without too many attachments are allowed as-is."""
cases = (
- [msg("bob", 0), msg("bob", 0), msg("bob", 0)],
- [msg("bob", 2), msg("bob", 2)],
- [msg("bob", 2), msg("alice", 2), msg("bob", 2)],
+ [make_msg("bob", 0), make_msg("bob", 0), make_msg("bob", 0)],
+ [make_msg("bob", 2), make_msg("bob", 2)],
+ [make_msg("bob", 2), make_msg("alice", 2), make_msg("bob", 2)],
)
for recent_messages in cases:
@@ -48,22 +48,22 @@ class AttachmentRuleTests(unittest.TestCase):
"""Messages with too many attachments trigger the rule."""
cases = (
Case(
- [msg("bob", 4), msg("bob", 0), msg("bob", 6)],
+ [make_msg("bob", 4), make_msg("bob", 0), make_msg("bob", 6)],
("bob",),
10
),
Case(
- [msg("bob", 4), msg("alice", 6), msg("bob", 2)],
+ [make_msg("bob", 4), make_msg("alice", 6), make_msg("bob", 2)],
("bob",),
6
),
Case(
- [msg("alice", 6)],
+ [make_msg("alice", 6)],
("alice",),
6
),
(
- [msg("alice", 1) for _ in range(6)],
+ [make_msg("alice", 1) for _ in range(6)],
("alice",),
6
),
diff --git a/tests/bot/rules/test_links.py b/tests/bot/rules/test_links.py
index 02a5d5501..b77e01c84 100644
--- a/tests/bot/rules/test_links.py
+++ b/tests/bot/rules/test_links.py
@@ -11,7 +11,7 @@ class Case(NamedTuple):
total_links: int
-def msg(author: str, total_links: int) -> MockMessage:
+def make_msg(author: str, total_links: int) -> MockMessage:
"""Makes a message with `total_links` links."""
content = " ".join(["https://pydis.com"] * total_links)
return MockMessage(author=author, content=content)
@@ -30,11 +30,11 @@ class LinksTests(unittest.TestCase):
async def test_links_within_limit(self):
"""Messages with an allowed amount of links."""
cases = (
- [msg("bob", 0)],
- [msg("bob", 2)],
- [msg("bob", 3)], # Filter only applies if len(messages_with_links) > 1
- [msg("bob", 1), msg("bob", 1)],
- [msg("bob", 2), msg("alice", 2)] # Only messages from latest author count
+ [make_msg("bob", 0)],
+ [make_msg("bob", 2)],
+ [make_msg("bob", 3)], # Filter only applies if len(messages_with_links) > 1
+ [make_msg("bob", 1), make_msg("bob", 1)],
+ [make_msg("bob", 2), make_msg("alice", 2)] # Only messages from latest author count
)
for recent_messages in cases:
@@ -54,17 +54,17 @@ class LinksTests(unittest.TestCase):
"""Messages with a a higher than allowed amount of links."""
cases = (
Case(
- [msg("bob", 1), msg("bob", 2)],
+ [make_msg("bob", 1), make_msg("bob", 2)],
("bob",),
3
),
Case(
- [msg("alice", 1), msg("alice", 1), msg("alice", 1)],
+ [make_msg("alice", 1), make_msg("alice", 1), make_msg("alice", 1)],
("alice",),
3
),
Case(
- [msg("alice", 2), msg("bob", 3), msg("alice", 1)],
+ [make_msg("alice", 2), make_msg("bob", 3), make_msg("alice", 1)],
("alice",),
3
)
diff --git a/tests/bot/rules/test_mentions.py b/tests/bot/rules/test_mentions.py
index ad49ead32..43211f097 100644
--- a/tests/bot/rules/test_mentions.py
+++ b/tests/bot/rules/test_mentions.py
@@ -11,7 +11,7 @@ class Case(NamedTuple):
total_mentions: int
-def msg(author: str, total_mentions: int) -> MockMessage:
+def make_msg(author: str, total_mentions: int) -> MockMessage:
"""Makes a message with `total_mentions` mentions."""
return MockMessage(author=author, mentions=list(range(total_mentions)))
@@ -29,10 +29,10 @@ class TestMentions(unittest.TestCase):
async def test_mentions_within_limit(self):
"""Messages with an allowed amount of mentions."""
cases = (
- [msg("bob", 0)],
- [msg("bob", 2)],
- [msg("bob", 1), msg("bob", 1)],
- [msg("bob", 1), msg("alice", 2)]
+ [make_msg("bob", 0)],
+ [make_msg("bob", 2)],
+ [make_msg("bob", 1), make_msg("bob", 1)],
+ [make_msg("bob", 1), make_msg("alice", 2)]
)
for recent_messages in cases:
@@ -52,17 +52,17 @@ class TestMentions(unittest.TestCase):
"""Messages with a higher than allowed amount of mentions."""
cases = (
Case(
- [msg("bob", 3)],
+ [make_msg("bob", 3)],
("bob",),
3
),
Case(
- [msg("alice", 2), msg("alice", 0), msg("alice", 1)],
+ [make_msg("alice", 2), make_msg("alice", 0), make_msg("alice", 1)],
("alice",),
3
),
Case(
- [msg("bob", 2), msg("alice", 3), msg("bob", 2)],
+ [make_msg("bob", 2), make_msg("alice", 3), make_msg("bob", 2)],
("bob",),
4
)