start testing with pytest

This commit is contained in:
jb-alvarado 2021-05-28 08:19:01 +02:00
parent 72645f9034
commit 101c18e69b
2 changed files with 27 additions and 0 deletions

0
tests/__init__.py Normal file
View File

27
tests/test_utils.py Normal file
View File

@ -0,0 +1,27 @@
"""
test classes and functions in utils.py
"""
import datetime
from zoneinfo import ZoneInfo
import time_machine
from ffplayout.utils import get_date, playlist
# set time zone
_TZ = ZoneInfo("Europe/Berlin")
# fake date and time
SOURCE_TIME = [2021, 5, 26, 0, 0, 0]
@time_machine.travel(datetime.datetime(*SOURCE_TIME, tzinfo=_TZ))
def test_start_zero():
playlist.start = 0
assert get_date(False, 86401) == '2021-05-27'
assert get_date(False, (24*60*60) - 1) == '2021-05-26'
if __name__ == '__main__':
test_start_zero()