test: remove sla if no active sla found
This commit is contained in:
parent
b31679b6ef
commit
cc88b31f1f
@ -385,7 +385,7 @@ def apply(doc, method=None):
|
||||
sla = get_active_service_level_agreement_for(doc)
|
||||
|
||||
if not sla:
|
||||
remove_sla_if_applied()
|
||||
remove_sla_if_applied(doc)
|
||||
return
|
||||
|
||||
process_sla(doc, sla)
|
||||
|
@ -244,6 +244,13 @@ class TestServiceLevelAgreement(unittest.TestCase):
|
||||
applied_sla = frappe.db.get_value('Lead', lead.name, 'service_level_agreement')
|
||||
self.assertEqual(applied_sla, lead_sla.name)
|
||||
|
||||
# check if SLA is removed if condition fails
|
||||
lead.reload()
|
||||
lead.source = None
|
||||
lead.save()
|
||||
applied_sla = frappe.db.get_value('Lead', lead.name, 'service_level_agreement')
|
||||
self.assertFalse(applied_sla)
|
||||
|
||||
def tearDown(self):
|
||||
for d in frappe.get_all("Service Level Agreement"):
|
||||
frappe.delete_doc("Service Level Agreement", d.name, force=1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user