mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-18 17:08:42 +00:00
test: lock current end-date behaviour and assert persisted state
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
# Copyright (c) 2026, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
|
||||
import unittest
|
||||
|
||||
import frappe
|
||||
from frappe.utils import flt
|
||||
|
||||
@@ -61,7 +59,7 @@ class TestBankGuarantee(ERPNextTestSuite):
|
||||
doc = self.make_bg()
|
||||
doc.insert()
|
||||
doc.submit()
|
||||
self.assertEqual(doc.docstatus, 1)
|
||||
self.assertEqual(frappe.db.get_value("Bank Guarantee", doc.name, "docstatus"), 1)
|
||||
|
||||
def test_get_voucher_details_for_receiving(self):
|
||||
so = make_sales_order()
|
||||
@@ -69,10 +67,10 @@ class TestBankGuarantee(ERPNextTestSuite):
|
||||
self.assertEqual(details.customer, so.customer)
|
||||
self.assertEqual(flt(details.grand_total), flt(so.grand_total))
|
||||
|
||||
@unittest.expectedFailure
|
||||
def test_end_date_before_start_date_is_rejected(self):
|
||||
def test_end_date_before_start_date_is_not_validated(self):
|
||||
# SUSPECTED BUG: validate() never checks that end_date >= start_date, so a
|
||||
# guarantee that expires before it starts submits cleanly. This asserts the
|
||||
# behaviour we'd expect; remove the xfail once validate() enforces it.
|
||||
# guarantee that expires before it starts saves cleanly. Locking the current
|
||||
# (wrong) behaviour so a future fix that adds the check trips this test.
|
||||
doc = self.make_bg(start_date="2026-06-30", end_date="2026-06-01")
|
||||
self.assertRaises(frappe.ValidationError, doc.insert)
|
||||
doc.insert()
|
||||
self.assertTrue(frappe.db.exists("Bank Guarantee", doc.name))
|
||||
|
||||
Reference in New Issue
Block a user