Watch
1
0
Fork
You've already forked Seyyed_arc
0
forked from hesabix/arc
Seyyed_arc/hesabixAPI/tests/test_crm_duplicate_service.py
Babak Alizadeh b68a6ab5fa feat: ship CRM enterprise, office automation, and procurement
Add the next office-automation phases, CRM workspace and enterprise flows, and the procurement plugin, with help-center content and admin follow-through.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 23:48:01 +03:30

22 lines
982 B
Python

"""کلید هویت تلفن و تصمیم ادامه با وجود شباهت."""
from app.services.crm_duplicate_service import duplicate_should_block, phone_match_key
def test_phone_key_folds_local_international_and_persian_digits():
assert phone_match_key("09121234567") == "9121234567"
assert phone_match_key("+98 912 123 4567") == "9121234567"
assert phone_match_key("۰۰۹۸۹۱۲۱۲۳۴۵۶۷") == "9121234567"
assert phone_match_key("9121234567") == "9121234567"
def test_short_or_empty_phone_is_not_an_identity():
assert phone_match_key(None) is None
assert phone_match_key(" ") is None
assert phone_match_key("12345") is None
def test_similar_match_blocks_until_explicitly_allowed():
matches = {"leads": [{"id": 1}], "persons": []}
assert duplicate_should_block(matches, False) is True
assert duplicate_should_block(matches, True) is False
assert duplicate_should_block({"leads": [], "persons": []}, False) is False