41 lines
1 KiB
Python
41 lines
1 KiB
Python
|
from remember_remember_bot.util import (
|
||
|
check_new_day,
|
||
|
update_day,
|
||
|
chat_is_active,
|
||
|
get_file_path,
|
||
|
)
|
||
|
import pytest
|
||
|
|
||
|
|
||
|
def test_update_day():
|
||
|
current_day = 0
|
||
|
assert check_new_day(current_day)
|
||
|
current_day = update_day()
|
||
|
assert not check_new_day(current_day)
|
||
|
|
||
|
|
||
|
@pytest.mark.parametrize(
|
||
|
("messages", "active"),
|
||
|
[
|
||
|
(["/start"], True),
|
||
|
(["/start", "/stop"], False),
|
||
|
(["/start", "/stop", "Let's get this party started"], False),
|
||
|
(["/start", "/stop", "/start"], True),
|
||
|
],
|
||
|
)
|
||
|
def test_chat_is_active(messages, active):
|
||
|
assert chat_is_active(messages) == active
|
||
|
|
||
|
|
||
|
@pytest.mark.parametrize(
|
||
|
("messages", "file_path"),
|
||
|
[
|
||
|
(["/file /home/user/test"], "/home/user/test"),
|
||
|
(["/file /home/user/test", "/stop"], "/home/user/test"),
|
||
|
(["I stored your reminders at the file /home/user/test"], "/home/user/test"),
|
||
|
(["/start", "/stop", "/start"], None),
|
||
|
],
|
||
|
)
|
||
|
def test_get_file_path(messages: [], file_path: str):
|
||
|
assert get_file_path(messages) == file_path
|