Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: leave test cases #1758

Merged
merged 4 commits into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions erpnext/hr/doctype/salary_structure/test_salary_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ def make_salary_structure(salary_structure, payroll_frequency, employee=None, do
"doctype": "Salary Structure",
"name": salary_structure,
"company": erpnext.get_default_company(),
"earnings": make_earning_salary_component(test_tax=test_tax),
"deductions": make_deduction_salary_component(test_tax=test_tax),
"earnings": make_earning_salary_component(setup=True, test_tax=test_tax),
"deductions": make_deduction_salary_component(setup=True, test_tax=test_tax),
"payroll_frequency": payroll_frequency,
"payment_account": get_random("Account")
}
Expand Down
4 changes: 3 additions & 1 deletion erpnext/hr/doctype/shift_assignment/test_shift_assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import frappe
import unittest
from erpnext.hr.doctype.shift_type.test_shift_type import create_shift_type
from frappe.utils import nowdate

test_dependencies = ["Shift Type"]
Expand All @@ -15,9 +16,10 @@ def setUp(self):
frappe.db.sql("delete from `tabShift Assignment`")

def test_make_shift_assignment(self):
shift = create_shift_type()
shift_assignment = frappe.get_doc({
"doctype": "Shift Assignment",
"shift_type": "Day Shift",
"shift_type": shift,
"company": "_Test Company",
"employee": "_T-Employee-00001",
"date": nowdate()
Expand Down
4 changes: 3 additions & 1 deletion erpnext/hr/doctype/shift_request/test_shift_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import frappe
import unittest
from erpnext.hr.doctype.shift_type.test_shift_type import create_shift_type
from frappe.utils import nowdate

class TestShiftRequest(unittest.TestCase):
Expand All @@ -13,9 +14,10 @@ def setUp(self):
frappe.db.sql("delete from `tab{doctype}`".format(doctype=doctype))

def test_make_shift_request(self):
shift = create_shift_type()
shift_request = frappe.get_doc({
"doctype": "Shift Request",
"shift_type": "Day Shift",
"shift_type": shift,
"company": "_Test Company",
"employee": "_T-Employee-00001",
"employee_name": "_Test Employee",
Expand Down
27 changes: 17 additions & 10 deletions erpnext/hr/doctype/shift_type/test_shift_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@

class TestShiftType(unittest.TestCase):
def test_make_shift_type(self):
if frappe.db.exists("Shift Type", "Day Shift"):
return
shift_type = frappe.get_doc({
"doctype": "Shift Type",
"name": "Day Shift",
"start_time": "9:00:00",
"end_time": "18:00:00"
})
shift_type.insert()

self.assertEqual(create_shift_type(), "Day Shift")


def create_shift_type():
shift = frappe.db.exists("Shift Type", "Day Shift")
if shift:
return shift

shift_type = frappe.get_doc({
"doctype": "Shift Type",
"name": "Day Shift",
"start_time": "9:00:00",
"end_time": "18:00:00"
})
shift_type.insert()
return shift_type.name