Esempio n. 1
0
 def test_active_cycles_task_tree(self, activate_workflow, app_workflow):
   """Test active cycles tree."""
   workflow_cycles = workflow_ui_facade.get_workflow_cycles(
       app_workflow)
   expected_workflow_cycle = cycle_entity_population.create_workflow_cycle(
       app_workflow)
   test_utils.list_obj_assert(workflow_cycles, [expected_workflow_cycle])
Esempio n. 2
0
 def activate(self, workflow):
     """Activates workflow."""
     workflow.state = object_states.ACTIVE
     if workflow.repeat_unit:
         workflow.recurrences_started = True
         self.edit(workflow)
     else:
         cycle = cycle_entity_population.create_workflow_cycle(workflow)
         WorkflowCycleRestService().create(cycle)
Esempio n. 3
0
 def test_map_obj_to_cycle_task(self, activated_workflow, app_control,
                                selenium):
     """Test mapping of obj to a cycle task."""
     cycle_task = cycle_entity_population.create_workflow_cycle(
         activated_workflow).cycle_task_groups[0].cycle_tasks[0]
     workflow_ui_facade.map_obj_to_cycle_task(obj=app_control,
                                              cycle_task=cycle_task)
     selenium.refresh()  # reload page to check mapping is saved
     objs = workflow_ui_facade.get_objs_mapped_to_cycle_task(cycle_task)
     test_utils.list_obj_assert(objs, [app_control])
Esempio n. 4
0
 def test_add_cycle_task_assignee(self, some_creator,
                                  login_as_creator_or_reader,
                                  activated_workflow, selenium):
     """Test adding a cycle task assignee."""
     cycle_task = cycle_entity_population.create_workflow_cycle(
         activated_workflow).cycle_task_groups[0].cycle_tasks[0]
     workflow_ui_facade.add_assignee_to_cycle_task(assignee=some_creator,
                                                   cycle_task=cycle_task)
     selenium.refresh()  # reload page to check change is saved
     actual_cycle_task = workflow_ui_facade.get_cycle_task(cycle_task)
     test_utils.obj_assert(actual_cycle_task, cycle_task)
Esempio n. 5
0
 def test_map_obj_to_cycle_task(
     self, activated_workflow, app_control, selenium
 ):
   """Test mapping of obj to a cycle task."""
   cycle_task = cycle_entity_population.create_workflow_cycle(
       activated_workflow).cycle_task_groups[0].cycle_tasks[0]
   workflow_ui_facade.map_obj_to_cycle_task(
       obj=app_control, cycle_task=cycle_task)
   selenium.refresh()  # reload page to check mapping is saved
   objs = workflow_ui_facade.get_objs_mapped_to_cycle_task(cycle_task)
   test_utils.list_obj_assert(objs, [app_control])
Esempio n. 6
0
 def test_move_cycle_task_to_another_state(self, login_as_creator_or_reader,
                                           activated_workflow, selenium):
     """Test starting a cycle task."""
     # pylint: disable=invalid-name
     workflow_cycle = cycle_entity_population.create_workflow_cycle(
         activated_workflow)
     cycle_task = workflow_cycle.cycle_task_groups[0].cycle_tasks[0]
     workflow_ui_facade.start_cycle_task(cycle_task)
     selenium.refresh()  # reload page to check state is changed
     actual_workflow_cycles = workflow_ui_facade.get_workflow_cycles(
         activated_workflow)
     test_utils.list_obj_assert(actual_workflow_cycles, [workflow_cycle])
Esempio n. 7
0
 def test_add_cycle_task_assignee(
     self, some_creator, login_as_creator_or_reader, activated_workflow,
     selenium
 ):
   """Test adding a cycle task assignee."""
   cycle_task = cycle_entity_population.create_workflow_cycle(
       activated_workflow).cycle_task_groups[0].cycle_tasks[0]
   workflow_ui_facade.add_assignee_to_cycle_task(
       assignee=some_creator, cycle_task=cycle_task)
   selenium.refresh()  # reload page to check change is saved
   actual_cycle_task = workflow_ui_facade.get_cycle_task(cycle_task)
   test_utils.obj_assert(actual_cycle_task, cycle_task)
Esempio n. 8
0
 def test_add_comment_to_cycle_task(self, login_as_creator_or_reader,
                                    activated_workflow, selenium):
     """Test adding a comment to the cycle task."""
     cycle_task = cycle_entity_population.create_workflow_cycle(
         activated_workflow).cycle_task_groups[0].cycle_tasks[0]
     comment = entity_factory_common.CommentFactory().create(
         description="comment")
     workflow_ui_facade.add_comment_to_cycle_task(comment=comment,
                                                  cycle_task=cycle_task)
     selenium.refresh()  # reload page to check change is saved
     actual_cycle_task = workflow_ui_facade.get_cycle_task(cycle_task)
     test_utils.set_unknown_attrs_to_none(actual_cycle_task.comments[0])
     test_utils.obj_assert(actual_cycle_task, cycle_task)
Esempio n. 9
0
 def test_move_cycle_task_to_another_state(
     self, login_as_creator_or_reader, activated_workflow, selenium
 ):
   """Test starting a cycle task."""
   # pylint: disable=invalid-name
   workflow_cycle = cycle_entity_population.create_workflow_cycle(
       activated_workflow)
   cycle_task = workflow_cycle.cycle_task_groups[0].cycle_tasks[0]
   workflow_ui_facade.start_cycle_task(cycle_task)
   selenium.refresh()  # reload page to check state is changed
   actual_workflow_cycles = workflow_ui_facade.get_workflow_cycles(
       activated_workflow)
   test_utils.list_obj_assert(actual_workflow_cycles, [workflow_cycle])
Esempio n. 10
0
 def test_add_comment_to_cycle_task(
     self, login_as_creator_or_reader, activated_workflow, selenium
 ):
   """Test adding a comment to the cycle task."""
   cycle_task = cycle_entity_population.create_workflow_cycle(
       activated_workflow).cycle_task_groups[0].cycle_tasks[0]
   comment = entity_factory_common.CommentFactory().create(
       description="comment")
   workflow_ui_facade.add_comment_to_cycle_task(
       comment=comment, cycle_task=cycle_task)
   selenium.refresh()  # reload page to check change is saved
   actual_cycle_task = workflow_ui_facade.get_cycle_task(cycle_task)
   test_utils.set_unknown_attrs_to_none(actual_cycle_task.comments[0])
   test_utils.obj_assert(actual_cycle_task, cycle_task)
Esempio n. 11
0
 def test_destructive_activate_repeat_on_workflow(self,
                                                  app_repeat_on_workflow,
                                                  selenium):
     """Test activation of repeat on workflow.
 It should be checked separately as different requests are sent when
 repeat off and repeat on workflows are activated.
 """
     task_group = workflow_rest_facade.create_task_group(
         workflow=app_repeat_on_workflow)
     workflow_rest_facade.create_task_group_task(task_group=task_group)
     workflow_ui_facade.activate_workflow(app_repeat_on_workflow)
     workflow_cycles = workflow_ui_facade.get_workflow_cycles(
         app_repeat_on_workflow)
     expected_workflow_cycle = cycle_entity_population.create_workflow_cycle(
         app_repeat_on_workflow)
     test_utils.list_obj_assert(workflow_cycles, [expected_workflow_cycle])
Esempio n. 12
0
 def test_destructive_activate_repeat_on_workflow(
     self, app_repeat_on_workflow, selenium
 ):
   """Test activation of repeat on workflow.
   It should be checked separately as different requests are sent when
   repeat off and repeat on workflows are activated.
   """
   task_group = workflow_rest_facade.create_task_group(
       workflow=app_repeat_on_workflow)
   workflow_rest_facade.create_task_group_task(task_group=task_group)
   workflow_ui_facade.activate_workflow(app_repeat_on_workflow)
   workflow_cycles = workflow_ui_facade.get_workflow_cycles(
       app_repeat_on_workflow)
   expected_workflow_cycle = cycle_entity_population.create_workflow_cycle(
       app_repeat_on_workflow)
   self.check_ggrc_6491(workflow_cycles, [expected_workflow_cycle])
   test_utils.list_obj_assert(workflow_cycles, [expected_workflow_cycle])
Esempio n. 13
0
 def test_active_cycles_task_tree(self, activate_workflow, app_workflow):
     """Test active cycles tree."""
     workflow_cycles = workflow_ui_facade.get_workflow_cycles(app_workflow)
     expected_workflow_cycle = cycle_entity_population.create_workflow_cycle(
         app_workflow)
     test_utils.list_obj_assert(workflow_cycles, [expected_workflow_cycle])