@@ -1504,11 +1504,13 @@ def test_profile_stops_when_segment_ends(
15041504 assert get_profiler_id () is None , "profiler should have stopped"
15051505
15061506
1507- def test_default_attributes (sentry_init , capture_envelopes ):
1507+ @pytest .mark .parametrize ("send_default_pii" , [True , False ])
1508+ def test_default_attributes (sentry_init , capture_envelopes , send_default_pii ):
15081509 sentry_init (
15091510 server_name = "test-server" ,
15101511 release = "1.0.0" ,
15111512 traces_sample_rate = 1.0 ,
1513+ send_default_pii = send_default_pii ,
15121514 _experiments = {"trace_lifecycle" : "stream" },
15131515 )
15141516
@@ -1529,10 +1531,10 @@ def test_default_attributes(sentry_init, capture_envelopes):
15291531 "item_count" : 1 ,
15301532 "content_type" : "application/vnd.sentry.items.span.v2+json" ,
15311533 }
1532- assert item .payload .json ["items" ][0 ]["attributes" ] == {
1534+
1535+ expected_attributes = {
15331536 "thread.id" : {"value" : mock .ANY , "type" : "string" },
15341537 "thread.name" : {"value" : "MainThread" , "type" : "string" },
1535- "process.command_args" : {"value" : mock .ANY , "type" : "array" },
15361538 "sentry.segment.id" : {"value" : mock .ANY , "type" : "string" },
15371539 "sentry.segment.name" : {"value" : "test" , "type" : "string" },
15381540 "sentry.sdk.name" : {"value" : "sentry.python" , "type" : "string" },
@@ -1542,6 +1544,12 @@ def test_default_attributes(sentry_init, capture_envelopes):
15421544 "sentry.release" : {"value" : "1.0.0" , "type" : "string" },
15431545 "sentry.origin" : {"value" : "manual" , "type" : "string" },
15441546 }
1547+ if send_default_pii is True :
1548+ expected_attributes |= {
1549+ "process.command_args" : {"value" : mock .ANY , "type" : "array" }
1550+ }
1551+
1552+ assert item .payload .json ["items" ][0 ]["attributes" ] == expected_attributes
15451553
15461554
15471555def test_transport_format (sentry_init , capture_envelopes ):
0 commit comments