@@ -753,28 +753,32 @@ def _http_scope():
753753
754754@pytest .mark .asyncio
755755@pytest .mark .parametrize (
756- "init_kwargs, expected_query, expected_url_full" ,
756+ "init_kwargs, request_url, expected_query, expected_url_full" ,
757757 [
758758 pytest .param (
759759 {"send_default_pii" : True },
760+ "/foo?" + QUERY_STRING ,
760761 QUERY_STRING ,
761762 "http://example.com/foo?" + QUERY_STRING ,
762763 id = "send_default_pii_true" ,
763764 ),
764765 pytest .param (
765766 {"send_default_pii" : False },
767+ "/foo?" + QUERY_STRING ,
766768 None ,
767769 None ,
768770 id = "send_default_pii_false" ,
769771 ),
770772 pytest .param (
771773 {},
774+ "/foo?" + QUERY_STRING ,
772775 None ,
773776 None ,
774777 id = "defaults" ,
775778 ),
776779 pytest .param (
777780 {"_experiments" : {"data_collection" : {}}},
781+ "/foo?" + QUERY_STRING ,
778782 "token=%5BFiltered%5D&theme=dark&lang=en&session=%5BFiltered%5D" ,
779783 "http://example.com/foo?token=%5BFiltered%5D&theme=dark&lang=en&session=%5BFiltered%5D" ,
780784 id = "data_collection_denylist_default" ,
@@ -787,6 +791,7 @@ def _http_scope():
787791 }
788792 }
789793 },
794+ "/foo?" + QUERY_STRING ,
790795 "token=%5BFiltered%5D&theme=dark&lang=%5BFiltered%5D&session=%5BFiltered%5D" ,
791796 "http://example.com/foo?token=%5BFiltered%5D&theme=dark&lang=%5BFiltered%5D&session=%5BFiltered%5D" ,
792797 id = "data_collection_allowlist" ,
@@ -797,6 +802,7 @@ def _http_scope():
797802 "data_collection" : {"url_query_params" : {"mode" : "off" }}
798803 }
799804 },
805+ "/foo?" + QUERY_STRING ,
800806 None ,
801807 "http://example.com/foo" ,
802808 id = "data_collection_off" ,
@@ -808,17 +814,26 @@ def _http_scope():
808814 "data_collection" : {"url_query_params" : {"mode" : "off" }}
809815 },
810816 },
817+ "/foo?" + QUERY_STRING ,
811818 None ,
812819 "http://example.com/foo" ,
813820 id = "data_collection_wins_over_send_default_pii" ,
814821 ),
822+ pytest .param (
823+ {"_experiments" : {"data_collection" : {}}},
824+ "/foo" ,
825+ None ,
826+ "http://example.com/foo" ,
827+ id = "empty_query_string" ,
828+ ),
815829 ],
816830)
817831async def test_get_request_attributes_query_data_collection (
818832 sentry_init ,
819833 capture_items ,
820834 asgi3_app ,
821835 init_kwargs ,
836+ request_url ,
822837 expected_query ,
823838 expected_url_full ,
824839):
@@ -831,7 +846,7 @@ async def test_get_request_attributes_query_data_collection(
831846
832847 items = capture_items ("span" )
833848 async with TestClient (app , scope = _http_scope ()) as client :
834- await client .get (f"/foo? { QUERY_STRING } " , headers = {"host" : "example.com" })
849+ await client .get (request_url , headers = {"host" : "example.com" })
835850
836851 sentry_sdk .flush ()
837852
0 commit comments