def get_fake_repo(): repo = Mock() repo.project = Project('example', repo) project = repo.project for i in range(0, 3): member = Member(project, "key_{}".format(i), "fakeRole") member._id = i member.id = i member.save() phase = Phase(project, 'phase key 1') phase._id = 1 phase.save() for i in range(0, 5): task = Task(project) task._id = i task.description = 'Task {}'.format(i) task.save() for i in range(0, 3): task = project.tasks[i] task.phase = phase task.assigned_to = project.members[i] task.save() project.tasks[3].assigned_to = project.members[0] project.tasks[4].assigned_to = project.members[1] for i in range(1, 3): project.tasks[i].parent = project.tasks[0] project.tasks[3].relations.add_next(project.tasks[4]) node_1 = project.tokens.add_node(['1', '2', '3']) node_2 = project.tokens.add_node(['1', '2', '4']) node_3 = project.tokens.add_node(['3', '4', '5']) node_4 = project.tokens.add_node(['3', '6', '7']) project.tasks[0].inputs = [node_1, node_2] project.tasks[0].outputs = [node_3, node_4] return repo
def get_basic_frame(project): mock_repository = Mock() project.repository = mock_repository phase = Phase(project) phase._id = 2 phase.save() member = Member(project, 'member_key') member._id = 5 member.save() main_task = Task(project) main_task.description = 'Initial description' main_task.start_date = datetime.date(2016, 1, 4) main_task.duration = 2 main_task.complete = 75 main_task._id = 1 main_task.save() parent = Task(project) parent.description = 'parent description' parent.start_date = datetime.date(2016, 1, 4) parent.duration = 1 parent.complete = 100 parent._id = 2 parent.save() next_task = Task(project) next_task.description = 'next_task description' next_task.start_date = datetime.date(2016, 1, 4) next_task.duration = 1 next_task.complete = 100 next_task._id = 3 next_task.save() return (phase, member, parent, main_task, next_task)