예제 #1
0
파일: todo.py 프로젝트: gbaweja/todo_list
def get_task_list():
    global show_completed
    if (show_completed):
        tasks = task_list.get_tasks()
    else:
        tasks = task_list.get_tasks_by_status("0")
    output = template('task_list.tpl', tasks=tasks, show_completed = show_completed)
    return output
예제 #2
0
def test_delete_task():
    task_id = task_list.save_task({
        'description': "This is a deletable task.",
        'status': "1"
    })
    tasks = task_list.get_tasks()
    found = False
    for task in tasks:
        if "deletable" in task['description']:
            found = True
    assert found
    task_list.delete_task(task_id)
    tasks = task_list.get_tasks()
    found = False
    for task in tasks:
        if "deletable" in task['description']:
            found = True
    assert not found
예제 #3
0
def test_get_tasks():
    task_list.save_task({'description': "This is a test task.", 'status': "1"})
    task_list.save_task({
        'description': "This is another test task.",
        'status': "1"
    })
    tasks = task_list.get_tasks()
    assert type(tasks) is list
    for task in tasks:
        for item in ['_id', 'description', 'status']:
            assert (type(task[item]) is str)
예제 #4
0
def test_save_task():
    task_list.save_task({
        'description': "Do something worth saving",
        'status': "1"
    })
    tasks = task_list.get_tasks()
    assert type(tasks) is list
    found = False
    for task in tasks:
        assert 'description' in task
        if task['description'] == "Do something worth saving":
            found = True
    assert found
예제 #5
0
def teardown_module():
    tasks = task_list.get_tasks()
    for task_id in [t['_id'] for t in tasks]:
        task_list.delete_task(task_id)
예제 #6
0
def setup_module():
    for task_id in [t['_id'] for t in task_list.get_tasks()]:
        task_list.delete_task(task_id)
예제 #7
0
def test_get_task():
    task_id = task_list.get_tasks()[0]['_id']
    assert type(task_id) is str
    task = task_list.get_task(task_id)
    assert (task['description'] == "This is a test task.")
    assert (task['status'] == "1")
예제 #8
0
def get_task_list():
    tasks = task_list.get_tasks()
    output = template('dashboard.tpl', tasks=tasks)
    return output
예제 #9
0
def get_task_list():
    tasks = task_list.get_tasks()
    output = template('midtermapp.tpl', tasks=tasks)
    return output