Example #1
0
 def test_asmt_from_template_w_dropdown_url(self, program,
                                            control_mapped_to_program,
                                            audit, selenium):
     """Check evidence url could be filled in
 via Assessment dropdown.
 Objects structure:
 Program.
 -> Control mapped to program.
 -> Audit.
   -> Asmt template with evidence url dropdown.
     -> Autogenerated asmt.
 """
     asmt_template_w_dropdown = rest_facade.create_asmt_template_w_dropdown(
         audit, ["url"])
     expected_asmt = rest_facade.create_asmt_from_template_rest(
         audit, control_mapped_to_program, asmt_template_w_dropdown)
     dropdown = CustomAttributeDefinitionsFactory().create(
         **expected_asmt.cads_from_template()[0])
     asmt_service = webui_service.AssessmentsService(selenium)
     exp_url = StringMethods.random_string(
         size=StringMethods.RANDOM_STR_LENGTH)
     expected_asmt = asmt_service.choose_and_fill_dropdown_lca(
         expected_asmt, dropdown, url=exp_url)
     expected_asmt_urls = [exp_url]
     expected_asmt.update_attrs(
         updated_at=self.info_service().get_obj(
             obj=expected_asmt).updated_at,
         evidence_urls=expected_asmt_urls,
         mapped_objects=[control_mapped_to_program.title],
         status=object_states.IN_PROGRESS).repr_ui()
     actual_asmt = asmt_service.get_obj_from_info_page(obj=expected_asmt)
     self.general_equal_assert(expected_asmt, actual_asmt, "audit")
Example #2
0
 def test_asmt_from_template_w_dropdown_url(
     self, program, control_mapped_to_program, audit, selenium
 ):
   """Check evidence url could be filled in
   via Assessment dropdown.
   Objects structure:
   Program.
   -> Control mapped to program.
   -> Audit.
     -> Asmt template with evidence url dropdown.
       -> Autogenerated asmt.
   """
   asmt_template_w_dropdown = rest_facade.create_asmt_template_w_dropdown(
       audit, ["url"])
   expected_asmt = rest_facade.create_asmt_from_template_rest(
       audit, control_mapped_to_program, asmt_template_w_dropdown)
   dropdown = CustomAttributeDefinitionsFactory().create(
       **expected_asmt.cads_from_template()[0])
   asmt_service = webui_service.AssessmentsService(selenium)
   exp_url = StringMethods.random_string(
       size=StringMethods.RANDOM_STR_LENGTH)
   expected_asmt = asmt_service.choose_and_fill_dropdown_lca(
       expected_asmt, dropdown, url=exp_url)
   expected_asmt_urls = [exp_url]
   expected_asmt.update_attrs(
       updated_at=self.info_service().get_obj(obj=expected_asmt).updated_at,
       evidence_urls=expected_asmt_urls,
       mapped_objects=[control_mapped_to_program.title],
       status=object_states.IN_PROGRESS).repr_ui()
   actual_asmt = asmt_service.get_obj_from_info_page(obj=expected_asmt)
   self.general_equal_assert(expected_asmt, actual_asmt, "audit")
 def test_asmt_from_template_w_dropdown_comment(self, program,
                                                control_mapped_to_program,
                                                audit, selenium):
     """Check evidence comment could be filled in
 via Assessment dropdown.
 Objects structure:
 Program.
 -> Control mapped to program.
 -> Audit.
   -> Asmt template with evidence comment dropdown.
     -> Autogenerated asmt.
 """
     asmt_template_w_dropdown = rest_facade.create_asmt_template_w_dropdown(
         audit, ["comment"])
     expected_asmt = rest_facade.create_asmt_from_template_rest(
         audit, control_mapped_to_program, asmt_template_w_dropdown)
     dropdown = CustomAttributeDefinitionsFactory().create(
         **expected_asmt.cads_from_template()[0])
     asmt_service = webui_service.AssessmentsService(selenium)
     expected_asmt_comments = [entities_factory.CommentsFactory().create()]
     asmt_service.choose_and_fill_dropdown_lca(
         expected_asmt,
         dropdown.id,
         dropdown.multi_choice_options,
         comment=expected_asmt_comments[0].description)
     expected_asmt_comments = [
         expected_comment.update_attrs(created_at=self.info_service(
         ).get_comment_obj(paren_obj=expected_asmt,
                           comment_description=expected_comment.description
                           ).created_at).repr_ui()
         for expected_comment in expected_asmt_comments
     ]
     expected_asmt.update_attrs(
         updated_at=self.info_service().get_obj(
             obj=expected_asmt).updated_at,
         comments=expected_asmt_comments,
         mapped_objects=[control_mapped_to_program.title],
         status=AssessmentStates.IN_PROGRESS).repr_ui()
     expected_asmt_comments_descriptions = [
         comment.description for comment in expected_asmt_comments
     ]
     actual_asmt = asmt_service.get_obj_from_info_page(obj=expected_asmt)
     actual_asmt_comments_descriptions = [
         comment["description"] for comment in actual_asmt.comments
     ]
     self.general_equal_assert(expected_asmt, actual_asmt, "audit",
                               "comments")
     assert expected_asmt_comments_descriptions \
         == actual_asmt_comments_descriptions
Example #4
0
 def test_asmt_from_template_w_dropdown_comment(
     self, program, control_mapped_to_program, audit, selenium
 ):
   """Check evidence comment could be filled in
   via Assessment dropdown.
   Objects structure:
   Program.
   -> Control mapped to program.
   -> Audit.
     -> Asmt template with evidence comment dropdown.
       -> Autogenerated asmt.
   """
   asmt_template_w_dropdown = rest_facade.create_asmt_template_w_dropdown(
       audit, ["comment"])
   expected_asmt = rest_facade.create_asmt_from_template_rest(
       audit, control_mapped_to_program, asmt_template_w_dropdown)
   dropdown = CustomAttributeDefinitionsFactory().create(
       **expected_asmt.cads_from_template()[0])
   asmt_service = webui_service.AssessmentsService(selenium)
   expected_asmt_comments = [entities_factory.CommentsFactory().create()]
   expected_asmt = asmt_service.choose_and_fill_dropdown_lca(
       expected_asmt, dropdown,
       comment=expected_asmt_comments[0].description)
   expected_asmt_comments = [expected_comment.update_attrs(
       created_at=self.info_service().get_comment_obj(
           paren_obj=expected_asmt,
           comment_description=expected_comment.description).created_at
   ).repr_ui() for expected_comment in expected_asmt_comments]
   expected_asmt.update_attrs(
       updated_at=self.info_service().get_obj(obj=expected_asmt).updated_at,
       comments=expected_asmt_comments,
       mapped_objects=[control_mapped_to_program.title],
       status=object_states.IN_PROGRESS).repr_ui()
   expected_asmt_comments_descriptions = [
       comment.description for comment in expected_asmt_comments]
   actual_asmt = asmt_service.get_obj_from_info_page(obj=expected_asmt)
   actual_asmt_comments_descriptions = [
       comment["description"] for comment in actual_asmt.comments]
   self.general_equal_assert(expected_asmt, actual_asmt, "audit", "comments")
   assert expected_asmt_comments_descriptions \
       == actual_asmt_comments_descriptions