Skip to content

Commit

Permalink
[IMP] add test to ensure onchange playing to not do any mess
Browse files Browse the repository at this point in the history
See PR #40
sale_configurator_option was adding default option ids when calling product_option_id
this was doing a huge mess when the user log in (option was convert to normal line)
the fix is done their but by security we keep a test here
  • Loading branch information
sebastienbeau committed Mar 24, 2022
1 parent 96c78a5 commit 8ce6392
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions shopinvader_sale_configurator_option/tests/test_cart.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,18 @@ def test_update_option_action_replace(self):
options = res["data"]["lines"]["items"][0]["options"]
self.assertEqual(len(options), 1)
self.assertEqual(options[0]["qty"], 3)

def test_anonymous_cart_then_sign(self):
res = self.service.dispatch("add_item", params=self.item_params)
self.assertEqual(len(res["data"]["lines"]["items"]), 1)
options = res["data"]["lines"]["items"][0]["options"]
self.assertEqual(len(options), 2)
self.assertEqual(options[0]["option"]["product"]["name"], "Option 1")
self.assertEqual(options[1]["option"]["product"]["name"], "Option 2")
invader_partner = self.env.ref("shopinvader.shopinvader_partner_1")
cart = self.env["sale.order"].browse(res["data"]["id"])
self.shopinvader_session["cart_id"] = cart.id
self.service._load_partner_work_context(invader_partner, force=True)
service_sign = self.service.component("customer")
res = service_sign.sign_in()
self.assertEqual(len(cart.main_line_ids), 1)

0 comments on commit 8ce6392

Please sign in to comment.