blob: 2b4ea9fa8dc8f9a9bd0cc50ee81541babc850061 [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):
Ankush Menatd7148ad2021-12-20 22:00:31 +053012 abbr = "NFECT"
tundebabzya1091412017-05-19 07:12:45 +010013
14 names = [
Ankush Menat494bd9e2022-03-28 18:52:46 +053015 "Warehouse Name",
16 "ERPNext Foundation India",
Akhil Narang3effaf22024-03-27 11:37:26 +053017 f"Gold - Member - {abbr}",
18 f" - {abbr}",
Ankush Menat494bd9e2022-03-28 18:52:46 +053019 "ERPNext - Foundation - India",
Akhil Narang3effaf22024-03-27 11:37:26 +053020 f"ERPNext Foundation India - {abbr}",
21 f"No-Space-{abbr}",
Ankush Menat494bd9e2022-03-28 18:52:46 +053022 "- Warehouse",
tundebabzya1091412017-05-19 07:12:45 +010023 ]
24
25 expected_names = [
Akhil Narang3effaf22024-03-27 11:37:26 +053026 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}",
tundebabzya1091412017-05-19 07:12:45 +010034 ]
35
36 for i in range(len(names)):
Ankush Menatd7148ad2021-12-20 22:00:31 +053037 enc_name = encode_company_abbr(names[i], abbr=abbr)
tundebabzya1091412017-05-19 07:12:45 +010038 self.assertTrue(
39 enc_name == expected_names[i],
Akhil Narang3effaf22024-03-27 11:37:26 +053040 f"{enc_name} is not same as {expected_names[i]}",
tundebabzya1091412017-05-19 07:12:45 +010041 )
Ankush Menat3263ecf2022-05-13 16:38:04 +053042
43 def test_translation_files(self):
44 from frappe.tests.test_translate import verify_translation_files
45
46 verify_translation_files("erpnext")
Ankush Menat6f2086d2022-06-16 22:15:06 +053047
48 def test_patches(self):
49 from frappe.tests.test_patches import check_patch_files
50
51 check_patch_files("erpnext")