Charles-Henri Decultot | b07f482 | 2018-09-05 07:30:14 +0200 | [diff] [blame] | 1 | from __future__ import unicode_literals |
Chillar Anand | 915b343 | 2021-09-02 16:44:59 +0530 | [diff] [blame] | 2 | |
Charles-Henri Decultot | b07f482 | 2018-09-05 07:30:14 +0200 | [diff] [blame] | 3 | import unittest |
Chillar Anand | 915b343 | 2021-09-02 16:44:59 +0530 | [diff] [blame] | 4 | |
Charles-Henri Decultot | b07f482 | 2018-09-05 07:30:14 +0200 | [diff] [blame] | 5 | import frappe |
| 6 | from frappe.contacts.address_and_contact import filter_dynamic_link_doctypes |
| 7 | |
Chillar Anand | 915b343 | 2021-09-02 16:44:59 +0530 | [diff] [blame] | 8 | |
Charles-Henri Decultot | b07f482 | 2018-09-05 07:30:14 +0200 | [diff] [blame] | 9 | class TestSearch(unittest.TestCase): |
Suraj Shetty | 8e08698 | 2020-05-05 12:06:58 +0530 | [diff] [blame] | 10 | # Search for the word "cond", part of the word "conduire" (Lead) in french. |
Charles-Henri Decultot | b07f482 | 2018-09-05 07:30:14 +0200 | [diff] [blame] | 11 | def test_contact_search_in_foreign_language(self): |
Rushabh Mehta | f8a6dde | 2021-01-08 14:37:38 +0530 | [diff] [blame] | 12 | try: |
| 13 | frappe.local.lang = 'fr' |
| 14 | output = filter_dynamic_link_doctypes("DocType", "cond", "name", 0, 20, { |
| 15 | 'fieldtype': 'HTML', |
| 16 | 'fieldname': 'contact_html' |
| 17 | }) |
| 18 | result = [['found' for x in y if x=="Lead"] for y in output] |
| 19 | self.assertTrue(['found'] in result) |
| 20 | finally: |
| 21 | frappe.local.lang = 'en' |