def test_put_comment_empty_text(self, model):
     """Test update review comment for {}."""
     obj = factories.get_model_factory(model.__name__)()
     obj_id = obj.id
     resp, _ = generate_review_object(obj, email_message="Test1")
     self.assertEqual(201, resp.status_code)
     resp, _ = generate_review_object(obj, email_message="")
     self.assertEqual(201, resp.status_code)
     obj = model.query.get(obj_id)
     comments = list(obj.related_objects(_types=["Comment"]))
     self.assertEqual(1, len(comments))
     self.assertEqual(
         u"<p>Review requested from</p><p>[email protected]</p>"
         u"<p>with a comment: Test1</p>", comments[0].description)
Example #2
0
    def test_assertions_import(self):
        """
    Change control assertions via import
    Review -> UNREVIEWED
    """
        control = factories.ControlFactory(title="Test control")
        resp, review = generate_review_object(
            control, state=all_models.Review.STATES.REVIEWED)
        del review
        control_id = control.id
        self.assertEqual(201, resp.status_code)

        control_categories = factories.ControlCategoryFactory.create_batch(6)
        for category in control_categories:
            factories.CategorizationFactory(category_id=category.id,
                                            categorizable_id=control_id,
                                            categorizable_type="Control",
                                            category_type="ControlAssertion")
        import_data = OrderedDict([("object_type", "Control"),
                                   ("Code*", control.slug),
                                   ("Assertions*", "Availability")])
        response = self.import_data(import_data)
        self._check_csv_response(response, {})
        control = all_models.Control.query.get(control_id)
        self.assertEqual(all_models.Review.STATES.UNREVIEWED,
                         control.review_status)
Example #3
0
  def test_snapshottable_import(self):
    """Revert state for snapshottable object via import.
    Review -> UNREVIEWED
    Email Notification added
    """
    program = factories.ProgramFactory(
        title="Test program"
    )
    product = factories.ProductFactory()
    product_slug = product.slug

    resp, review = generate_review_object(
        program, state=all_models.Review.STATES.REVIEWED)
    program_id = program.id
    self.assertEqual(201, resp.status_code)
    import_data = OrderedDict(
        [
            ("object_type", "Program"),
            ("Code*", program.slug),
            ("map:Product", product_slug)
        ]
    )
    response = self.import_data(import_data)
    self._check_csv_response(response, {})
    program = all_models.Program.query.get(program_id)
    self.assertEqual(
        all_models.Review.STATES.UNREVIEWED,
        program.review_status
    )
    notification = all_models.Notification.query.filter_by(
        object_id=review.id, object_type="Review"
    ).one()
    self.assertTrue(notification)
Example #4
0
  def test_change_attribute(self):
    """Reviewable changed via import
    Review -> UNREVIEWED
    Email Notification added
    """
    program = factories.ProgramFactory(title="Test program")

    resp, review = generate_review_object(
        program, state=all_models.Review.STATES.REVIEWED)
    program_id = program.id
    self.assertEqual(201, resp.status_code)
    import_data = OrderedDict(
        [
            ("object_type", "Program"),
            ("Code*", program.slug),
            ("Title*", "Brand new TiTle"),
            ("Program Managers", "*****@*****.**"),
        ]
    )
    response = self.import_data(import_data)
    self._check_csv_response(response, {})
    program = all_models.Program.query.get(program_id)
    self.assertEqual(
        all_models.Review.STATES.UNREVIEWED, program.review_status
    )
    notification = all_models.Notification.query.filter_by(
        object_id=review.id, object_type="Review"
    ).one()
    self.assertTrue(notification)
Example #5
0
    def test_change_attribute(self):
        """Reviewable changed via import
    Review -> UNREVIEWED
    Email Notification added
    """
        control = factories.ControlFactory(title="Test control")

        resp, review = generate_review_object(
            control, state=all_models.Review.STATES.REVIEWED)
        control_id = control.id
        self.assertEqual(201, resp.status_code)
        import_data = OrderedDict([
            ("object_type", "Control"),
            ("Code*", control.slug),
            ("Title*", "Brand new TiTle"),
            ("Admin*", "*****@*****.**"),
            ("Assertions", "Privacy"),
        ])
        response = self.import_data(import_data)
        self._check_csv_response(response, {})
        control = all_models.Control.query.get(control_id)
        self.assertEqual(all_models.Review.STATES.UNREVIEWED,
                         control.review_status)
        notification = all_models.Notification.query.filter_by(
            object_id=review.id, object_type="Review").one()
        self.assertTrue(notification)
Example #6
0
  def test_change_acl_import(self):
    """Change acl via import
    Review -> REVIEWED
    """
    risk = factories.RiskFactory()
    resp, review = generate_review_object(
        risk, state=all_models.Review.STATES.REVIEWED)
    del review
    risk_id = risk.id
    self.assertEqual(201, resp.status_code)

    person = factories.PersonFactory()
    import_data = OrderedDict(
        [
            ("object_type", "Risk"),
            ("Code*", risk.slug),
            ("admin", person.email)
        ]
    )
    response = self.import_data(import_data)
    self._check_csv_response(response, {})
    risk = all_models.Risk.query.get(risk_id)
    self.assertEqual(
        all_models.Review.STATES.REVIEWED,
        risk.review_status
    )
    def test_change_attribute(self):
        """Reviewable changed via import
    Review -> UNREVIEWED
    Email Notification added
    """
        program = factories.ProgramFactory(title="Test program")

        resp, review = generate_review_object(
            program, state=all_models.Review.STATES.REVIEWED)
        program_id = program.id
        self.assertEqual(201, resp.status_code)
        import_data = OrderedDict([
            ("object_type", "Program"),
            ("Code*", program.slug),
            ("Title*", "Brand new TiTle"),
            ("Program Managers", "*****@*****.**"),
        ])
        response = self.import_data(import_data)
        self._check_csv_response(response, {})
        program = all_models.Program.query.get(program_id)
        self.assertEqual(all_models.Review.STATES.UNREVIEWED,
                         program.review_status)
        notification = all_models.Notification.query.filter_by(
            object_id=review.id, object_type="Review").one()
        self.assertTrue(notification)
Example #8
0
 def test_non_snapshottable_import(self):
   """Reviewable mapped to non snapshotable via import
   Review -> REVIEWED
   """
   risk = factories.RiskFactory()
   issue = factories.IssueFactory()
   issue_slug = issue.slug
   resp, review = generate_review_object(
       risk, state=all_models.Review.STATES.REVIEWED)
   del review
   risk_id = risk.id
   self.assertEqual(201, resp.status_code)
   import_data = OrderedDict(
       [
           ("object_type", "Risk"),
           ("Code*", risk.slug),
           ("map:Issue", issue_slug),
       ]
   )
   response = self.import_data(import_data)
   self._check_csv_response(response, {})
   risk = all_models.Risk.query.get(risk_id)
   self.assertEqual(
       all_models.Review.STATES.REVIEWED, risk.review_status
   )
Example #9
0
  def test_snapshottable_import(self):
    """Revert state for snapshottable object via import.
    Review -> UNREVIEWED
    Email Notification added
    """
    program = factories.ProgramFactory(
        title="Test program"
    )
    product = factories.ProductFactory()
    product_slug = product.slug

    resp, review = generate_review_object(
        program, state=all_models.Review.STATES.REVIEWED)
    program_id = program.id
    self.assertEqual(201, resp.status_code)
    import_data = OrderedDict(
        [
            ("object_type", "Program"),
            ("Code*", program.slug),
            ("map:Product", product_slug)
        ]
    )
    response = self.import_data(import_data)
    self._check_csv_response(response, {})
    program = all_models.Program.query.get(program_id)
    self.assertEqual(
        all_models.Review.STATES.UNREVIEWED,
        program.review_status
    )
    notification = all_models.Notification.query.filter_by(
        object_id=review.id, object_type="Review"
    ).one()
    self.assertTrue(notification)
Example #10
0
  def test_simple_import(self):
    """Disallow user to change review state"""
    program = factories.ProgramFactory()

    resp, _ = generate_review_object(program)
    program_id = program.id
    self.assertEqual(201, resp.status_code)
    import_data = OrderedDict(
        [
            ("object_type", "Program"),
            ("Code*", program.slug),
            ("Review State", "REVIEWED"),
        ]
    )
    response = self.import_data(import_data)
    expected_response = {
        "Program": {
            "row_warnings": {
                errors.REVIEWABLE_WILL_BE_IGNORED.format(
                    column_name="Review State", line=3),
            },
        }
    }
    self._check_csv_response(response, expected_response)

    program = all_models.Program.query.get(program_id)
    self.assertEqual(
        all_models.Review.STATES.UNREVIEWED, program.review_status
    )
Example #11
0
  def test_change_acl_import(self):
    """Change acl via import
    Review -> REVIEWED
    """
    program = factories.ProgramFactory()
    resp, review = generate_review_object(
        program, state=all_models.Review.STATES.REVIEWED)
    del review
    program_id = program.id
    self.assertEqual(201, resp.status_code)

    person = factories.PersonFactory()
    import_data = OrderedDict(
        [
            ("object_type", "Program"),
            ("Code*", program.slug),
            ("Program Managers", person.email)
        ]
    )
    response = self.import_data(import_data)
    self._check_csv_response(response, {})
    program = all_models.Program.query.get(program_id)
    self.assertEqual(
        all_models.Review.STATES.REVIEWED,
        program.review_status
    )
Example #12
0
  def test_unmap_nonsnapshotable(self):
    """Unmap nonsnapshotable shouldn't change review status"""
    self.api.login_as_normal()

    risk = factories.RiskFactory()
    resp, review = generate_review_object(
        risk, state=all_models.Review.STATES.REVIEWED)
    review_id = review.id
    _, rel = self.generator.generate_relationship(
        source=risk,
        destination=factories.ProgramFactory(),
        context=None,
    )

    review = all_models.Review.query.get(review_id)
    resp = self.api.modify_object(
        review, {"status": all_models.Review.STATES.REVIEWED}
    )
    self.assert200(resp)
    review = all_models.Review.query.get(review_id)
    self.assertEqual(review.status, all_models.Review.STATES.REVIEWED)

    resp = self.api.delete(rel)
    self.assert200(resp)
    review = all_models.Review.query.get(review_id)
    self.assertEqual(review.status, all_models.Review.STATES.REVIEWED)
Example #13
0
 def test_non_snapshottable_import(self):
   """Reviewable mapped to non snapshotable via import
   Review -> REVIEWED
   """
   program = factories.ProgramFactory()
   issue = factories.IssueFactory()
   issue_slug = issue.slug
   resp, review = generate_review_object(
       program, state=all_models.Review.STATES.REVIEWED)
   del review
   program_id = program.id
   self.assertEqual(201, resp.status_code)
   import_data = OrderedDict(
       [
           ("object_type", "Program"),
           ("Code*", program.slug),
           ("map:Issue", issue_slug),
       ]
   )
   response = self.import_data(import_data)
   self._check_csv_response(response, {})
   program = all_models.Program.query.get(program_id)
   self.assertEqual(
       all_models.Review.STATES.REVIEWED, program.review_status
   )
    def test_review_posted(self, model, send_email_mock):
        """Test mentions in request review comment {}."""
        with factories.single_commit():
            factories.PersonFactory(email="*****@*****.**")
            obj = factories.get_model_factory(model.__name__)()
            url = urljoin(get_url_root(), utils.view_url_for(obj))

        with freeze_time("2018-01-10 07:31:42"):
            resp, _ = generate_review_object(
                obj,
                email_message=
                u"Test <a href=\"mailto:[email protected]\"></a>",
            )
        self.assertEqual(201, resp.status_code)

        expected_title = (u"[email protected] mentioned you on "
                          u"a comment within {title}").format(title=obj.title)
        expected_body = (
            u"[email protected] mentioned you on a comment within {title} "
            u"at 01/09/2018 23:31:42 PST:\n"
            u"<p>Review requested from</p>"
            u"<p>[email protected]</p>"
            u"<p>with a comment:"
            u" Test <a href=\"mailto:[email protected]\"></a></p>\n"
        ).format(title=obj.title)
        body = settings.EMAIL_MENTIONED_PERSON.render(
            person_mention={
                "comments": [expected_body],
                "url": url,
            })
        send_email_mock.assert_called_once_with(u"*****@*****.**",
                                                expected_title, body)
 def test_comment_import(self):
     """Don't revert state when comment added.
 Review -> REVIEWED
 """
     risk = factories.RiskFactory()
     resp, review = generate_review_object(
         risk, state=all_models.Review.STATES.REVIEWED)
     del review
     risk_id = risk.id
     self.assertEqual(201, resp.status_code)
     import_data = OrderedDict([("object_type", "Risk"),
                                ("Code*", risk.slug),
                                ("comments", "some comments")])
     response = self.import_data(import_data)
     self._check_csv_response(response, {})
     risk = all_models.Risk.query.get(risk_id)
     self.assertEqual(all_models.Review.STATES.REVIEWED, risk.review_status)
Example #16
0
    def test_simple_import(self):
        """Disallow user to change review state"""
        control = factories.ControlFactory(title="Test control")

        resp, _ = generate_review_object(control)
        control_id = control.id
        self.assertEqual(201, resp.status_code)
        import_data = OrderedDict([
            ("object_type", "Control"),
            ("Code*", control.slug),
            ("Review State", "REVIEWED"),
        ])
        response = self.import_data(import_data)
        self._check_csv_response(response, {})

        control = all_models.Control.query.get(control_id)
        self.assertEqual(all_models.Review.STATES.UNREVIEWED,
                         control.review_status)
    def test_simple_import(self):
        """Disallow user to change review state"""
        risk = factories.RiskFactory()

        resp, _ = generate_review_object(risk)
        risk_id = risk.id
        self.assertEqual(201, resp.status_code)
        import_data = OrderedDict([
            ("object_type", "Risk"),
            ("Code*", risk.slug),
            ("Review State", "REVIEWED"),
        ])
        response = self.import_data(import_data)
        self._check_csv_response(response, {})

        risk = all_models.Risk.query.get(risk_id)
        self.assertEqual(all_models.Review.STATES.UNREVIEWED,
                         risk.review_status)
Example #18
0
 def test_comment_import(self):
     """Don't revert state when comment added.
 Review -> REVIEWED
 """
     control = factories.ControlFactory(title="Test control")
     resp, review = generate_review_object(
         control, state=all_models.Review.STATES.REVIEWED)
     del review
     control_id = control.id
     self.assertEqual(201, resp.status_code)
     import_data = OrderedDict([("object_type", "Control"),
                                ("Code*", control.slug),
                                ("comments", "some comments")])
     response = self.import_data(import_data)
     self._check_csv_response(response, {})
     control = all_models.Control.query.get(control_id)
     self.assertEqual(all_models.Review.STATES.REVIEWED,
                      control.review_status)
Example #19
0
    def test_map_nonsnapshotable(self, nonsnapshotable):
        """Map '{}' shouldn't change review status"""
        control = factories.ControlFactory()
        _, review = generate_review_object(
            control, state=all_models.Review.STATES.REVIEWED)
        review_id = review.id

        review = all_models.Review.query.get(review_id)

        self.assertEqual(review.status, all_models.Review.STATES.REVIEWED)

        self.generator.generate_relationship(
            source=control,
            destination=factories.get_model_factory(nonsnapshotable)(),
            context=None,
        )

        review = all_models.Review.query.get(review_id)
        self.assertEqual(review.status, all_models.Review.STATES.REVIEWED)
Example #20
0
  def test_proposal_apply(self):
    """Reviewable object changed via proposal -> review.state-> UNREVIEWED"""
    risk = factories.RiskFactory()
    _, review = generate_review_object(risk)

    review_id = review.id

    proposal_content = {
        "fields": {
            "title": "new title"
        },
    }
    proposal = factories.ProposalFactory(
        instance=risk, content=proposal_content, agenda="agenda content"
    )
    self.api.modify_object(proposal, {"status": proposal.STATES.APPLIED})

    review = all_models.Review.query.get(review_id)
    self.assertEqual(review.status, all_models.Review.STATES.UNREVIEWED)
Example #21
0
  def test_map_nonsnapshotable(self, nonsnapshotable):
    """Map '{}' shouldn't change review status"""
    risk = factories.RiskFactory()
    _, review = generate_review_object(
        risk, state=all_models.Review.STATES.REVIEWED)
    review_id = review.id

    review = all_models.Review.query.get(review_id)

    self.assertEqual(review.status, all_models.Review.STATES.REVIEWED)

    self.generator.generate_relationship(
        source=risk,
        destination=factories.get_model_factory(nonsnapshotable)(),
        context=None,
    )

    review = all_models.Review.query.get(review_id)
    self.assertEqual(review.status, all_models.Review.STATES.REVIEWED)
    def test_change_acl_import(self):
        """Change acl via import
    Review -> REVIEWED
    """
        risk = factories.RiskFactory()
        resp, review = generate_review_object(
            risk, state=all_models.Review.STATES.REVIEWED)
        del review
        risk_id = risk.id
        self.assertEqual(201, resp.status_code)

        person = factories.PersonFactory()
        import_data = OrderedDict([("object_type", "Risk"),
                                   ("Code*", risk.slug),
                                   ("admin", person.email)])
        response = self.import_data(import_data)
        self._check_csv_response(response, {})
        risk = all_models.Risk.query.get(risk_id)
        self.assertEqual(all_models.Review.STATES.REVIEWED, risk.review_status)
    def test_without_changes_import(self):
        """Import snapshotable without changes.
    Review -> REVIEWED
    """
        risk = factories.RiskFactory()
        resp, review = generate_review_object(
            risk, state=all_models.Review.STATES.REVIEWED)

        del review
        risk_id = risk.id
        self.assertEqual(201, resp.status_code)
        import_data = OrderedDict([
            ("object_type", "Risk"),
            ("Code*", risk.slug),
        ])
        response = self.import_data(import_data)
        self._check_csv_response(response, {})
        risk = all_models.Risk.query.get(risk_id)
        self.assertEqual(all_models.Review.STATES.REVIEWED, risk.review_status)
Example #24
0
    def test_proposal_apply(self):
        """Reviewable object changed via proposal -> review.state-> UNREVIEWED"""
        control = factories.ControlFactory()
        _, review = generate_review_object(control)

        review_id = review.id

        proposal_content = {
            "fields": {
                "title": "new title"
            },
        }
        proposal = factories.ProposalFactory(instance=control,
                                             content=proposal_content,
                                             agenda="agenda content")
        self.api.modify_object(proposal, {"status": proposal.STATES.APPLIED})

        review = all_models.Review.query.get(review_id)
        self.assertEqual(review.status, all_models.Review.STATES.UNREVIEWED)
Example #25
0
    def test_without_changes_import(self):
        """Import snapshotable without changes.
    Review -> REVIEWED
    """
        control = factories.ControlFactory(title="Test control")
        resp, review = generate_review_object(
            control, state=all_models.Review.STATES.REVIEWED)

        del review
        control_id = control.id
        self.assertEqual(201, resp.status_code)
        import_data = OrderedDict([
            ("object_type", "Control"),
            ("Code*", control.slug),
        ])
        response = self.import_data(import_data)
        self._check_csv_response(response, {})
        control = all_models.Control.query.get(control_id)
        self.assertEqual(all_models.Review.STATES.REVIEWED,
                         control.review_status)
Example #26
0
    def test_change_acl_import(self):
        """Change acl via import
    Review -> REVIEWED
    """
        control = factories.ControlFactory(title="Test control")
        resp, review = generate_review_object(
            control, state=all_models.Review.STATES.REVIEWED)
        del review
        control_id = control.id
        self.assertEqual(201, resp.status_code)

        person = factories.PersonFactory()
        import_data = OrderedDict([("object_type", "Control"),
                                   ("Code*", control.slug),
                                   ("admin", person.email)])
        response = self.import_data(import_data)
        self._check_csv_response(response, {})
        control = all_models.Control.query.get(control_id)
        self.assertEqual(all_models.Review.STATES.REVIEWED,
                         control.review_status)
Example #27
0
    def test_unmap_snapshotable(self):
        """Unmap snapshotable should change review status"""
        control = factories.ControlFactory()
        resp, review = generate_review_object(control)
        review_id = review.id

        _, rel = self.generator.generate_relationship(
            source=control,
            destination=factories.ProductFactory(),
            context=None,
        )

        review = all_models.Review.query.get(review_id)
        resp = self.api.modify_object(
            review, {"status": all_models.Review.STATES.REVIEWED})
        self.assert200(resp)

        resp = self.api.delete(rel)
        self.assert200(resp)
        review = all_models.Review.query.get(review_id)
        self.assertEqual(review.status, all_models.Review.STATES.UNREVIEWED)
Example #28
0
  def test_simple_import(self):
    """Disallow user to change review state"""
    risk = factories.RiskFactory()

    resp, _ = generate_review_object(risk)
    risk_id = risk.id
    self.assertEqual(201, resp.status_code)
    import_data = OrderedDict(
        [
            ("object_type", "Risk"),
            ("Code*", risk.slug),
            ("Review State", "REVIEWED"),
        ]
    )
    response = self.import_data(import_data)
    self._check_csv_response(response, {})

    risk = all_models.Risk.query.get(risk_id)
    self.assertEqual(
        all_models.Review.STATES.UNREVIEWED, risk.review_status
    )
Example #29
0
 def test_non_snapshottable_import(self):
     """Reviewable mapped to non snapshotable via import
 Review -> REVIEWED
 """
     control = factories.ControlFactory(title="Test control")
     issue = factories.IssueFactory()
     issue_slug = issue.slug
     resp, review = generate_review_object(
         control, state=all_models.Review.STATES.REVIEWED)
     del review
     control_id = control.id
     self.assertEqual(201, resp.status_code)
     import_data = OrderedDict([
         ("object_type", "Control"),
         ("Code*", control.slug),
         ("map:Issue", issue_slug),
     ])
     response = self.import_data(import_data)
     self._check_csv_response(response, {})
     control = all_models.Control.query.get(control_id)
     self.assertEqual(all_models.Review.STATES.REVIEWED,
                      control.review_status)
    def test_unmap_nonsnapshotable(self):
        """Unmap nonsnapshotable shouldn't change review status"""
        program = factories.ProgramFactory()
        resp, review = generate_review_object(
            program, state=all_models.Review.STATES.REVIEWED)
        review_id = review.id
        _, rel = self.generator.generate_relationship(
            source=program,
            destination=factories.ProgramFactory(),
            context=None,
        )

        review = all_models.Review.query.get(review_id)
        resp = self.api.modify_object(
            review, {"status": all_models.Review.STATES.REVIEWED})
        self.assert200(resp)
        review = all_models.Review.query.get(review_id)
        self.assertEqual(review.status, all_models.Review.STATES.REVIEWED)

        resp = self.api.delete(rel)
        self.assert200(resp)
        review = all_models.Review.query.get(review_id)
        self.assertEqual(review.status, all_models.Review.STATES.REVIEWED)
Example #31
0
  def test_without_changes_import(self):
    """Import snapshotable without changes.
    Review -> REVIEWED
    """
    program = factories.ProgramFactory()
    resp, review = generate_review_object(
        program, state=all_models.Review.STATES.REVIEWED)

    del review
    program_id = program.id
    self.assertEqual(201, resp.status_code)
    import_data = OrderedDict(
        [
            ("object_type", "Program"),
            ("Code*", program.slug),
        ]
    )
    response = self.import_data(import_data)
    self._check_csv_response(response, {})
    program = all_models.Program.query.get(program_id)
    self.assertEqual(
        all_models.Review.STATES.REVIEWED,
        program.review_status
    )
Example #32
0
  def test_without_changes_import(self):
    """Import snapshotable without changes.
    Review -> REVIEWED
    """
    risk = factories.RiskFactory()
    resp, review = generate_review_object(
        risk, state=all_models.Review.STATES.REVIEWED)

    del review
    risk_id = risk.id
    self.assertEqual(201, resp.status_code)
    import_data = OrderedDict(
        [
            ("object_type", "Risk"),
            ("Code*", risk.slug),
        ]
    )
    response = self.import_data(import_data)
    self._check_csv_response(response, {})
    risk = all_models.Risk.query.get(risk_id)
    self.assertEqual(
        all_models.Review.STATES.REVIEWED,
        risk.review_status
    )
Example #33
0
 def test_reference_url_import(self):
   """Don't revert state when reference url added.
   Review -> REVIEWED
   """
   program = factories.ProgramFactory()
   resp, review = generate_review_object(
       program, state=all_models.Review.STATES.REVIEWED)
   del review
   program_id = program.id
   self.assertEqual(201, resp.status_code)
   import_data = OrderedDict(
       [
           ("object_type", "Program"),
           ("Code*", program.slug),
           ("reference url", "*****@*****.**")
       ]
   )
   response = self.import_data(import_data)
   self._check_csv_response(response, {})
   program = all_models.Program.query.get(program_id)
   self.assertEqual(
       all_models.Review.STATES.REVIEWED,
       program.review_status
   )
Example #34
0
 def test_reference_url_import(self):
   """Don't revert state when reference url added.
   Review -> REVIEWED
   """
   risk = factories.RiskFactory()
   resp, review = generate_review_object(
       risk, state=all_models.Review.STATES.REVIEWED)
   del review
   risk_id = risk.id
   self.assertEqual(201, resp.status_code)
   import_data = OrderedDict(
       [
           ("object_type", "Risk"),
           ("Code*", risk.slug),
           ("reference url", "*****@*****.**")
       ]
   )
   response = self.import_data(import_data)
   self._check_csv_response(response, {})
   risk = all_models.Risk.query.get(risk_id)
   self.assertEqual(
       all_models.Review.STATES.REVIEWED,
       risk.review_status
   )