@@ -104,7 +104,7 @@ def reusable_client(app):
104104
105105
106106def test_request_data (sentry_init , app , capture_events ):
107- sentry_init (integrations = [SanicIntegration ()])
107+ sentry_init (integrations = [SanicIntegration ()], data_collection = {} )
108108 events = capture_events ()
109109
110110 c = get_client (app )
@@ -368,7 +368,6 @@ def __init__(
368368 self .expected_source = expected_source
369369
370370
371- @pytest .mark .parametrize ("send_pii" , [True , False ])
372371@pytest .mark .parametrize (
373372 "test_config" ,
374373 [
@@ -407,13 +406,12 @@ def test_transactions(
407406 sentry_init : "Any" ,
408407 app : "Any" ,
409408 capture_items : "Any" ,
410- send_pii : bool ,
411409) -> None :
412410 # Init the SanicIntegration with the desired arguments
413411 sentry_init (
414412 integrations = [SanicIntegration ()],
415413 traces_sample_rate = 1.0 ,
416- send_default_pii = send_pii ,
414+ data_collection = {} ,
417415 )
418416
419417 items = capture_items ("span" )
@@ -458,16 +456,10 @@ def test_transactions(
458456 "error" if test_config .expected_status >= 400 else "ok"
459457 )
460458
461- if send_pii :
462- assert attrs ["url.full" ].endswith (test_config .url )
463- assert attrs ["url.path" ] == test_config .url .split ("?" )[0 ]
464- if "?" in test_config .url :
465- assert attrs ["http.query" ] == test_config .url .split ("?" , 1 )[1 ]
466-
467- else :
468- assert "url.full" not in attrs
469- assert "url.path" not in attrs
470- assert "http.query" not in attrs
459+ assert attrs ["url.full" ].endswith (test_config .url )
460+ assert attrs ["url.path" ] == test_config .url .split ("?" )[0 ]
461+ if "?" in test_config .url :
462+ assert attrs ["http.query" ] == test_config .url .split ("?" , 1 )[1 ]
471463
472464
473465def test_span_origin (sentry_init , app , capture_items ):
@@ -569,21 +561,6 @@ def test_client_address_span_attribute_data_collection(
569561
570562
571563_QUERY_PARAM_DATA_COLLECTION_CASES = [
572- pytest .param (
573- {"send_default_pii" : True },
574- "toy=tennisball&color=red&auth=secret" ,
575- id = "send_default_pii_true" ,
576- ),
577- pytest .param (
578- {"send_default_pii" : False },
579- None ,
580- id = "send_default_pii_false" ,
581- ),
582- pytest .param (
583- {},
584- None ,
585- id = "defaults" ,
586- ),
587564 pytest .param (
588565 {"data_collection" : {}},
589566 "toy=tennisball&color=red&auth=%5BFiltered%5D" ,
@@ -621,14 +598,6 @@ def test_client_address_span_attribute_data_collection(
621598 None ,
622599 id = "data_collection_off" ,
623600 ),
624- pytest .param (
625- {
626- "send_default_pii" : True ,
627- "data_collection" : {"url_query_params" : {"mode" : "off" }},
628- },
629- None ,
630- id = "data_collection_wins_over_send_default_pii" ,
631- ),
632601]
633602
634603
@@ -660,19 +629,10 @@ def test_url_query_data_collection(
660629 and i .payload ["is_segment" ]
661630 ]
662631
663- data_collection_enabled = "data_collection" in init_kwargs
664- url_attrs_expected = data_collection_enabled or init_kwargs .get (
665- "send_default_pii" , False
666- )
667-
668632 if expected_query is None :
669633 assert "http.query" not in server_span ["attributes" ]
670- if url_attrs_expected :
671- assert server_span ["attributes" ]["url.full" ].endswith ("/message" )
672- assert server_span ["attributes" ]["url.path" ].endswith ("/message" )
673- else :
674- assert "url.full" not in server_span ["attributes" ]
675- assert "url.path" not in server_span ["attributes" ]
634+ assert server_span ["attributes" ]["url.full" ].endswith ("/message" )
635+ assert server_span ["attributes" ]["url.path" ].endswith ("/message" )
676636 else :
677637 assert server_span ["attributes" ]["http.query" ] == expected_query
678638 assert server_span ["attributes" ]["url.full" ].endswith (
@@ -700,11 +660,7 @@ def test_url_query_data_collection_event_processor(
700660
701661 assert event ["request" ]["url" ].endswith ("/message" )
702662 assert event ["request" ]["method" ] == "GET"
703- if "data_collection" not in init_kwargs :
704- assert (
705- event ["request" ]["query_string" ] == "toy=tennisball&color=red&auth=secret"
706- )
707- elif expected_query is None :
663+ if expected_query is None :
708664 assert "query_string" not in event ["request" ]
709665 else :
710666 assert event ["request" ]["query_string" ] == expected_query
0 commit comments