def test__get_existing_logger_no_logger_present(mock_logger): mock_logger.handlers = [logging.Handler()] with patch( "cloudformation_cli_python_lib.log_delivery.logging.getLogger", return_value=mock_logger, ): actual = ProviderLogHandler._get_existing_logger() assert actual is None
def test__get_existing_logger_logger_present(mock_logger, mock_session): expected = ProviderLogHandler("g", "s", mock_session) mock_logger.handlers = [logging.Handler(), expected] with patch( "cloudformation_cli_python_lib.log_delivery.logging.getLogger", return_value=mock_logger, ): actual = ProviderLogHandler._get_existing_logger() assert actual == expected