Skip to content

Commit 50779f1

Browse files
committed
improve test
1 parent 15c21c0 commit 50779f1

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

tests/test_data_collection.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
import pytest
44

55
import sentry_sdk
6-
from sentry_sdk.data_collection import (
7-
_ALL_HTTP_BODY_TYPES,
8-
_resolve_data_collection,
9-
)
6+
from sentry_sdk.data_collection import _ALL_HTTP_BODY_TYPES
107

118

129
def test_kvcb_invalid_mode():
@@ -87,15 +84,9 @@ def test_http_headers_both_set():
8784
}
8885

8986

90-
def __resolve_data_collection(**options):
91-
base = {
92-
"data_collection": None,
93-
"send_default_pii": None,
94-
"include_local_variables": True,
95-
"include_source_context": True,
96-
}
97-
base.update(options)
98-
return _resolve_data_collection(base)
87+
def _initialize_client_with_config(**options):
88+
sentry_sdk.init(**options)
89+
return sentry_sdk.get_client().data_collection
9990

10091

10192
def _get(dc, path):
@@ -267,16 +258,16 @@ def _get(dc, path):
267258
),
268259
],
269260
)
270-
def test__resolve_data_collection(options, expected):
271-
dc = __resolve_data_collection(**options)
261+
def test_initalize_client_data_collection(options, expected):
262+
dc = _initialize_client_with_config(**options)
272263
for path, value in expected.items():
273264
assert _get(dc, path) == value, f"{path} != {value!r}"
274265

275266

276-
def test__resolve_data_collection_overrides_send_default_pii_and_warns():
267+
def test_initialize_client_data_collection_overrides_send_default_pii_and_warns():
277268
with warnings.catch_warnings(record=True) as caught:
278269
warnings.simplefilter("always")
279-
dc = __resolve_data_collection(
270+
dc = _initialize_client_with_config(
280271
send_default_pii=True, data_collection={"user_info": False}
281272
)
282273
assert dc["user_info"] is False # data_collection wins

0 commit comments

Comments
 (0)