Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/test_sentry_filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
SBOMValidationError,
)

# Use a bogus DSN to prevent any real Sentry events from being sent during tests
MOCK_SENTRY_DSN = "https://00000000000000000000000000000000@example.com/0000000"


def clear_sentry_state():
"""Helper to completely clear Sentry state between tests."""
Expand All @@ -39,6 +42,16 @@ def clear_sentry_state():


class TestSentryFiltering(unittest.TestCase):
def setUp(self):
"""Set up each test with a bogus Sentry DSN to prevent real events from being sent."""
# Patch the environment to use a fake DSN
self.env_patcher = patch.dict(os.environ, {"SENTRY_DSN": MOCK_SENTRY_DSN})
self.env_patcher.start()

def tearDown(self):
"""Clean up after each test."""
self.env_patcher.stop()

def test_sentry_filters_validation_errors(self):
"""
Test that SBOMValidationError is filtered from Sentry.
Expand Down