-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathtest_obfuscate.py
More file actions
59 lines (50 loc) · 1.55 KB
/
test_obfuscate.py
File metadata and controls
59 lines (50 loc) · 1.55 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
"""Tests for the obfuscation utilities used in fixtures and logging."""
import pytest
from pyoverkiz.obfuscate import obfuscate_email, obfuscate_sensitive_data
LOCAL_HOST = "gateway-1234-5678-1243.local:8443"
LOCAL_HOST_BY_IP = "192.168.1.105:8443"
class TestObfucscate:
"""Tests for obfuscation utilities (emails and sensitive data)."""
@pytest.mark.parametrize(
"email, obfuscated",
[
("contact@somfy.com", "c****@****y.com"),
("contact_-_nexity.com", "c****@****y.com"),
],
)
def test_email_obfuscate(self, email: str, obfuscated: str):
"""Verify email obfuscation produces the expected masked result."""
assert obfuscate_email(email) == obfuscated
class TestObfucscateSensitive:
"""Tests around obfuscating sensitive structures while preserving non-sensitive content."""
def test_obfuscate_list_with_none(self):
"""Ensure lists containing None values are handled without modification."""
input = {
"d": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
None,
None,
None,
None,
None,
None,
None,
]
}
assert obfuscate_sensitive_data(input) == input