Permissions: -rw-r--r--
from datetime import datetime, timedeltafrom candolint.models import Checkdef test_duration(): now = datetime.now() check = Check(started=now) check.finished = now + timedelta(seconds=10) assert check.get_duration() == '10 sec' check.finished = now + timedelta(minutes=5) assert check.get_duration() == '5 min' check.finished = now + timedelta(hours=2) assert check.get_duration() == '120 min'