Issue 8842 (#8869)
* adds test that confirms #8842
* fixes #8842 and adds tests
* fixes new test case
* adds test for `encode_company_abbr`
* adds six as a requirement
* fixes six.moves.range import
* fixes duplicate company used in test
* fresh commit of test
* fixes failing test - company not saving
* fixes failing test
* Revert "adds six as a requirement"
This reverts commit 80454d98dc.
* replaces whitespace indentation with tabs
This commit is contained in:
committed by
Rushabh Mehta
parent
064530d11f
commit
a109141624
40
erpnext/tests/test_init.py
Normal file
40
erpnext/tests/test_init.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import unittest
|
||||
|
||||
import frappe
|
||||
from erpnext import encode_company_abbr
|
||||
from six.moves import range
|
||||
|
||||
test_records = frappe.get_test_records('Company')
|
||||
|
||||
|
||||
class TestInit(unittest.TestCase):
|
||||
def test_encode_company_abbr(self):
|
||||
company = frappe.new_doc("Company")
|
||||
company.company_name = "New from Existing Company For Test"
|
||||
company.abbr = "NFECT"
|
||||
company.default_currency = "INR"
|
||||
company.save()
|
||||
|
||||
abbr = company.abbr
|
||||
|
||||
names = [
|
||||
"Warehouse Name", "ERPNext Foundation India", "Gold - Member - {a}".format(a=abbr),
|
||||
" - {a}".format(a=abbr), "ERPNext - Foundation - India",
|
||||
"ERPNext Foundation India - {a}".format(a=abbr),
|
||||
"No-Space-{a}".format(a=abbr), "- Warehouse"
|
||||
]
|
||||
|
||||
expected_names = [
|
||||
"Warehouse Name - {a}".format(a=abbr), "ERPNext Foundation India - {a}".format(a=abbr),
|
||||
"Gold - Member - {a}".format(a=abbr), " - {a}".format(a=abbr),
|
||||
"ERPNext - Foundation - India - {a}".format(a=abbr),
|
||||
"ERPNext Foundation India - {a}".format(a=abbr), "No-Space-{a} - {a}".format(a=abbr),
|
||||
"- Warehouse - {a}".format(a=abbr)
|
||||
]
|
||||
|
||||
for i in range(len(names)):
|
||||
enc_name = encode_company_abbr(names[i], company.name)
|
||||
self.assertTrue(
|
||||
enc_name == expected_names[i],
|
||||
"{enc} is not same as {exp}".format(enc=enc_name, exp=expected_names[i])
|
||||
)
|
||||
Reference in New Issue
Block a user