Skip to content

Commit

Permalink
test: added test for change in applicable_for_value in promotional sc…
Browse files Browse the repository at this point in the history
…heme
  • Loading branch information
ljain112 committed Oct 8, 2024
1 parent 42746fc commit 2613bdd
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,31 @@ def test_change_applicable_for_in_promotional_scheme(self):
price_rules = frappe.get_all("Pricing Rule", filters={"promotional_scheme": ps.name})
self.assertEqual(price_rules, [])

def test_change_applicable_for_values_in_promotional_scheme(self):
ps = make_promotional_scheme(applicable_for="Customer", customer="_Test Customer")
ps.append("customer", {"customer": "_Test Customer 2"})
ps.save()

price_rules = frappe.get_all(
"Pricing Rule", filters={"promotional_scheme": ps.name, "applicable_for": "Customer"}
)
self.assertTrue(len(price_rules), 2)

ps.set("customer", [])
ps.append("customer", {"customer": "_Test Customer 2"})
ps.save()

price_rules = frappe.get_all(
"Pricing Rule",
filters={
"promotional_scheme": ps.name,
"applicable_for": "Customer",
"customer": "_Test Customer",
},
)
self.assertEqual(price_rules, [])
frappe.delete_doc("Promotional Scheme", ps.name)

def test_min_max_amount_configuration(self):
ps = make_promotional_scheme()
ps.price_discount_slabs[0].min_amount = 10
Expand Down

0 comments on commit 2613bdd

Please sign in to comment.