Пример #1
0
 def testNoNeedToSendNotification(self, mocked_irc, mock_mo):
     revert_status = constants.CREATED_BY_SHERIFF
     commit_status = constants.SKIPPED
     pipeline_input = SendNotificationToIrcParameters(
         cl_key='mockurlsafekey',
         revert_status=revert_status,
         commit_status=commit_status,
         failure_type=failure_type.COMPILE)
     self.assertFalse(culprit_action.SendMessageToIRC(pipeline_input))
     self.assertFalse(mocked_irc.called)
     parameters = {'type': 'compile', 'action_taken': 'irc_notified_skip'}
     mock_mo.assert_called_once_with(parameters)
Пример #2
0
    def testSendNotificationToIRC(self, mock_mo, _):
        repo_name = 'chromium'
        revision = 'rev'
        revert_status = constants.CREATED_BY_FINDIT
        commit_status = constants.SKIPPED

        culprit = WfSuspectedCL.Create(repo_name, revision, 1)
        culprit.revert_cl = RevertCL()
        culprit.revert_cl.revert_cl_url = 'revert_url'
        culprit.put()

        pipeline_input = SendNotificationToIrcParameters(
            cl_key=culprit.key.urlsafe(),
            revert_status=revert_status,
            commit_status=commit_status,
            failure_type=failure_type.COMPILE)
        self.assertTrue(culprit_action.SendMessageToIRC(pipeline_input))
        parameters = {'type': 'compile', 'action_taken': 'irc_notified'}
        mock_mo.assert_called_once_with(parameters)
Пример #3
0
    def testSendNotificationNoRevert(self, mocked_irc, mock_mo):
        repo_name = 'chromium'
        revision = 'rev'
        revert_status = constants.CREATED_BY_FINDIT
        commit_status = constants.ERROR

        culprit = WfSuspectedCL.Create(repo_name, revision, 1)
        culprit.put()

        pipeline_input = SendNotificationToIrcParameters(
            cl_key=culprit.key.urlsafe(),
            revert_status=revert_status,
            commit_status=commit_status,
            failure_type=failure_type.COMPILE)
        self.assertFalse(culprit_action.SendMessageToIRC(pipeline_input))

        self.assertFalse(mocked_irc.called)
        parameters = {'type': 'compile', 'action_taken': 'irc_notified_error'}
        mock_mo.assert_called_once_with(parameters)
Пример #4
0
 def RunImpl(self, pipeline_input):
     return culprit_action.SendMessageToIRC(pipeline_input)