def test_check_allowed_origins_no_match(self, mock_task, mock_config, mock_create): mock_task.return_value = None mock_config.return_value = 'foo' mock_queue = mock.MagicMock() obj = SnollaWorker(self.cfg, None, mock_queue) obj.handle_extracted_action('action', 1, 'the commit') mock_task.assert_called_once_with('action', mock_config.return_value) mock_config.assert_called_once_with(self.cfg) self.assertFalse(mock_queue.called) self.assertFalse(mock_create.called)
def test_check_allowed_origins_match(self, mock_task, mock_config, mock_create): mock_task.return_value = 'afinetask' mock_config.return_value = 'foo' mock_create.return_value = 'the bugzilla task' mock_queue = mock.MagicMock() obj = SnollaWorker(self.cfg, None, mock_queue) obj.handle_extracted_action('action', 1, 'the commit') mock_task.assert_called_once_with('action', mock_config.return_value) mock_config.assert_called_once_with(self.cfg) mock_create.assert_called_once_with('afinetask', 1, 'the commit') mock_queue.put.assert_called_once_with('the bugzilla task')