Skip to content

Commit 7c4683f

Browse files
committed
fix: Add test for regression in handling SQL queries
1 parent 99e60c4 commit 7c4683f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/integrations/django/test_basic.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,12 @@ def test_management_command_raises():
164164

165165

166166
@pytest.mark.django_db
167-
def test_sql_queries(sentry_init, capture_events):
168-
sentry_init(integrations=[DjangoIntegration()], send_default_pii=True)
167+
@pytest.mark.parametrize("with_integration", [True, False])
168+
def test_sql_queries(sentry_init, capture_events, with_integration):
169+
sentry_init(
170+
integrations=[DjangoIntegration()] if with_integration else [],
171+
send_default_pii=True,
172+
)
169173
from django.db import connection
170174

171175
sql = connection.cursor()
@@ -179,9 +183,12 @@ def test_sql_queries(sentry_init, capture_events):
179183

180184
event, = events
181185

182-
crumb = event["breadcrumbs"][-1]
186+
if with_integration:
187+
crumb = event["breadcrumbs"][-1]
183188

184-
assert crumb["message"] == """SELECT count(*) FROM people_person WHERE foo = 123"""
189+
assert (
190+
crumb["message"] == """SELECT count(*) FROM people_person WHERE foo = 123"""
191+
)
185192

186193

187194
@pytest.mark.django_db

0 commit comments

Comments
 (0)