def test_project__add_tasks(project_saved, task_factory, meta: MetadataRepository): tasks = [task_factory() for _ in range(5)] assert len(project_saved.tasks) == 0 project_saved.add_tasks(tasks) assert len(project_saved.tasks) == 5 for t in tasks: task_id = t.id assert task_id is not None assert t == meta.get_task_by_id(task_id) assert t == project_saved.tasks[task_id] assert t == project_saved.tasks(t.name)
def test_project__add_task__new(set_project_id, meta: MetadataRepository, project_saved, task_factory): assert len(project_saved.tasks) == 0 task: Task = task_factory() if set_project_id: task.project = project_saved project_saved.add_task(task) assert len(project_saved.tasks) == 1 task_id = task.id assert task_id is not None assert task == meta.get_task_by_id(task_id) assert task == project_saved.tasks[task_id] assert task == project_saved.tasks(task.name) assert task.project == project_saved