Skip to content

Commit

Permalink
chore: fixed test cases (#37792)
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitwaghchaure authored Oct 31, 2023
1 parent fb0ec74 commit 77af247
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,24 @@ def test_create_asset_maintenance_with_log(self):
next_due_date = calculate_next_due_date(nowdate(), "Monthly")
self.assertEqual(asset_maintenance.asset_maintenance_tasks[0].next_due_date, next_due_date)

asset_maintenance_log = frappe.get_doc(
asset_maintenance_log = frappe.db.get_value(
"Asset Maintenance Log",
{"asset_maintenance": asset_maintenance.name, "task_name": "Change Oil"},
"name",
)

asset_maintenance_log_doc = frappe.get_doc("Asset Maintenance Log", asset_maintenance_log)
asset_maintenance_log_doc.update(
{
"doctype": "Asset Maintenance Log",
"asset_maintenance": self.asset_name,
"task": "Change Oil",
"completion_date": add_days(nowdate(), 2),
"maintenance_status": "Completed",
}
).insert()
next_due_date = calculate_next_due_date(asset_maintenance_log.completion_date, "Monthly")
)

asset_maintenance_log_doc.save()
next_due_date = calculate_next_due_date(asset_maintenance_log_doc.completion_date, "Monthly")

asset_maintenance.reload()
self.assertEqual(asset_maintenance.asset_maintenance_tasks[0].next_due_date, next_due_date)


Expand Down

0 comments on commit 77af247

Please sign in to comment.