예제 #1
0
def test_create_task(test_app):
    create_task('Get milk')
    existing_task = get_tasks()
    assert len(get_tasks()) == 1
    first_task = existing_task[0]
    assert first_task.body == 'Get milk'
    assert first_task.done is False
예제 #2
0
def test_list_tasks(test_app):
    # Make sure no tasks exist
    assert get_tasks() == []
    # Create some tasks
    create_task("buy milk")
    create_task("buy cookies")
    # Make sure we have 2 tasks now
    assert len(get_tasks()) == 2
예제 #3
0
def test_delete_task(test_app):
    create_task('Get Milk')
    assert len(get_tasks()) == 1

    get_milk = get_tasks().pop()
    get_milk_id = get_milk.id
    delete_task(get_milk_id)

    assert len(get_tasks()) == 0
예제 #4
0
def test_list_tasks(task_body):
    n = len(get_tasks())
    task = create_task(task_body)
    # Make sure we have 1 more task now
    assert len(get_tasks()) == n + 1
    assert not task.done
    finish_task(task.id)
    assert task.done
    delete_task(task.id)
    assert len(get_tasks()) == n
예제 #5
0
def test_finish_task(test_app):
    create_task('Get Milk')
    assert len(get_tasks()) == 1

    get_milk = get_tasks().pop()
    get_milk_id = get_milk.id
    finish_task(get_milk_id)

    get_milk = get_tasks().pop()
    assert get_milk.done is True
def tasks_list():
    tasks = get_tasks()
    # Render the HTML page located in "templates/application.html"
    # Passing tasks as a variable, so it can be used in the template
    return render_template("application.html", tasks=tasks)