Repository navigation
Expand file tree
/
Copy pathutils.py
More file actions
90 lines (87 loc) · 2.85 KB
/
Copy pathutils.py
File metadata and controls
90 lines (87 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import pytest
from sentry_sdk.utils import SENSITIVE_DATA_SUBSTITUTE
# Shared parametrization test matrix exercising the precedence between the legacy
# ``send_default_pii`` boolean and the ``data_collection.user_info`` setting.
# Each case is ``(init_kwargs, expect_user_info)`` where the second element indicates
# whether user info (IP address, user identity, etc.) is expected to be collected.
DATA_COLLECTION_USER_INFO_CASES = [
pytest.param({"send_default_pii": True}, True, id="legacy_send_default_pii_true"),
pytest.param(
{"send_default_pii": False}, False, id="legacy_send_default_pii_false"
),
pytest.param(
{"_experiments": {"data_collection": {"user_info": True}}},
True,
id="data_collection_user_info_true",
),
pytest.param(
{"_experiments": {"data_collection": {"user_info": False}}},
False,
id="data_collection_user_info_false",
),
pytest.param(
{
"send_default_pii": True,
"_experiments": {"data_collection": {"user_info": False}},
},
False,
id="data_collection_wins_over_send_default_pii_true",
),
pytest.param(
{
"send_default_pii": False,
"_experiments": {"data_collection": {"user_info": True}},
},
True,
id="data_collection_wins_over_send_default_pii_false",
),
]
# Shared parametrization test matrix exercising the interaction between the
# ``data_collection.queues`` experiment and the legacy ``send_default_pii`` boolean
# for job/task args and kwargs collected by queue integrations (rq, arq, huey).
# Each case is ``(init_kwargs, expected_args, expected_kwargs)`` where ``None`` for
# the expected values means args/kwargs are not collected at all.
DATA_COLLECTION_QUEUES_CASES = [
pytest.param(
{"_experiments": {"data_collection": {}}},
[1],
{"b": 0},
id="data_collection_default",
),
pytest.param(
{"_experiments": {"data_collection": {"queues": True}}},
[1],
{"b": 0},
id="data_collection_queues_on",
),
pytest.param(
{"_experiments": {"data_collection": {"queues": False}}},
None,
None,
id="data_collection_queues_off",
),
pytest.param(
{"send_default_pii": False},
SENSITIVE_DATA_SUBSTITUTE,
SENSITIVE_DATA_SUBSTITUTE,
id="no_pii",
),
pytest.param(
{
"_experiments": {"data_collection": {"queues": False}},
"send_default_pii": False,
},
None,
None,
id="data_collection_queues_off_with_no_pii",
),
pytest.param(
{
"_experiments": {"data_collection": {"queues": True}},
"send_default_pii": False,
},
[1],
{"b": 0},
id="data_collection_queues_on_with_no_pii",
),
]