mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 19:19:17 +00:00
refactor(test): Activity Cost to use ERPNextTestSuite
This commit is contained in:
@@ -6,37 +6,16 @@ import frappe
|
|||||||
from frappe.tests import IntegrationTestCase
|
from frappe.tests import IntegrationTestCase
|
||||||
|
|
||||||
from erpnext.projects.doctype.activity_cost.activity_cost import DuplicationError
|
from erpnext.projects.doctype.activity_cost.activity_cost import DuplicationError
|
||||||
|
from erpnext.tests.utils import ERPNextTestSuite
|
||||||
|
|
||||||
|
|
||||||
class TestActivityCost(IntegrationTestCase):
|
class TestActivityCost(ERPNextTestSuite):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super().setUpClass()
|
super().setUpClass()
|
||||||
|
# TODO: only 1 employee is required
|
||||||
cls.make_employees()
|
cls.make_employees()
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def make_employees(cls):
|
|
||||||
records = [
|
|
||||||
{
|
|
||||||
"company": "_Test Company",
|
|
||||||
"date_of_birth": "1980-01-01",
|
|
||||||
"date_of_joining": "2010-01-01",
|
|
||||||
"department": "_Test Department - _TC",
|
|
||||||
"doctype": "Employee",
|
|
||||||
"first_name": "_Test Employee",
|
|
||||||
"gender": "Female",
|
|
||||||
"naming_series": "_T-Employee-",
|
|
||||||
"status": "Active",
|
|
||||||
"user_id": "test@example.com",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
cls.employees = []
|
|
||||||
for x in records:
|
|
||||||
if not frappe.db.exists("Employee", {"first_name": x.get("first_name")}):
|
|
||||||
cls.employees.append(frappe.get_doc(x).insert())
|
|
||||||
else:
|
|
||||||
cls.employees.append(frappe.get_doc("Employee", {"first_name": x.get("first_name")}))
|
|
||||||
|
|
||||||
def test_duplication(self):
|
def test_duplication(self):
|
||||||
frappe.db.sql("delete from `tabActivity Cost`")
|
frappe.db.sql("delete from `tabActivity Cost`")
|
||||||
activity_cost1 = frappe.new_doc("Activity Cost")
|
activity_cost1 = frappe.new_doc("Activity Cost")
|
||||||
|
|||||||
Reference in New Issue
Block a user