|
3 | 3 | import pytest |
4 | 4 |
|
5 | 5 | 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 |
10 | 7 |
|
11 | 8 |
|
12 | 9 | def test_kvcb_invalid_mode(): |
@@ -87,15 +84,9 @@ def test_http_headers_both_set(): |
87 | 84 | } |
88 | 85 |
|
89 | 86 |
|
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 |
99 | 90 |
|
100 | 91 |
|
101 | 92 | def _get(dc, path): |
@@ -267,16 +258,16 @@ def _get(dc, path): |
267 | 258 | ), |
268 | 259 | ], |
269 | 260 | ) |
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) |
272 | 263 | for path, value in expected.items(): |
273 | 264 | assert _get(dc, path) == value, f"{path} != {value!r}" |
274 | 265 |
|
275 | 266 |
|
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(): |
277 | 268 | with warnings.catch_warnings(record=True) as caught: |
278 | 269 | warnings.simplefilter("always") |
279 | | - dc = __resolve_data_collection( |
| 270 | + dc = _initialize_client_with_config( |
280 | 271 | send_default_pii=True, data_collection={"user_info": False} |
281 | 272 | ) |
282 | 273 | assert dc["user_info"] is False # data_collection wins |
|
0 commit comments