def generate_tasks_for_cycle(self, group_count, task_count): """generate number of task groups and task for current task group""" role_names = ("Task Assignees", "Task Secondary Assignees") results = {} with single_commit(): workflow = factories.WorkflowFactory() cycle = factories.CycleFactory(workflow=workflow) task_group = factories.TaskGroupFactory(workflow=workflow) for idx in range(group_count): person = PersonFactory(name="user for group {}".format(idx)) cycle_task_group = factories.CycleTaskGroupFactory( cycle=cycle, contact=person) for _ in range(task_count): task_group_task = factories.TaskGroupTaskFactory( task_group=task_group) for r_name in role_names: ggrc_factories.AccessControlListFactory( object=task_group_task, person=person, ac_role_id=self.get_role_id_for_obj( task_group_task, r_name)) task = factories.CycleTaskGroupObjectTaskFactory( cycle=cycle, cycle_task_group=cycle_task_group, task_group_task=task_group_task) for r_name in role_names: ggrc_factories.AccessControlListFactory( object=task, person=person, ac_role_id=self.get_role_id_for_obj(task, r_name)) results[task.id] = cycle_task_group.slug return results
def generate_tasks_for_cycle(task_count): """generate number of task groups and task for current task group""" results = [] for idx in range(task_count): person = PersonFactory(name="user for group {}".format(idx)) task = factories.CycleTaskFactory(contact=person) results.append(task.id) return results
def test_ggrc_user(self): """Test request_loader with correct headers.""" user = PersonFactory() custom_headers = {"X-ggrc-user": "******"email\": \"%s\"}" % user.email} with self.custom_headers(custom_headers): self.client.get("/", headers=self.headers) self.assertEqual(self.raised_exception, None) self.assertEqual(self.loaded_email, user.email)
def generate_tasks_for_cycle(cycle_count, task_count): """generate seceted number of cycles and tasks""" results = {} with single_commit(): for _ in range(cycle_count): workflow = factories.WorkflowFactory() cycle = factories.CycleFactory(workflow=workflow, ) cycle.contact = PersonFactory( name="user for cycle {}".format(cycle.id)) person = PersonFactory( name="user for cycle tasks {}".format(cycle.id)) task_group = factories.TaskGroupFactory(workflow=workflow) for _ in range(task_count): task_group_task = factories.TaskGroupTaskFactory( task_group=task_group, contact=person) cycle_task_group = factories.CycleTaskGroupFactory( cycle=cycle, contact=person) task = factories.CycleTaskFactory( cycle=cycle, cycle_task_group=cycle_task_group, contact=person, task_group_task=task_group_task) results[task.id] = cycle.slug return results
def generate_tasks_for_cycle(group_count, task_count): """generate number of task groups and task for current task group""" results = {} workflow = factories.WorkflowFactory() cycle = factories.CycleFactory(workflow=workflow) task_group = factories.TaskGroupFactory(workflow=workflow) for idx in range(group_count): person = PersonFactory(name="user for group {}".format(idx)) cycle_task_group = factories.CycleTaskGroupFactory(cycle=cycle, contact=person) for _ in range(task_count): task_group_task = factories.TaskGroupTaskFactory( task_group=task_group, contact=person) task = factories.CycleTaskFactory( cycle=cycle, cycle_task_group=cycle_task_group, contact=person, task_group_task=task_group_task) results[task.id] = cycle_task_group.slug return results