aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-05-18 04:07:02 +0100
committerGravatar Joe Banks <[email protected]>2024-05-18 04:07:02 +0100
commitd7f158bb477bc7b8bfc42180a1a73c8d6b1bd8fc (patch)
tree74c3c1a68c5f6c3ce5b3b44eea34788bce32a29b /tests
parentAllow for more than 3 nomination votes if others are ticketed (diff)
Update tests for new autonomination threshold logic
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/exts/recruitment/talentpool/test_review.py40
1 files changed, 35 insertions, 5 deletions
diff --git a/tests/bot/exts/recruitment/talentpool/test_review.py b/tests/bot/exts/recruitment/talentpool/test_review.py
index 25622e91f..8ec384bb2 100644
--- a/tests/bot/exts/recruitment/talentpool/test_review.py
+++ b/tests/bot/exts/recruitment/talentpool/test_review.py
@@ -3,7 +3,7 @@ from datetime import UTC, datetime, timedelta
from unittest.mock import AsyncMock, Mock, patch
from bot.exts.recruitment.talentpool import _review
-from tests.helpers import MockBot, MockMember, MockMessage, MockTextChannel
+from tests.helpers import MockBot, MockMember, MockMessage, MockReaction, MockTextChannel
class AsyncIterator:
@@ -63,8 +63,10 @@ class ReviewerTests(unittest.IsolatedAsyncioTestCase):
"""Tests for the `is_ready_for_review` function."""
too_recent = datetime.now(UTC) - timedelta(hours=1)
not_too_recent = datetime.now(UTC) - timedelta(days=7)
+ ticket_reaction = MockReaction(users=[self.bot_user], emoji="\N{TICKET}")
+
cases = (
- # Only one review, and not too recent, so ready.
+ # Only one active review, and not too recent, so ready.
(
[
MockMessage(author=self.bot_user, content="wookie for Helper!", created_at=not_too_recent),
@@ -75,7 +77,7 @@ class ReviewerTests(unittest.IsolatedAsyncioTestCase):
True,
),
- # Three reviews, so not ready.
+ # Three active reviews, so not ready.
(
[
MockMessage(author=self.bot_user, content="Chrisjl for Helper!", created_at=not_too_recent),
@@ -86,7 +88,7 @@ class ReviewerTests(unittest.IsolatedAsyncioTestCase):
False,
),
- # Only one review, but too recent, so not ready.
+ # Only one active review, but too recent, so not ready.
(
[
MockMessage(author=self.bot_user, content="Chrisjl for Helper!", created_at=too_recent),
@@ -95,7 +97,7 @@ class ReviewerTests(unittest.IsolatedAsyncioTestCase):
False,
),
- # Only two reviews, and not too recent, so ready.
+ # Only two active reviews, and not too recent, so ready.
(
[
MockMessage(author=self.bot_user, content="Not a review", created_at=too_recent),
@@ -107,6 +109,34 @@ class ReviewerTests(unittest.IsolatedAsyncioTestCase):
True,
),
+ # Over the active threshold, but below the total threshold
+ (
+ [
+ MockMessage(
+ author=self.bot_user,
+ content="joe for Helper!",
+ created_at=not_too_recent,
+ reactions=[ticket_reaction]
+ )
+ ] * 6,
+ not_too_recent.timestamp(),
+ True
+ ),
+
+ # Over the total threshold
+ (
+ [
+ MockMessage(
+ author=self.bot_user,
+ content="joe for Helper!",
+ created_at=not_too_recent,
+ reactions=[ticket_reaction]
+ )
+ ] * 11,
+ not_too_recent.timestamp(),
+ False
+ ),
+
# No messages, so ready.
([], None, True),
)