def test_should_not_initialize_sys_log_handler_when_optin_is_given(self, mock_create_sys_log_handler, mock_logger):

        mock_handler = Mock()
        mock_create_sys_log_handler.return_value = mock_handler

        initialize_logging_to_syslog({'--no-syslog': True}, '23784')

        self.assertEqual(0, mock_create_sys_log_handler.call_count)
        self.assertEqual(0, mock_logger.addHandler.call_count)
    def test_should_initialize_sys_log_handler_with_given_revision_when_optin_not_given(self, mock_create_sys_log_handler, mock_logger):

        mock_handler = Mock()
        mock_create_sys_log_handler.return_value = mock_handler

        initialize_logging_to_syslog({'--no-syslog': False}, '23784')

        mock_create_sys_log_handler.assert_called_with('23784')
        mock_logger.addHandler.assert_called_with(mock_handler)
Beispiel #3
0
    def test_should_not_initialize_sys_log_handler_when_optin_is_given(
            self, mock_create_sys_log_handler, mock_logger):

        mock_handler = Mock()
        mock_create_sys_log_handler.return_value = mock_handler

        initialize_logging_to_syslog({'--no-syslog': True}, '23784')

        self.assertEqual(0, mock_create_sys_log_handler.call_count)
        self.assertEqual(0, mock_logger.addHandler.call_count)
Beispiel #4
0
    def test_should_initialize_sys_log_handler_with_given_revision_when_optin_not_given(
            self, mock_create_sys_log_handler, mock_logger):

        mock_handler = Mock()
        mock_create_sys_log_handler.return_value = mock_handler

        initialize_logging_to_syslog({'--no-syslog': False}, '23784')

        mock_create_sys_log_handler.assert_called_with('23784')
        mock_logger.addHandler.assert_called_with(mock_handler)