def create_and_clone_audit_w_params_to_update(
         self, request, new_program_rest, new_control_rest,
         map_new_program_rest_to_new_control_rest, new_audit_rest,
         new_assessment_rest, new_assessment_template_rest, new_issue_rest,
         selenium):
     """Create Audit with clonable and non clonable objects via REST API and
 clone it with them via UI.
 Preconditions:
 - Program, Control created via REST API.
 - Control mapped to Program via REST API.
 - Audit created under Program via REST API.
 - Assessment, Assessment Template, Issue created under Audit via REST API.
 - Issue mapped to Audit via REST API.
 """
     # pylint: disable=too-many-locals
     if hasattr(request, "param") and request.param:
         if isinstance(request.param, tuple):
             fixture, params_to_update = request.param
             # fixtures which are objects
             if fixture in request.fixturenames and fixture.startswith(
                     "new_"):
                 fixture = locals().get(fixture)
                 (get_cls_rest_service(objects.get_plural(
                     fixture.type))().update_obj(obj=fixture,
                                                 **params_to_update))
     expected_audit = entities_factory.AuditsFactory.clone(
         audit=new_audit_rest)[0]
     expected_asmt_tmpl = entities_factory.AssessmentTemplatesFactory.clone(
         asmt_tmpl=new_assessment_template_rest)[0]
     actual_audit = (webui_service.AuditsService(
         selenium).clone_via_info_page_and_get_obj(
             audit_obj=new_audit_rest))
     return {
         "audit": new_audit_rest,
         "expected_audit": expected_audit,
         "actual_audit": actual_audit,
         "assessment": new_assessment_rest,
         "issue": new_issue_rest,
         "assessment_template": new_assessment_template_rest,
         "expected_assessment_template": expected_asmt_tmpl,
         "control": new_control_rest,
         "program": new_program_rest
     }
Esempio n. 2
0
 def create_and_clone_audit_w_params_to_update(
     self, request, program, control_mapped_to_program,
     audit, assessment, assessment_template_rest, issue_mapped_to_audit,
     selenium
 ):
   """Create Audit with clonable and non clonable objects via REST API and
   clone it with them via UI.
   Preconditions:
   - Program, Control created via REST API.
   - Control mapped to Program via REST API.
   - Audit created under Program via REST API.
   - Assessment, Assessment Template, Issue created under Audit via REST API.
   - Issue mapped to Audit via REST API.
   """
   # pylint: disable=too-many-locals
   if hasattr(request, "param") and request.param:
     if isinstance(request.param, tuple):
       fixture, params_to_update = request.param
       # fixtures which are objects
       if fixture in request.fixturenames and (
           fixture == "audit" or "assessment_template"
       ):
         fixture = locals().get(fixture)
         (get_cls_rest_service(objects.get_plural(fixture.type))().
          update_obj(obj=fixture, **params_to_update))
   expected_audit = entities_factory.AuditsFactory.clone(
       audit=audit)[0]
   expected_asmt_tmpl = entities_factory.AssessmentTemplatesFactory.clone(
       asmt_tmpl=assessment_template_rest)[0]
   actual_audit = (webui_service.AuditsService(selenium).
                   clone_via_info_page_and_get_obj(audit_obj=audit))
   return {
       "audit": audit, "expected_audit": expected_audit,
       "actual_audit": actual_audit, "assessment": assessment,
       "issue": issue_mapped_to_audit,
       "assessment_template": assessment_template_rest,
       "expected_assessment_template": expected_asmt_tmpl,
       "control": control_mapped_to_program, "program": program
   }