18 lines
438 B
Python
18 lines
438 B
Python
from __future__ import annotations
|
|
|
|
import time
|
|
|
|
from bakrest.watcher import _mtime_is_recent
|
|
|
|
|
|
def test_mtime_is_recent_rejects_old_timestamps() -> None:
|
|
old_mtime_ns = int((time.time() - 3600) * 1_000_000_000)
|
|
|
|
assert not _mtime_is_recent(old_mtime_ns, 300)
|
|
|
|
|
|
def test_mtime_is_recent_accepts_recent_timestamps() -> None:
|
|
recent_mtime_ns = int(time.time() * 1_000_000_000)
|
|
|
|
assert _mtime_is_recent(recent_mtime_ns, 300)
|