コード例 #1
0
    def setUp(self):
        helpers.patch(self, [
            'libs.issue_management.monorail.issue_tracker_manager.'
            'IssueTrackerManager.get_issues',
        ])

        mock_issue = MonorailIssue()
        mock_issue.id = 1337
        mock_issue.summary = 'summary'
        mock_issue.body = 'body'
        mock_issue.owner = 'owner'
        mock_issue.reporter = 'reporter'
        mock_issue.status = 'New'
        mock_issue.add_label('label1')
        mock_issue.add_label('label2')
        mock_issue.add_component('A>B')
        mock_issue.add_component('C>D')
        mock_issue.add_cc('*****@*****.**')

        mock_comment0 = MonorailComment()
        mock_comment0.author = 'author'
        mock_comment0.cc = ['*****@*****.**', '*****@*****.**']
        mock_comment0.labels = ['-label0', 'label1']
        mock_comment0.components = ['-E>F', 'A>B']
        mock_comment0.comment = 'comment'
        mock_comment0.summary = 'summary'
        mock_comment0.status = 'status'
        mock_comment0.owner = 'owner'

        mock_comment1 = MonorailComment()
        mock_comment1.author = 'author'
        mock_comment1.comment = 'comment'

        mock_issue.comments = [
            mock_comment0,
            mock_comment1,
        ]

        mock_issue_merged = MonorailIssue()
        mock_issue_merged.id = 1338
        mock_issue_merged.merged_into = 1337
        mock_issue_merged.merged_into_project = 'project'
        mock_issue_merged.closed = datetime.datetime(2019, 1, 1)

        mock_issue_merged_another_project = MonorailIssue()
        mock_issue_merged_another_project.id = 1339
        mock_issue_merged_another_project.merged_into = 1
        mock_issue_merged_another_project.merged_into_project = 'different-project'

        mock_issues = {
            1337: mock_issue,
            1338: mock_issue_merged,
            1339: mock_issue_merged_another_project,
        }

        self.itm = IssueTrackerManager('project', mock_issues)
        self.issue_tracker = monorail.IssueTracker(self.itm)
コード例 #2
0
    def get_original_issue(self, issue_id):
        """Get original issue."""
        issue = Issue()
        issue.open = True
        issue.itm = self
        issue.id = issue_id

        if issue_id == 1337:
            issue.add_cc('*****@*****.**')
            issue.add_label('Restrict-View-Commit')
        elif issue_id == 1338:
            issue.add_cc('*****@*****.**')
            issue.add_cc('*****@*****.**')
        elif issue_id == 1340:
            issue.add_label('reported-2015-01-01')

        return issue
コード例 #3
0
def get_original_issue(self, issue_id):
  """Get original issue."""
  issue_id = int(issue_id)

  issue = Issue()
  issue.open = True
  issue.itm = self._itm  # pylint: disable=protected-access
  issue.id = issue_id

  if issue_id == 1337:
    issue.add_cc('*****@*****.**')
    issue.add_label('Restrict-View-Commit')
  elif issue_id == 1338:
    issue.add_cc('*****@*****.**')
    issue.add_cc('*****@*****.**')
  elif issue_id == 1340:
    issue.add_label('reported-2015-01-01')

  return monorail.Issue(issue)