test(fix): fixed test case
This commit is contained in:
parent
10ce2f5d6e
commit
4ee6e32d74
@ -57,7 +57,7 @@ def test_create_test_data():
|
|||||||
})
|
})
|
||||||
item_price.insert()
|
item_price.insert()
|
||||||
# create test item pricing rule
|
# create test item pricing rule
|
||||||
if not frappe.db.exists("Pricing Rule","_Test Pricing Rule for _Test Item"):
|
if not frappe.db.exists("Pricing Rule", {"title": "_Test Pricing Rule for _Test Item"}):
|
||||||
item_pricing_rule = frappe.get_doc({
|
item_pricing_rule = frappe.get_doc({
|
||||||
"doctype": "Pricing Rule",
|
"doctype": "Pricing Rule",
|
||||||
"title": "_Test Pricing Rule for _Test Item",
|
"title": "_Test Pricing Rule for _Test Item",
|
||||||
@ -86,14 +86,15 @@ def test_create_test_data():
|
|||||||
sales_partner.insert()
|
sales_partner.insert()
|
||||||
# create test item coupon code
|
# create test item coupon code
|
||||||
if not frappe.db.exists("Coupon Code", "SAVE30"):
|
if not frappe.db.exists("Coupon Code", "SAVE30"):
|
||||||
|
pricing_rule = frappe.db.get_value("Pricing Rule", {"title": "_Test Pricing Rule for _Test Item"}, ['name'])
|
||||||
coupon_code = frappe.get_doc({
|
coupon_code = frappe.get_doc({
|
||||||
"doctype": "Coupon Code",
|
"doctype": "Coupon Code",
|
||||||
"coupon_name":"SAVE30",
|
"coupon_name":"SAVE30",
|
||||||
"coupon_code":"SAVE30",
|
"coupon_code":"SAVE30",
|
||||||
"pricing_rule": "_Test Pricing Rule for _Test Item",
|
"pricing_rule": pricing_rule,
|
||||||
"valid_from": "2014-01-01",
|
"valid_from": "2014-01-01",
|
||||||
"maximum_use":1,
|
"maximum_use":1,
|
||||||
"used":0
|
"used":0
|
||||||
})
|
})
|
||||||
coupon_code.insert()
|
coupon_code.insert()
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ class TestCouponCode(unittest.TestCase):
|
|||||||
test_create_test_data()
|
test_create_test_data()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
frappe.set_user("Administrator")
|
frappe.set_user("Administrator")
|
||||||
|
|
||||||
def test_sales_order_with_coupon_code(self):
|
def test_sales_order_with_coupon_code(self):
|
||||||
frappe.db.set_value("Coupon Code", "SAVE30", "used", 0)
|
frappe.db.set_value("Coupon Code", "SAVE30", "used", 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user