Esempio n. 1
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
Esempio n. 2
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 = ['Test>Component']
    issue.labels = ['TestLabel', 'Pri-1', 'OS-Windows']
    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 = CURRENT_TIME - datetime.timedelta(days=created_days_ago)

    return 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({
                'successes': [
                    {
                        'name': 'proj0',
                        'finish_time': '2018-02-01T00:00:00.000000Z',
                        'build_id': 'proj0-id',
                    },
                ],
                'failures': [],
            }))

        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.assertFalse(issue.open)
        self.assertEqual('Verified', issue.status)
        self.assertEqual('The latest build has succeeded, closing this issue.',
                         issue.comment)