Skip to content

Commit

Permalink
Fixing Django tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpirker committed Nov 20, 2024
1 parent 5d3a044 commit 6c276ad
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tests/integrations/django/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ def test_has_trace_if_performance_enabled(sentry_init, client, capture_events):
traces_sample_rate=1.0,
)
events = capture_events()
client.head(reverse("view_exc_with_msg"))
response = client.head(reverse("view_exc_with_msg"))
response.close()

(msg_event, error_event, transaction_event) = events

Expand Down Expand Up @@ -213,9 +214,10 @@ def test_trace_from_headers_if_performance_enabled(sentry_init, client, capture_
trace_id = "582b43a4192642f0b136d5159a501701"
sentry_trace_header = "{}-{}-{}".format(trace_id, "6e8f22c393e68f19", 1)

client.head(
response = client.head(
reverse("view_exc_with_msg"), headers={"sentry-trace": sentry_trace_header}
)
response.close()

(msg_event, error_event, transaction_event) = events

Expand Down Expand Up @@ -1186,7 +1188,8 @@ def test_span_origin(sentry_init, client, capture_events):
)
events = capture_events()

client.get(reverse("view_with_signal"))
response = client.get(reverse("view_with_signal"))
response.close()

(transaction,) = events

Expand All @@ -1211,9 +1214,9 @@ def test_transaction_http_method_default(sentry_init, client, capture_events):
)
events = capture_events()

client.get("/nomessage")
client.options("/nomessage")
client.head("/nomessage")
client.get("/nomessage").close()
client.options("/nomessage").close()
client.head("/nomessage").close()

(event,) = events

Expand All @@ -1235,9 +1238,9 @@ def test_transaction_http_method_custom(sentry_init, client, capture_events):
)
events = capture_events()

client.get("/nomessage")
client.options("/nomessage")
client.head("/nomessage")
client.get("/nomessage").close()
client.options("/nomessage").close()
client.head("/nomessage").close()

assert len(events) == 2

Expand Down

0 comments on commit 6c276ad

Please sign in to comment.