hebdobot/tests/test_review_hooks.py

518 lines
24 KiB
Python
Raw Permalink Normal View History

2024-01-11 08:17:25 +01:00
from datetime import datetime, timedelta
import shutil
from tests.utils import bot, OWNER, SENDER
2024-01-11 08:17:25 +01:00
def setup_function():
shutil.copyfile("tests/datas/reviewstats.csv", "tests/reviews/reviewstats.csv")
def test_review_starting_new(bot):
assert bot.review.participants == []
assert bot.review.topics == []
assert bot.review.messages == []
assert bot.review.owner is None
assert bot.review.started == False
assert bot.review.ended == False
assert bot.review.start_time is None
assert bot.review.end_time is None
bot.test_public_message(bot.channel, OWNER, "!start")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 5
assert bot.answers[0].target == OWNER
assert bot.answers[0].message.startswith(f"% Bonjour {OWNER}")
assert bot.answers[1].target == OWNER
assert bot.answers[1].message.startswith("% Pour terminer")
assert bot.answers[2].target == bot.channel
2024-01-11 08:17:25 +01:00
assert bot.answers[2].message.startswith("% Début de")
assert bot.answers[3].target == bot.channel
2024-01-11 08:17:25 +01:00
assert bot.answers[3].message.startswith("% rappel")
assert bot.answers[4].target == bot.channel
2024-01-11 08:17:25 +01:00
assert bot.answers[4].message.startswith("% pour connaître")
assert bot.review.participants == []
assert bot.review.topics == []
assert len(bot.review.messages) == 3
assert bot.review.owner == OWNER
assert bot.review.started == True
assert bot.review.ended == False
assert bot.review.start_time is not None
assert bot.review.end_time is None
def test_review_starting_started_review(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "!start")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == f"% {OWNER}, une revue est déjà en cours."
assert bot.review.participants == []
assert bot.review.topics == []
assert bot.review.messages[-1].text == f"% {OWNER}, une revue est déjà en cours."
assert bot.review.owner == OWNER
assert bot.review.started == True
assert bot.review.ended == False
assert bot.review.start_time is not None
assert bot.review.end_time is None
def test_review_ending_not_started_review(bot):
bot.test_public_message(bot.channel, OWNER, "!fin")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == f"{OWNER}, pas de revue en cours."
assert bot.review.participants == []
assert bot.review.topics == []
assert bot.review.messages == []
assert bot.review.owner is None
assert bot.review.started == False
assert bot.review.ended == False
assert bot.review.start_time is None
assert bot.review.end_time is None
def test_review_ending_as_not_owner(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, SENDER, "!fin")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == f"{SENDER}, vous n'êtes pas responsable de la revue."
assert bot.review.participants == []
assert bot.review.topics == []
assert bot.review.messages[-1].text == f"{SENDER}, vous n'êtes pas responsable de la revue."
assert bot.review.owner == OWNER
assert bot.review.started == True
assert bot.review.ended == False
assert bot.review.start_time is not None
assert bot.review.end_time is None
def test_review_cancel_last_message_on_collective_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "## Collective topic")
bot.test_public_message(bot.channel, SENDER, "This is my message")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 1
assert bot.review.current_topic.messages[0].text == "This is my message"
bot.test_public_message(bot.channel, SENDER, "!oups")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 0
bot.test_public_message(bot.channel, SENDER, "This is my message")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 1
assert bot.review.current_topic.messages[0].text == "This is my message"
bot.test_public_message(bot.channel, SENDER, "!oops")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 0
bot.test_public_message(bot.channel, SENDER, "This is my message")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 1
assert bot.review.current_topic.messages[0].text == "This is my message"
bot.test_public_message(bot.channel, SENDER, "!cancelprevious")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 0
def test_review_cancel_only_message_on_collective_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "## Collective topic")
bot.test_public_message(bot.channel, OWNER, "This is a message from owner")
bot.test_public_message(bot.channel, SENDER, "This is a message from sender")
bot.test_public_message(bot.channel, OWNER, "This is another message from owner")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 3
assert bot.review.current_topic.messages[1].text == "This is a message from sender"
bot.test_public_message(bot.channel, SENDER, "!oups")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert len(bot.review.current_topic.messages) == 2
assert bot.review.current_topic.messages[1].text == "This is another message from owner"
def test_review_cancel_last_message_from_two_on_collective_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "## Collective topic")
bot.test_public_message(bot.channel, OWNER, "This is a message from owner")
bot.test_public_message(bot.channel, SENDER, "This is a message from sender")
bot.test_public_message(bot.channel, SENDER, "This is another message from sender")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 3
assert bot.review.current_topic.messages[1].text == "This is a message from sender"
bot.test_public_message(bot.channel, SENDER, "!oups")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert len(bot.review.current_topic.messages) == 2
assert bot.review.current_topic.messages[1].text == "This is a message from sender"
def test_review_cancel_first_message_from_three_on_collective_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "## Collective topic")
bot.test_public_message(bot.channel, SENDER, "This is a message from sender")
bot.test_public_message(bot.channel, OWNER, "This is a message from owner")
bot.test_public_message(bot.channel, OWNER, "This is another message from owner")
bot.test_public_message(bot.channel, OWNER, "This is a third message from owner")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 4
assert bot.review.current_topic.messages[1].text == "This is a message from owner"
bot.test_public_message(bot.channel, SENDER, "!oups")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert len(bot.review.current_topic.messages) == 3
assert bot.review.current_topic.messages[1].text == "This is another message from owner"
def test_review_cancel_last_message_no_message_on_collective_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "# Individual topic")
bot.test_public_message(bot.channel, OWNER, "This is my message")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 1
assert bot.review.current_topic.messages[0].text == "This is my message"
bot.test_public_message(bot.channel, SENDER, "!oups")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 1
assert bot.review.current_topic.messages[0].text == "This is my message"
def test_review_cancel_last_message_on_individual_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "# Individual topic")
bot.test_public_message(bot.channel, SENDER, "This is my message")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 1
assert bot.review.current_topic.messages[0].text == "This is my message"
bot.test_public_message(bot.channel, SENDER, "!oups")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 0
bot.test_public_message(bot.channel, SENDER, "This is my message")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 1
assert bot.review.current_topic.messages[0].text == "This is my message"
bot.test_public_message(bot.channel, SENDER, "!oops")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 0
bot.test_public_message(bot.channel, SENDER, "This is my message")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 1
assert bot.review.current_topic.messages[0].text == "This is my message"
bot.test_public_message(bot.channel, SENDER, "!cancelprevious")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 0
def test_review_cancel_only_message_on_individual_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "# Individual topic")
bot.test_public_message(bot.channel, OWNER, "This is a message from owner")
bot.test_public_message(bot.channel, SENDER, "This is a message from sender")
bot.test_public_message(bot.channel, OWNER, "This is another message from owner")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 3
assert bot.review.current_topic.messages[1].text == "This is a message from sender"
bot.test_public_message(bot.channel, SENDER, "!oups")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert len(bot.review.current_topic.messages) == 2
assert bot.review.current_topic.messages[1].text == "This is another message from owner"
def test_review_cancel_last_message_from_two_on_individual_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "# Individual topic")
bot.test_public_message(bot.channel, OWNER, "This is a message from owner")
bot.test_public_message(bot.channel, SENDER, "This is a message from sender")
bot.test_public_message(bot.channel, SENDER, "This is another message from sender")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 3
assert bot.review.current_topic.messages[1].text == "This is a message from sender"
bot.test_public_message(bot.channel, SENDER, "!oups")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert len(bot.review.current_topic.messages) == 2
assert bot.review.current_topic.messages[1].text == "This is a message from sender"
def test_review_cancel_first_message_from_three_on_individual_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "# Individual topic")
bot.test_public_message(bot.channel, SENDER, "This is a message from sender")
bot.test_public_message(bot.channel, OWNER, "This is a message from owner")
bot.test_public_message(bot.channel, OWNER, "This is another message from owner")
bot.test_public_message(bot.channel, OWNER, "This is a third message from owner")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 4
assert bot.review.current_topic.messages[1].text == "This is a message from owner"
bot.test_public_message(bot.channel, SENDER, "!oups")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert len(bot.review.current_topic.messages) == 3
assert bot.review.current_topic.messages[1].text == "This is another message from owner"
def test_review_cancel_last_message_no_message_on_individual_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "# Individual topic")
bot.test_public_message(bot.channel, OWNER, "This is my message")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 1
assert bot.review.current_topic.messages[0].text == "This is my message"
bot.test_public_message(bot.channel, SENDER, "!oups")
2024-01-11 08:17:25 +01:00
assert len(bot.review.current_topic.messages) == 1
assert bot.review.current_topic.messages[0].text == "This is my message"
def test_review_cancel_last_message_no_review(bot):
bot.test_public_message(bot.channel, SENDER, "!oups")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == f"{SENDER}, pas de revue en cours."
def test_review_cancel_last_message_no_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, SENDER, "!oups")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == f"{SENDER}, pas de sujet en cours."
def test_review_collective_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
2024-01-11 08:17:25 +01:00
assert len(bot.review.topics) == 0
assert bot.review.current_topic is None
bot.test_public_message(bot.channel, OWNER, "## collective topic")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 4
assert len(bot.review.topics) == 1
assert bot.review.current_topic is not None
assert bot.review.current_topic.collective
def test_review_second_collective_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
2024-01-11 08:17:25 +01:00
assert len(bot.review.topics) == 0
assert bot.review.current_topic is None
bot.test_public_message(bot.channel, OWNER, "## collective topic")
bot.test_public_message(bot.channel, OWNER, "This is my message")
bot.test_public_message(bot.channel, SENDER, "This is a message from sender")
bot.test_public_message(bot.channel, OWNER, "## second collective topic")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 6
assert len(bot.review.topics) == 2
assert bot.review.current_topic is not None
assert bot.review.current_topic.collective
def test_review_collective_no_review(bot):
bot.test_public_message(bot.channel, OWNER, "## collective topic")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 0
assert not bot.review.is_started
assert len(bot.review.topics) == 0
assert bot.review.current_topic is None
def test_review_collective_topic_not_owner(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, SENDER, "## collective topic")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == f"{SENDER}, vous n'êtes pas responsable de la réunion"
def test_review_comment(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, SENDER, "% This is a comment")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 0
assert bot.review.messages[-1].text == "% This is a comment"
assert bot.review.current_topic is None
def test_review_current_without_review(bot):
bot.test_public_message(bot.channel, OWNER, "!courant")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == f"{OWNER}, pas de revue en cours."
assert not bot.review.is_started
def test_review_current_without_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "!courant")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == "% Pas de sujet en cours."
assert bot.review.is_started
def test_review_current_with_collective_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "## collective topic")
bot.test_public_message(bot.channel, OWNER, "!courant")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.review.current_topic.title == "collective topic"
assert bot.answers[0].message == f"% Sujet collectif en cours : {bot.review.current_topic.title}"
def test_review_current_with_individual_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "# individual topic")
bot.test_public_message(bot.channel, OWNER, "!courant")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.review.current_topic.title == "individual topic"
assert bot.answers[0].message == f"% Sujet individuel en cours : {bot.review.current_topic.title}"
def test_review_individual_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
2024-01-11 08:17:25 +01:00
assert len(bot.review.topics) == 0
assert bot.review.current_topic is None
bot.test_public_message(bot.channel, OWNER, "# individual topic")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 3
assert len(bot.review.topics) == 1
assert bot.review.current_topic is not None
assert bot.review.current_topic.individual
def test_review_second_individual_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
2024-01-11 08:17:25 +01:00
assert len(bot.review.topics) == 0
assert bot.review.current_topic is None
bot.test_public_message(bot.channel, OWNER, "# individual topic")
bot.test_public_message(bot.channel, OWNER, "This is my message")
bot.test_public_message(bot.channel, SENDER, "This is a message from sender")
bot.test_public_message(bot.channel, OWNER, "# second individual topic")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 5
assert len(bot.review.topics) == 2
assert bot.review.current_topic is not None
assert bot.review.current_topic.individual
def test_review_individual_no_review(bot):
bot.test_public_message(bot.channel, OWNER, "# individual topic")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 0
assert not bot.review.is_started
assert len(bot.review.topics) == 0
assert bot.review.current_topic is None
def test_review_individual_topic_not_owner(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, SENDER, "# individual topic")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == f"{SENDER}, vous n'êtes pas responsable de la réunion"
def test_stop_review(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
2024-01-11 08:17:25 +01:00
assert bot.review.is_started
assert not bot.review.is_ended
bot.test_public_message(bot.channel, OWNER, "A messsage")
bot.test_public_message(bot.channel, OWNER, "## collective topic")
bot.test_public_message(bot.channel, OWNER, "Another messsage")
bot.test_public_message(bot.channel, OWNER, "!stop")
2024-01-11 08:17:25 +01:00
assert not bot.review.is_started
assert not bot.review.is_ended
assert len(bot.review.topics) == 0
assert bot.review.current_topic is None
assert len(bot.answers) == 1
assert bot.answers[0].message == "Abandon de la revue en cours."
def test_stop_review_not_owner(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, SENDER, "!stop")
2024-01-11 08:17:25 +01:00
assert bot.review.is_started
assert len(bot.answers) == 1
assert bot.answers[0].message == f"{SENDER}, vous n'êtes pas responsable de la réunion."
def test_stop_review_no_review(bot):
bot.test_public_message(bot.channel, OWNER, "!stop")
2024-01-11 08:17:25 +01:00
assert not bot.review.is_started
assert not bot.review.is_ended
assert len(bot.review.topics) == 0
assert bot.review.current_topic is None
assert len(bot.answers) == 1
assert bot.answers[0].message == f"{OWNER}, pas de revue en cours, abandon impossible."
def test_missing_no_review(bot):
bot.test_public_message(bot.channel, OWNER, "!manquantes")
2024-01-11 08:17:25 +01:00
assert not bot.review.is_started
assert len(bot.answers) == 1
assert bot.answers[0].message == f"{OWNER}, pas de revue en cours."
def test_missing_no_topic(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
2024-01-11 08:17:25 +01:00
assert bot.review.is_started
bot.test_public_message(bot.channel, OWNER, "!manquantes")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == "% Pas de sujet en cours."
def test_missing_no_one_is_missing(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "## collective topic")
bot.test_public_message(bot.channel, SENDER, "This is my message")
bot.test_public_message(bot.channel, OWNER, "This is owner message")
bot.test_public_message(bot.channel, OWNER, "!manquantes")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == "% Tout le monde s'est exprimé sur le sujet courant \\o/"
2024-04-06 10:03:48 +02:00
def test_missing_no_one_is_missing_through_ras(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "## collective topic")
bot.test_public_message(bot.channel, SENDER, "%ras")
bot.test_public_message(bot.channel, OWNER, "This is owner message")
bot.test_public_message(bot.channel, OWNER, "!manquantes")
assert len(bot.answers) == 1
assert bot.answers[0].message == "% Tout le monde s'est exprimé sur le sujet courant \\o/"
2024-01-11 08:17:25 +01:00
def test_missing_one_is_missing(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "## collective topic")
bot.test_public_message(bot.channel, SENDER, "This is my message")
bot.test_public_message(bot.channel, OWNER, "This is owner message")
bot.test_public_message(bot.channel, OWNER, "## a second collective topic")
bot.test_public_message(bot.channel, OWNER, "This is the second owner message")
bot.test_public_message(bot.channel, OWNER, "!manquantes")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == (
"% Personnes participantes ne s'étant pas exprimées sur le "
f"sujet courant : {', '.join([SENDER])}"
)
def test_chrono_no_review(bot):
bot.test_public_message(bot.channel, OWNER, "!chrono")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == "n/a"
def test_chrono(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
2024-01-11 08:17:25 +01:00
bot.review.start_time = datetime.today() - timedelta(seconds=87)
bot.test_public_message(bot.channel, OWNER, "!chrono")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == "01:27"
def test_finish_review(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "## collective topic")
bot.test_public_message(bot.channel, OWNER, "Owner message on collective topic")
bot.test_public_message(bot.channel, SENDER, "Sender message on collective topic")
bot.test_public_message(bot.channel, OWNER, "# individual topic")
bot.test_public_message(bot.channel, OWNER, "Owner message on individual topic")
bot.test_public_message(bot.channel, SENDER, "Sender message on individual topic")
bot.test_public_message(bot.channel, OWNER, "!fin")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 10
assert bot.answers[-2].message == "% Fin de la revue hebdomadaire"
assert bot.answers[-1].message == "Revue finie."
def test_finish_review_no_review(bot):
bot.test_public_message(bot.channel, OWNER, "!fin")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == f"{OWNER}, pas de revue en cours."
def test_finish_review_already_finished(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "## collective topic")
bot.test_public_message(bot.channel, OWNER, "Owner message on collective topic")
bot.test_public_message(bot.channel, SENDER, "Sender message on collective topic")
bot.test_public_message(bot.channel, OWNER, "# individual topic")
bot.test_public_message(bot.channel, OWNER, "Owner message on individual topic")
bot.test_public_message(bot.channel, SENDER, "Sender message on individual topic")
bot.test_public_message(bot.channel, OWNER, "!fin")
bot.test_public_message(bot.channel, OWNER, "!fin")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
2024-04-06 10:03:48 +02:00
assert bot.answers[0].message.endswith(", pas de revue en cours.")
2024-01-11 08:17:25 +01:00
def test_finish_review_not_owner(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "## collective topic")
bot.test_public_message(bot.channel, OWNER, "Owner message on collective topic")
bot.test_public_message(bot.channel, SENDER, "Sender message on collective topic")
bot.test_public_message(bot.channel, OWNER, "# individual topic")
bot.test_public_message(bot.channel, OWNER, "Owner message on individual topic")
bot.test_public_message(bot.channel, SENDER, "Sender message on individual topic")
bot.test_public_message(bot.channel, SENDER, "!fin")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == f"{SENDER}, vous n'êtes pas responsable de la revue."
def test_finish_review_no_participation(bot):
bot.test_public_message(bot.channel, OWNER, "!start")
bot.test_public_message(bot.channel, OWNER, "!fin")
2024-01-11 08:17:25 +01:00
assert len(bot.answers) == 1
assert bot.answers[0].message == "Participation nulle détectée. La revue est ignorée."