remember-remember-bot/tests/test_commands.py

19 lines
570 B
Python
Raw Normal View History

2023-12-10 10:58:42 +00:00
import time
import deltachat
from remember_remember_bot.commands import store_file, reply
from remember_remember_bot.util import get_file_path, get_lines_from_file
2023-12-10 13:46:24 +00:00
def test_store_file(tmp_file_path, chat: deltachat.Chat):
2023-12-10 10:58:42 +00:00
chat.set_ephemeral_timer(1)
2023-12-10 13:46:24 +00:00
reply(chat, "/file", attachment=str(tmp_file_path))
2023-12-10 10:58:42 +00:00
last_message = chat.get_messages()[-1]
store_file(last_message)
time.sleep(1)
2023-12-10 13:46:24 +00:00
new_file_path = get_file_path(chat)
2023-12-10 10:58:42 +00:00
assert new_file_path
assert get_lines_from_file(new_file_path) == ["test"]
assert chat.get_ephemeral_timer() == 1