def test_todoitems(db_session): root = get_root() todos = Todos() root['todos'] = todos for cat in test_todos: todos[cat] = Category(cat) for title in test_todos[cat]: todos[cat][title] = TodoItem(title=title, todostate=test_todos[cat][title]) assert len(todos.values()) == len(test_todos) for cat in test_todos: assert len(todos[cat].values()) == len(test_todos[cat])
def test_todos(db_session): root = get_root() todos = Todos() assert todos.type_info.addable(root, DummyRequest()) is True root['todos'] = todos todoitem = TodoItem() assert len(todos.values()) == 0 # there are no children of type TodoItem yet, the UI should present the add link assert todoitem.type_info.addable(todos, DummyRequest()) is True todos['todoitem'] = todoitem assert len(todos.values()) == 1