blob: 18ce93ab8321e49698c35707aa80030c1c2b0d96 [file] [log] [blame]
tundebabzya1091412017-05-19 07:12:45 +01001import unittest
2
3import frappe
tundebabzya1091412017-05-19 07:12:45 +01004
Chillar Anand915b3432021-09-02 16:44:59 +05305from erpnext import encode_company_abbr
6
Ankush Menat494bd9e2022-03-28 18:52:46 +05307test_records = frappe.get_test_records("Company")
8
tundebabzya1091412017-05-19 07:12:45 +01009
tundebabzya1091412017-05-19 07:12:45 +010010class TestInit(unittest.TestCase):
11 def test_encode_company_abbr(self):
tundebabzya1091412017-05-19 07:12:45 +010012
Ankush Menatd7148ad2021-12-20 22:00:31 +053013 abbr = "NFECT"
tundebabzya1091412017-05-19 07:12:45 +010014
15 names = [
Ankush Menat494bd9e2022-03-28 18:52:46 +053016 "Warehouse Name",
17 "ERPNext Foundation India",
18 "Gold - Member - {a}".format(a=abbr),
19 " - {a}".format(a=abbr),
20 "ERPNext - Foundation - India",
tundebabzya1091412017-05-19 07:12:45 +010021 "ERPNext Foundation India - {a}".format(a=abbr),
Ankush Menat494bd9e2022-03-28 18:52:46 +053022 "No-Space-{a}".format(a=abbr),
23 "- Warehouse",
tundebabzya1091412017-05-19 07:12:45 +010024 ]
25
26 expected_names = [
Ankush Menat494bd9e2022-03-28 18:52:46 +053027 "Warehouse Name - {a}".format(a=abbr),
28 "ERPNext Foundation India - {a}".format(a=abbr),
29 "Gold - Member - {a}".format(a=abbr),
30 " - {a}".format(a=abbr),
tundebabzya1091412017-05-19 07:12:45 +010031 "ERPNext - Foundation - India - {a}".format(a=abbr),
Ankush Menat494bd9e2022-03-28 18:52:46 +053032 "ERPNext Foundation India - {a}".format(a=abbr),
33 "No-Space-{a} - {a}".format(a=abbr),
34 "- Warehouse - {a}".format(a=abbr),
tundebabzya1091412017-05-19 07:12:45 +010035 ]
36
37 for i in range(len(names)):
Ankush Menatd7148ad2021-12-20 22:00:31 +053038 enc_name = encode_company_abbr(names[i], abbr=abbr)
tundebabzya1091412017-05-19 07:12:45 +010039 self.assertTrue(
40 enc_name == expected_names[i],
Ankush Menat494bd9e2022-03-28 18:52:46 +053041 "{enc} is not same as {exp}".format(enc=enc_name, exp=expected_names[i]),
tundebabzya1091412017-05-19 07:12:45 +010042 )
Ankush Menat3263ecf2022-05-13 16:38:04 +053043
44 def test_translation_files(self):
45 from frappe.tests.test_translate import verify_translation_files
46
47 verify_translation_files("erpnext")
Ankush Menat6f2086d2022-06-16 22:15:06 +053048
49 def test_patches(self):
50 from frappe.tests.test_patches import check_patch_files
51
52 check_patch_files("erpnext")