"""Sentry module unit tests.""" from unittest.mock import patch from lambdacommon import sentry @patch('sentry_sdk.init') def test_sentry_enabled(mock_sentry_client): """Test sentry.sentry_client is setup when config.SENTRY is set.""" sentry.init('SENTRY', 'test') mock_sentry_client.assert_called() assert mock_sentry_client.call_args[1]['dsn'] == 'SENTRY' @patch('sentry_sdk.init') def test_sentry_disabled(mock_sentry_client): """Test sentry.sentry_client initialized with dsn of None.""" sentry.init(None, 'test') mock_sentry_client.assert_called() assert mock_sentry_client.call_args[1]['dsn'] is None