"""Tests for the Sentry Connector.""" from unittest.mock import patch from deliveryhistory.connectors import sentry @patch('sentry_sdk.init') def test_sentry_init_sentry_enabled(init_sentry_mock): """Test sentry.sentry_client is setup when config.SENTRY is set.""" sentry.init_sentry('SENTRY') init_sentry_mock.assert_called() @patch('sentry_sdk.init') def test_sentry_init_sentry_disabled(init_sentry_mock): """Test sentry.sentry_client is setup when config.SENTRY is NOT set.""" sentry.init_sentry('') init_sentry_mock.assert_not_called()