"""Tests for Sentry connector.""" from unittest import mock from unittest.mock import MagicMock import pytest import common_config from connectors import sentry from constants import errors def test_capture_exception(): """Test capture_exception logs failed attempts.""" error_message = 'Network failure' mock.patch.object( sentry.sentry_client, 'captureException', side_effect=Exception(error_message)) mock.patch.object( sentry.common_config, 'logger', MagicMock() ) with pytest.raises(Exception): sentry.capture_exception() assert common_config.logger.exception.calledWith( errors.SENTRY_CAPTURE_ERROR)