def test_should_print_exception(self, mock_logging_error, mock_traceback):
        message = "test message"
        exception = HPOneViewException(message)
        traceback_ex = None
        handle_exceptions(exception.__class__, exception, traceback_ex, mock_logging_error)

        mock_traceback.assert_called_once_with(exception.__class__, exception, traceback_ex)
    def test_should_log_python_exception(self, mock_logging_error, mock_traceback):
        message = "test message"
        exception = Exception(message)
        traceback_ex = None
        handle_exceptions(exception.__class__, exception, traceback_ex, mock_logging_error)

        log_message = "Uncaught Exception: Exception with message: test message"
        mock_logging_error.error.assert_called_once_with(log_message)
    def test_should_log_oneview_reponse(self, mock_logging_error, mock_traceback):
        message = {"msg": "test message"}
        exception = HPOneViewException(message)
        traceback_ex = None
        handle_exceptions(exception.__class__, exception, traceback_ex, mock_logging_error)

        log_message = "Uncaught Exception: HPOneViewException with message: \n{'msg': 'test message'}"
        mock_logging_error.error.assert_called_once_with(log_message)
示例#4
0
    def test_should_print_exception(self, mock_logging_error, mock_traceback):
        message = "test message"
        exception = HPOneViewException(message)
        traceback_ex = None
        handle_exceptions(exception.__class__, exception, traceback_ex,
                          mock_logging_error)

        mock_traceback.assert_called_once_with(exception.__class__, exception,
                                               traceback_ex)
示例#5
0
    def test_should_log_message(self, mock_logging_error, mock_traceback):
        message = "test message"
        exception = HPOneViewException(message)
        traceback_ex = None
        handle_exceptions(exception.__class__, exception, traceback_ex,
                          mock_logging_error)

        log_message = "Uncaught Exception: HPOneViewException with message: test message"
        mock_logging_error.error.assert_called_once_with(log_message)
示例#6
0
    def test_should_log_oneview_reponse(self, mock_logging_error,
                                        mock_traceback):
        message = {"msg": "test message"}
        exception = HPOneViewException(message)
        traceback_ex = None
        handle_exceptions(exception.__class__, exception, traceback_ex,
                          mock_logging_error)

        log_message = "Uncaught Exception: HPOneViewException with message: \n{'msg': 'test message'}"
        mock_logging_error.error.assert_called_once_with(log_message)