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
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)
Exemple #3
0
def create_generic_issue(created_days_ago=28):
  """Returns a simple issue object for use in tests."""
  issue = Issue()
  issue.cc = []
  issue.comment = ''
  issue.comments = []
  issue.components = []
  issue.labels = []
  issue.open = True
  issue.owner = '*****@*****.**'
  issue.status = 'Assigned'
  issue.id = 1
  issue.itm = create_issue_tracker_manager()

  # Test issue was created 1 week before the current (mocked) time.
  issue.created = (
      test_utils.CURRENT_TIME - datetime.timedelta(days=created_days_ago))

  return monorail.Issue(issue)
    def test_recovered_build_failure(self):
        """Test fixed build failures."""
        # Use the same status for all build types.
        self.mock.get.return_value = MockResponse(
            json.dumps({
                'projects': [{
                    'history': [{
                        'finish_time': '2018-02-01T00:00:00.000000Z',
                        'build_id': 'proj0-id',
                        'success': True
                    }],
                    'name':
                    'proj0',
                }]
            }))

        data_types.OssFuzzBuildFailure(
            id='proj0',
            project_name='proj0',
            last_checked_timestamp=datetime.datetime(2018, 1, 31),
            issue_id='1',
            consecutive_failures=2,
            build_type='fuzzing').put()

        issue = Issue()
        issue.open = True
        issue.add_label('Type-Build-Failure')
        issue.add_label('Proj-proj2')
        issue.summary = 'Build failure in proj2'
        issue.body = 'Build failure'

        self.itm.issues[1] = issue

        self.app.get('/build-status')
        self.assertEqual(0, data_types.OssFuzzBuildFailure.query().count())

        issue = self.itm.issues[1]
        self.assertEqual('Verified', issue.status)
        self.assertEqual('The latest build has succeeded, closing this issue.',
                         issue.comment)