Skip to content

Commit 40dfb01

Browse files
second iteration django tests
1 parent 5ee9fb6 commit 40dfb01

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

tests/integrations/django/test_basic.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,19 +2449,18 @@ def test_transaction_http_method_custom(
24492449

24502450
client.get("/nomessage")
24512451
client.options("/nomessage")
2452-
client.head("/nomessage")
24532452

24542453
sentry_sdk.flush()
24552454
spans = [item.payload for item in items]
24562455

2457-
http_methods = [
2458-
span["attributes"][SPANDATA.HTTP_REQUEST_METHOD]
2459-
for span in spans
2460-
if span.get("parent_span_id") is None
2461-
]
2456+
assert spans[2]["attributes"][SPANDATA.HTTP_REQUEST_METHOD] == "OPTIONS"
2457+
2458+
client.head("/nomessage")
2459+
2460+
sentry_sdk.flush()
2461+
spans = [item.payload for item in items]
24622462

2463-
assert "OPTIONS" in http_methods
2464-
assert "HEAD" in http_methods
2463+
assert spans[5]["attributes"][SPANDATA.HTTP_REQUEST_METHOD] == "HEAD"
24652464
else:
24662465
events = capture_events()
24672466

tests/integrations/django/test_cache_module.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ def test_cache_spans_middleware(
246246
if span_streaming:
247247
items = capture_items("span")
248248

249-
client.get(reverse("not_cached_view"))
250249
client.get(reverse("not_cached_view"))
251250

252251
sentry_sdk.flush()
@@ -269,6 +268,11 @@ def test_cache_spans_middleware(
269268
)
270269
assert "cache.hit" not in spans[1]["attributes"]
271270
assert spans[1]["attributes"]["cache.item_size"] == 2
271+
272+
client.get(reverse("not_cached_view"))
273+
274+
sentry_sdk.flush()
275+
spans = [item.payload for item in items]
272276
# second_event - cache.get
273277
assert spans[4]["attributes"]["sentry.op"] == "cache.get"
274278
assert spans[4]["name"].startswith("views.decorators.cache.cache_header.")

0 commit comments

Comments
 (0)