def test_view_older_done_items_contains_only_items_completed_before_today(
        TEST_ITEMS, number_of_older_done_items):
    view = vm.ViewModel(TEST_ITEMS)
    today = datetime.datetime.today()
    for item in view.older_done_items:
        assert item.lastmodifieddate.date() < today.date()
    assert len(view.older_done_items) == number_of_older_done_items
 def index():
     items = mongo.get_items_mongo()
     items = sorted(items, key=lambda k: k.status, reverse=True)
     item_view_model = vm.ViewModel(items)
     role = get_user_role()
     return render_template('index.html',
                            view_model=item_view_model,
                            role=role)
def test_view_show_all_done_items_contains_correct_number_of_items(
        TEST_ITEMS, number_of_done_items):
    view = vm.ViewModel(TEST_ITEMS)
    assert len(view.show_all_done_items) == number_of_done_items
def test_view_show_all_done_items_contains_only_done_items(TEST_ITEMS):
    view = vm.ViewModel(TEST_ITEMS)
    for item in view.show_all_done_items:
        assert item.status == "Done"
def test_view_doingitems_contains_correct_number_of_items(
        TEST_ITEMS, number_of_doing_items):
    view = vm.ViewModel(TEST_ITEMS)
    assert len(view.doingitems) == number_of_doing_items
def test_view_doingitems_contains_only_doing_items(TEST_ITEMS):
    view = vm.ViewModel(TEST_ITEMS)
    for item in view.doingitems:
        assert item.status == "Doing"
def test_view_todoitems_contains_only_todo_items(TEST_ITEMS):
    view = vm.ViewModel(TEST_ITEMS)
    for item in view.todoitems:
        assert item.status == "To Do"