def test_to_do_item():
    from todo.models import ToDoItem

    item = ToDoItem('subject')
    assert str(item).startswith('- ToDo: ')

    item.done = True
    assert str(item).startswith('+ ToDo: ')
Ejemplo n.º 2
0
def test_command_execution(monkeypatch):
    from todo.commands import UndoneCommand
    from todo.runtime import perform_command
    from todo.models import Storage, ToDoItem

    monkeypatch.setitem(__builtins__, 'input', lambda _: 0)

    item = ToDoItem('test')
    item.done = True

    s = Storage()
    s.items.clear()
    s.items.append(item)

    perform_command(UndoneCommand().label)

    assert item.done is False