refactor(test): test cases modified to handle new approach

This commit is contained in:
ruthra kumar
2024-03-20 15:16:33 +05:30
parent a158b825d7
commit 81309576b0
2 changed files with 5 additions and 0 deletions

View File

@@ -181,8 +181,10 @@ def get_random_date(start_date, start_range, end_range):
def create_transaction_deletion_record(company):
transaction_deletion_record = frappe.new_doc("Transaction Deletion Record")
transaction_deletion_record.company = company
transaction_deletion_record.process_in_single_transaction = True
transaction_deletion_record.save(ignore_permissions=True)
transaction_deletion_record.submit()
transaction_deletion_record.start_deletion_tasks()
def clear_masters():

View File

@@ -29,6 +29,7 @@ class TestTransactionDeletionRecord(FrappeTestCase):
for i in range(5):
create_task("Dunder Mifflin Paper Co")
tdr = create_transaction_deletion_doc("Dunder Mifflin Paper Co")
tdr.reload()
for doctype in tdr.doctypes:
if doctype.doctype_name == "Task":
self.assertEqual(doctype.no_of_docs, 5)
@@ -60,7 +61,9 @@ def create_company(company_name):
def create_transaction_deletion_doc(company):
tdr = frappe.get_doc({"doctype": "Transaction Deletion Record", "company": company})
tdr.insert()
tdr.process_in_single_transaction = True
tdr.submit()
tdr.start_deletion_tasks()
return tdr