def tearDown(self): self.app_context.pop() User.drop_collection() Team.drop_collection() Project.drop_collection() Item.drop_collection() TodoList.drop_collection()
def todo_lists_dict(project): # Get all todo-list items for project to avoid doing a query for each list items = Item.get_all_for_project(project) todo_lists = defaultdict(list) for item in items: todo_lists[item.todo_list.id].append(item_dict(item)) return todo_lists