forked from mindiell/hebdobot
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
from datetime import datetime
|
|
import shutil
|
|
|
|
from tests.utils import bot, OWNER, SENDER
|
|
|
|
|
|
def setup_function():
|
|
shutil.copyfile("tests/datas/reviewstats.csv", "tests/reviews/reviewstats.csv")
|
|
|
|
|
|
def test_complete_review(bot):
|
|
with open("tests/datas/irc.txt") as file_handle:
|
|
content = file_handle.read().splitlines()
|
|
messages = []
|
|
for line in content:
|
|
data = line.split(":")
|
|
author = data[0].strip()
|
|
text = ":".join(data[1:]).strip()
|
|
messages.append((author, text))
|
|
|
|
bot.test_public_message(bot.channel, "lllll", "!start")
|
|
bot.review.start_time = datetime(2023, 12, 1, 12, 0, 0)
|
|
for message in messages:
|
|
bot.test_public_message(bot.channel, message[0], message[1])
|
|
|
|
# compare contents
|
|
with open("tests/datas/20231201-log-irc-revue-hebdomadaire.txt") as file_handle:
|
|
content_ok = file_handle.read()
|
|
with open("tests/reviews/20231201-log-irc-revue-hebdomadaire.txt") as file_handle:
|
|
content_tested = file_handle.read()
|
|
assert content_ok in content_tested
|