mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 19:59:12 +00:00
Test case fixes
This commit is contained in:
@@ -24,11 +24,13 @@ def get_quotation(user=None):
|
||||
party.doctype.lower(): party.name,
|
||||
"docstatus": 0,
|
||||
"contact_email": user,
|
||||
"selling_price_list": "_Test Price List Rest of the World"
|
||||
"selling_price_list": "_Test Price List Rest of the World",
|
||||
"currency": "USD"
|
||||
}
|
||||
|
||||
try:
|
||||
quotation = frappe.get_doc("Quotation", values)
|
||||
|
||||
except frappe.DoesNotExistError:
|
||||
quotation = frappe.new_doc("Quotation")
|
||||
quotation.update(values)
|
||||
@@ -43,7 +45,6 @@ def set_item_in_cart(item_code, qty, user=None):
|
||||
quotation = get_quotation(user=user)
|
||||
qty = flt(qty)
|
||||
quotation_item = quotation.get("items", {"item_code": item_code})
|
||||
|
||||
if qty==0:
|
||||
if quotation_item:
|
||||
# remove
|
||||
@@ -58,7 +59,6 @@ def set_item_in_cart(item_code, qty, user=None):
|
||||
"item_code": item_code,
|
||||
"qty": qty
|
||||
})
|
||||
|
||||
quotation.save(ignore_permissions=True)
|
||||
return quotation
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ class TestShoppingCart(unittest.TestCase):
|
||||
# test if lead is created and quotation with new lead is fetched
|
||||
quotation = get_quotation()
|
||||
self.assertEquals(quotation.quotation_to, "Lead")
|
||||
self.assertEquals(frappe.db.get_value("Lead", quotation.lead, "email_id"), "test_cart_user@example.com")
|
||||
self.assertEquals(frappe.db.get_value("Lead", quotation.lead, "email_id"),
|
||||
"test_cart_user@example.com")
|
||||
self.assertEquals(quotation.customer, None)
|
||||
self.assertEquals(quotation.contact_email, frappe.session.user)
|
||||
|
||||
@@ -109,37 +110,6 @@ class TestShoppingCart(unittest.TestCase):
|
||||
self.assertEquals(quotation.net_total, 0)
|
||||
self.assertEquals(len(quotation.get("items")), 0)
|
||||
|
||||
def test_set_billing_address(self):
|
||||
return
|
||||
|
||||
# first, add to cart
|
||||
self.test_add_to_cart()
|
||||
|
||||
quotation = self.test_get_cart_lead()
|
||||
default_address = frappe.get_doc("Address", {"lead": quotation.lead, "is_primary_address": 1})
|
||||
self.assertEquals("customer_address", default_address.name)
|
||||
|
||||
def test_set_shipping_address(self):
|
||||
# first, add to cart
|
||||
self.test_add_to_cart()
|
||||
|
||||
|
||||
|
||||
def test_shipping_rule(self):
|
||||
self.test_set_shipping_address()
|
||||
|
||||
# check if shipping rule changed
|
||||
pass
|
||||
|
||||
def test_price_list(self):
|
||||
self.test_set_billing_address()
|
||||
|
||||
# check if price changed
|
||||
pass
|
||||
|
||||
def test_place_order(self):
|
||||
pass
|
||||
|
||||
# helper functions
|
||||
def enable_shopping_cart(self):
|
||||
settings = frappe.get_doc("Shopping Cart Settings", "Shopping Cart Settings")
|
||||
@@ -199,7 +169,8 @@ class TestShoppingCart(unittest.TestCase):
|
||||
"email_id": "test_cart_lead@example.com",
|
||||
"lead_name": "_Test Website Lead",
|
||||
"status": "Open",
|
||||
"territory": "_Test Territory Rest Of The World"
|
||||
"territory": "_Test Territory Rest Of The World",
|
||||
"company": "_Test Company"
|
||||
})
|
||||
lead.insert(ignore_permissions=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user