def test_prepare_update_json(self):
        """Test prepare_update_json method for Issue."""
        with factories.single_commit():
            issue = factories.IssueFactory()
            iti = factories.IssueTrackerIssueFactory(
                enabled=True,
                issue_tracked_obj=issue,
                title='title',
                component_id=123,
                hotlist_id=321,
                issue_type="PROCESS",
                issue_priority="P3",
                issue_severity="S3",
            )
        without_info = issue_integration.prepare_issue_update_json(issue)
        issue_info = issue.issue_tracker
        with_info = issue_integration.prepare_issue_update_json(
            issue, issue_info)

        expected_info = {
            'component_id': 123,
            'severity': u'S3',
            'title': iti.title,
            'hotlist_ids': [
                321,
            ],
            'priority': u'P3',
            'type': u'PROCESS',
        }
        self.assertEqual(expected_info, with_info)
        self.assertEqual(without_info, with_info)
Exemplo n.º 2
0
  def test_prepare_update_json(self):
    """Test prepare_update_json method for Issue."""
    with factories.single_commit():
      issue = factories.IssueFactory()
      iti = factories.IssueTrackerIssueFactory(
          enabled=True,
          issue_tracked_obj=issue,
          title='title',
          component_id=123,
          hotlist_id=321,
          issue_type="PROCESS",
          issue_priority="P3",
          issue_severity="S3",
      )
    without_info = issue_integration.prepare_issue_update_json(issue)
    issue_info = issue.issue_tracker
    with_info = issue_integration.prepare_issue_update_json(issue, issue_info)

    expected_info = {
        'component_id': 123,
        'severity': u'S3',
        'title': iti.title,
        'hotlist_ids': [321, ],
        'priority': u'P3',
        'type': u'PROCESS',
    }
    self.assertEqual(expected_info, with_info)
    self.assertEqual(without_info, with_info)