Skip to content

Commit 5680231

Browse files
committed
Add tests for django
1 parent 16392bd commit 5680231

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/integrations/django/test_basic.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from sentry_sdk._compat import PY2, PY310
2020
from sentry_sdk import capture_message, capture_exception, configure_scope
21+
from sentry_sdk.consts import SPANDATA
2122
from sentry_sdk.integrations.django import DjangoIntegration
2223
from sentry_sdk.integrations.django.signals_handlers import _get_receiver_name
2324
from sentry_sdk.integrations.executing import ExecutingIntegration
@@ -442,12 +443,15 @@ def test_django_connect_trace(sentry_init, client, capture_events, render_span_t
442443
# trigger Django to open a new connection by marking the existing one as None.
443444
connections["postgres"].connection = None
444445

445-
events = capture_events()
446+
(event,) = capture_events()
446447

447448
content, status, headers = client.get(reverse("postgres_select"))
448449
assert status == "200 OK"
449450

450-
assert '- op="db": description="connect"' in render_span_tree(events[0])
451+
for span in event["spans"]:
452+
assert span["data"][SPANDATA.DB_SYSTEM] == "postgres"
453+
454+
assert '- op="db": description="connect"' in render_span_tree(event)
451455

452456

453457
@pytest.mark.forked

0 commit comments

Comments
 (0)