Commit e356ba49 authored by katsel's avatar katsel
Browse files

Test if time matches

parent d46e7f03
from nose.tools import *
from datetime import datetime,date
from freezegun import freeze_time
from resttime import *
app.config['TESTING'] = True
......@@ -29,3 +30,13 @@ def test_date():
# check for correct date
resttime = read_api_time()
assert resttime.date() == date.today(), "Date does not match"
def test_time():
# check for correct time
assert datetime.now() != datetime(2020, 1, 1)
# freeze current time
with freeze_time("2020-1-1 12:34:56,789"):
resttime = read_api_time()
dtnow = datetime.now().replace(microsecond=0) # strip microseconds
assert resttime == dtnow, "Time does not match"
assert datetime.now() != datetime(2020, 1, 1)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment