Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Left domain unchanged in obfuscate email func
IKarbowiaka60c71e5df08
diff --git a/saleor/core/anonymize.py b/saleor/core/anonymize.pyindex b2cb547941..bf098c26f6 100644--- a/saleor/core/anonymize.py+++ b/saleor/core/anonymize.py@@ -1,11 +1,9 @@def obfuscate_email(value):string_rep = str(value)- if string_rep.endswith("@example.com"):- return string_repif "@" not in str(string_rep):return obfuscate_string(string_rep)- username = str(string_rep).split("@")[0]- return "%[email protected]" % str(username)[:1]+ local_part, domain = str(string_rep).split("@")+ return "{}...@{}".format(local_part[:1], domain)def obfuscate_string(value, phone=False):diff --git a/saleor/core/tests/test_anonymize.py b/saleor/core/tests/test_anonymize.pyindex 9a5acc8456..d413a20513 100644--- a/saleor/core/tests/test_anonymize.py+++ b/saleor/core/tests/test_anonymize.py@@ -9,7 +9,7 @@ def test_obfuscate_email():result = obfuscate_email(email)# then- assert result == "[email protected]"+ assert result == "[email protected]"def test_obfuscate_email_example_email():@@ -20,7 +20,7 @@ def test_obfuscate_email_example_email():result = obfuscate_email(email)# then- assert result == "[email protected]"+ assert result == "[email protected]"def test_obfuscate_email_no_at_in_email():