Skip to content

Commit 83680ad

Browse files
committed
better tests
1 parent e7efa19 commit 83680ad

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

tests/integrations/django/myapp/views.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,16 @@ def template_test4(request, *args, **kwargs):
214214
return TemplateResponse(
215215
request,
216216
"user_name.html",
217-
{"user_age": 25, "complex_context": lambda x: time.sleep(10)},
217+
{
218+
"user_age": 25,
219+
"complex_context": lambda x: time.sleep(10),
220+
"complex_list": [1, 2, 3, lambda x: time.sleep(10)],
221+
"complex_dict": {
222+
"a": 1,
223+
"d": lambda x: time.sleep(10),
224+
},
225+
"none_context": None,
226+
},
218227
)
219228

220229

tests/integrations/django/test_basic.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,14 @@ def test_render_spans_complex_context(sentry_init, client, capture_events):
981981
# so we expect the total time to be way less, because the complex context is not evaluated
982982
assert end - begin < 10 / 5
983983

984+
# Make sure complex items are not put into the span.data
984985
assert transaction["spans"][-1]["data"]["context"] == {
985986
"user_age": 25,
986-
# The "complex_context" is not included because it is not a primitive type
987+
"complex_dict": {
988+
"a": 1,
989+
},
990+
"complex_list": [1, 2, 3],
991+
"none_context": None,
987992
}
988993

989994

0 commit comments

Comments
 (0)