test_wechat_mini_auth_phone.py 738 B

1234567891011121314151617181920212223242526
  1. from app.services.wechat_mini_auth import normalize_cn_mobile, phones_match
  2. def test_normalize_strips_plus86():
  3. assert normalize_cn_mobile("+8613800138000") == "13800138000"
  4. def test_normalize_strips_86_prefix_13_digits():
  5. assert normalize_cn_mobile("8613800138000") == "13800138000"
  6. def test_phones_match_equal():
  7. assert phones_match("13800138000", "13800138000") is True
  8. def test_phones_match_normalizes():
  9. assert phones_match("13800138000", "+8613800138000") is True
  10. def test_phones_match_mismatch():
  11. assert phones_match("13800138000", "13900139000") is False
  12. def test_phones_match_empty_fails():
  13. assert phones_match("", "13800138000") is False
  14. assert phones_match(None, "13800138000") is False