blob: 3685828667ca668f89aa822b0a284d18724f9fb5 [file] [log] [blame]
Charles-Henri Decultotb07f4822018-09-05 07:30:14 +02001import unittest
Chillar Anand915b3432021-09-02 16:44:59 +05302
Charles-Henri Decultotb07f4822018-09-05 07:30:14 +02003import frappe
4from frappe.contacts.address_and_contact import filter_dynamic_link_doctypes
5
Chillar Anand915b3432021-09-02 16:44:59 +05306
Charles-Henri Decultotb07f4822018-09-05 07:30:14 +02007class TestSearch(unittest.TestCase):
Suraj Shetty8e086982020-05-05 12:06:58 +05308 # Search for the word "cond", part of the word "conduire" (Lead) in french.
Charles-Henri Decultotb07f4822018-09-05 07:30:14 +02009 def test_contact_search_in_foreign_language(self):
Rushabh Mehtaf8a6dde2021-01-08 14:37:38 +053010 try:
Ankush Menata36174a2022-05-23 15:12:11 +053011 frappe.local.lang_full_dict = None # reset cached translations
Ankush Menat494bd9e2022-03-28 18:52:46 +053012 frappe.local.lang = "fr"
13 output = filter_dynamic_link_doctypes(
14 "DocType", "cond", "name", 0, 20, {"fieldtype": "HTML", "fieldname": "contact_html"}
15 )
16 result = [["found" for x in y if x == "Lead"] for y in output]
17 self.assertTrue(["found"] in result)
Rushabh Mehtaf8a6dde2021-01-08 14:37:38 +053018 finally:
Ankush Menat494bd9e2022-03-28 18:52:46 +053019 frappe.local.lang = "en"