2018-09-05 05:30:14 +00:00
|
|
|
import unittest
|
2021-09-02 11:14:59 +00:00
|
|
|
|
2018-09-05 05:30:14 +00:00
|
|
|
import frappe
|
|
|
|
from frappe.contacts.address_and_contact import filter_dynamic_link_doctypes
|
|
|
|
|
2021-09-02 11:14:59 +00:00
|
|
|
|
2018-09-05 05:30:14 +00:00
|
|
|
class TestSearch(unittest.TestCase):
|
2020-05-05 06:36:58 +00:00
|
|
|
# Search for the word "cond", part of the word "conduire" (Lead) in french.
|
2018-09-05 05:30:14 +00:00
|
|
|
def test_contact_search_in_foreign_language(self):
|
2021-01-08 09:07:38 +00:00
|
|
|
try:
|
2022-03-28 13:22:46 +00:00
|
|
|
frappe.local.lang = "fr"
|
|
|
|
output = filter_dynamic_link_doctypes(
|
|
|
|
"DocType", "cond", "name", 0, 20, {"fieldtype": "HTML", "fieldname": "contact_html"}
|
|
|
|
)
|
|
|
|
result = [["found" for x in y if x == "Lead"] for y in output]
|
|
|
|
self.assertTrue(["found"] in result)
|
2021-01-08 09:07:38 +00:00
|
|
|
finally:
|
2022-03-28 13:22:46 +00:00
|
|
|
frappe.local.lang = "en"
|