Esempio n. 1
0
def test_is_completed():
    completed_at = datetime(2017, 3, 19, 14, tzinfo=pytz.UTC)

    todo = Todo()
    assert todo.is_completed is False

    todo.completed_at = completed_at
    assert todo.is_completed is True

    todo.percent_complete = 20
    todo.complete()
    assert todo.is_completed is True
    assert todo.completed_at == datetime.now(pytz.UTC)
    assert todo.percent_complete == 100
    assert todo.status == "COMPLETED"
Esempio n. 2
0
def test_is_completed():
    completed_at = datetime(2017, 3, 19, 14, tzinfo=pytz.UTC),

    todo = Todo()
    todo.completed_at = completed_at
    todo.percent_complete = 20

    todo.is_completed = True
    assert todo.completed_at == completed_at
    assert todo.percent_complete == 100
    assert todo.status == 'COMPLETED'

    todo.is_completed = False
    assert todo.completed_at is None
    assert todo.percent_complete == 0
    assert todo.status == 'NEEDS-ACTION'

    todo.is_completed = True
    now = datetime(2017, 3, 19, 15, tzinfo=pytz.UTC).astimezone(tzlocal())
    assert todo.completed_at == now
    assert todo.percent_complete == 100
    assert todo.status == 'COMPLETED'