53:ed7f35f52927
Anton Shestakov <av6@dwimlabs.net>, Thu, 23 Jun 2016 14:58:09 +0800
checker: try and catch exceptions from execute() and somewhat finish the job Exceptions coming from execute() are programming errors in checker.py, but jobs still need to tell that they are finished (and failed) to be processed by incoming.py.

next change 129:3a25896f01e1
previous change 46:0f45e02848a1

tests/test_models.py

Permissions: -rw-r--r--

Other formats: Feeds:
from datetime import datetime, timedelta
from candolint.models import Project, Check
def test_get_title():
project = Project()
project.domain = 'example.com'
project.user = 'alice'
project.name = 'hello-world'
assert project.get_title() == 'alice/hello-world'
project.domain = 'hello-world.com'
project.user = None
project.name = 'central'
assert project.get_title() == 'hello-world.com/central'
def 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'