start testing with pytest
This commit is contained in:
parent
72645f9034
commit
101c18e69b
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
27
tests/test_utils.py
Normal file
27
tests/test_utils.py
Normal 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()
|
Loading…
x
Reference in New Issue
Block a user