fix: flaky salary slip email test (backport #30358) (#30360)

Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
mergify[bot]
2022-03-22 17:55:26 +05:30
committed by GitHub
parent e29757f023
commit 7e6131280f
2 changed files with 10 additions and 4 deletions

View File

@@ -660,6 +660,8 @@ def submit_salary_slips_for_employees(payroll_entry, salary_slips, publish_progr
if not_submitted_ss:
frappe.msgprint(_("Could not submit some Salary Slips"))
frappe.flags.via_payroll_entry = False
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_payroll_entries_for_jv(doctype, txt, searchfield, start, page_len, filters):

View File

@@ -38,6 +38,8 @@ from erpnext.payroll.doctype.salary_structure.salary_structure import make_salar
class TestSalarySlip(unittest.TestCase):
def setUp(self):
setup_test()
frappe.flags.pop("via_payroll_entry", None)
def tearDown(self):
frappe.db.rollback()
@@ -413,15 +415,17 @@ class TestSalarySlip(unittest.TestCase):
"email_salary_slip_to_employee": 1
})
def test_email_salary_slip(self):
frappe.db.sql("delete from `tabEmail Queue`")
frappe.db.delete("Email Queue")
make_employee("test_email_salary_slip@salary.com", company="_Test Company")
ss = make_employee_salary_slip("test_email_salary_slip@salary.com", "Monthly", "Test Salary Slip Email")
user_id = "test_email_salary_slip@salary.com"
make_employee(user_id, company="_Test Company")
ss = make_employee_salary_slip(user_id, "Monthly", "Test Salary Slip Email")
ss.company = "_Test Company"
ss.save()
ss.submit()
email_queue = frappe.db.sql("""select name from `tabEmail Queue`""")
email_queue = frappe.db.a_row_exists("Email Queue")
self.assertTrue(email_queue)
def test_loan_repayment_salary_slip(self):