示例#1
0
    def test_process_allowed_origins_no_match(self, mock_origin, mock_extract):
        mock_origin.return_value = False

        obj = SnollaWorker(self.cfg, None, None)
        obj.process(self.commit)

        mock_origin.assert_called_once_with(self.commit)
        self.assertFalse(mock_extract.called)
示例#2
0
    def test_process_empty_extracted_actions(self, mock_origin, mock_extract, mock_handle):
        mock_origin.return_value = True
        mock_extract.return_value = []

        obj = SnollaWorker(self.cfg, None, None)
        obj.process(self.commit)

        mock_origin.assert_called_once_with(self.commit)
        mock_extract.assert_called_once_with(self.commit['message'], self.cfg['general']['extract_regex'])
        self.assertFalse(mock_handle.called)
示例#3
0
    def test_process_has_action_and_bugid(self, mock_origin, mock_extract, mock_handle):
        mock_origin.return_value = True
        mock_extract.return_value = [('action1', 1), ('action2', 2)]

        obj = SnollaWorker(self.cfg, None, None)
        obj.process(self.commit)

        mock_origin.assert_called_once_with(self.commit)
        mock_extract.assert_called_once_with(self.commit['message'], self.cfg['general']['extract_regex'])

        expected = [mock.call(action, bugid, self.commit) for action, bugid in mock_extract.return_value]
        self.assertEqual(expected, mock_handle.call_args_list)