tundebabzy | a109141 | 2017-05-19 07:12:45 +0100 | [diff] [blame] | 1 | import unittest |
| 2 | |
| 3 | import frappe |
tundebabzy | a109141 | 2017-05-19 07:12:45 +0100 | [diff] [blame] | 4 | |
Chillar Anand | 915b343 | 2021-09-02 16:44:59 +0530 | [diff] [blame] | 5 | from erpnext import encode_company_abbr |
| 6 | |
Ankush Menat | 494bd9e | 2022-03-28 18:52:46 +0530 | [diff] [blame] | 7 | test_records = frappe.get_test_records("Company") |
| 8 | |
tundebabzy | a109141 | 2017-05-19 07:12:45 +0100 | [diff] [blame] | 9 | |
tundebabzy | a109141 | 2017-05-19 07:12:45 +0100 | [diff] [blame] | 10 | class TestInit(unittest.TestCase): |
| 11 | def test_encode_company_abbr(self): |
Ankush Menat | d7148ad | 2021-12-20 22:00:31 +0530 | [diff] [blame] | 12 | abbr = "NFECT" |
tundebabzy | a109141 | 2017-05-19 07:12:45 +0100 | [diff] [blame] | 13 | |
| 14 | names = [ |
Ankush Menat | 494bd9e | 2022-03-28 18:52:46 +0530 | [diff] [blame] | 15 | "Warehouse Name", |
| 16 | "ERPNext Foundation India", |
Akhil Narang | 3effaf2 | 2024-03-27 11:37:26 +0530 | [diff] [blame] | 17 | f"Gold - Member - {abbr}", |
| 18 | f" - {abbr}", |
Ankush Menat | 494bd9e | 2022-03-28 18:52:46 +0530 | [diff] [blame] | 19 | "ERPNext - Foundation - India", |
Akhil Narang | 3effaf2 | 2024-03-27 11:37:26 +0530 | [diff] [blame] | 20 | f"ERPNext Foundation India - {abbr}", |
| 21 | f"No-Space-{abbr}", |
Ankush Menat | 494bd9e | 2022-03-28 18:52:46 +0530 | [diff] [blame] | 22 | "- Warehouse", |
tundebabzy | a109141 | 2017-05-19 07:12:45 +0100 | [diff] [blame] | 23 | ] |
| 24 | |
| 25 | expected_names = [ |
Akhil Narang | 3effaf2 | 2024-03-27 11:37:26 +0530 | [diff] [blame] | 26 | f"Warehouse Name - {abbr}", |
| 27 | f"ERPNext Foundation India - {abbr}", |
| 28 | f"Gold - Member - {abbr}", |
| 29 | f" - {abbr}", |
| 30 | f"ERPNext - Foundation - India - {abbr}", |
| 31 | f"ERPNext Foundation India - {abbr}", |
| 32 | f"No-Space-{abbr} - {abbr}", |
| 33 | f"- Warehouse - {abbr}", |
tundebabzy | a109141 | 2017-05-19 07:12:45 +0100 | [diff] [blame] | 34 | ] |
| 35 | |
| 36 | for i in range(len(names)): |
Ankush Menat | d7148ad | 2021-12-20 22:00:31 +0530 | [diff] [blame] | 37 | enc_name = encode_company_abbr(names[i], abbr=abbr) |
tundebabzy | a109141 | 2017-05-19 07:12:45 +0100 | [diff] [blame] | 38 | self.assertTrue( |
| 39 | enc_name == expected_names[i], |
Akhil Narang | 3effaf2 | 2024-03-27 11:37:26 +0530 | [diff] [blame] | 40 | f"{enc_name} is not same as {expected_names[i]}", |
tundebabzy | a109141 | 2017-05-19 07:12:45 +0100 | [diff] [blame] | 41 | ) |
Ankush Menat | 3263ecf | 2022-05-13 16:38:04 +0530 | [diff] [blame] | 42 | |
| 43 | def test_translation_files(self): |
| 44 | from frappe.tests.test_translate import verify_translation_files |
| 45 | |
| 46 | verify_translation_files("erpnext") |
Ankush Menat | 6f2086d | 2022-06-16 22:15:06 +0530 | [diff] [blame] | 47 | |
| 48 | def test_patches(self): |
| 49 | from frappe.tests.test_patches import check_patch_files |
| 50 | |
| 51 | check_patch_files("erpnext") |