Skip to content

Commit

Permalink
[IMP] sale_promotion_discount_in_field: tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Volodiay616 committed Aug 19, 2023
1 parent 2b32aa0 commit 3f80b00
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ def _apply_coupon(self, order, coupon_code):

def test_program_reward_discount_line_with_applicability(self):
coupon_code = "test_coupon"

# Create a program with specific conditions
program = self.env["coupon.program"].create(
{
Expand All @@ -284,6 +283,7 @@ def test_program_reward_discount_line_with_applicability(self):
"discount_apply_on": "on_order",
"promo_code": coupon_code,
"promo_applicability": "on_current_order",
"maximum_use_number": 1,
}
)

Expand All @@ -299,7 +299,6 @@ def test_program_reward_discount_line_with_applicability(self):

# Apply the program
result = self._apply_coupon(self.order, coupon_code)
# self._apply_coupon(self.order, coupon_code)
self.assertEqual(
self.order.code_promo_program_id,
program,
Expand All @@ -311,3 +310,10 @@ def test_program_reward_discount_line_with_applicability(self):
"The order total with programs should be 2475.00",
)
self.assertEqual(result, {})

# Try to use the applied coupon
error_status = program._check_promo_code(self.order, coupon_code)
result = self._apply_coupon(self.order, coupon_code)
self.assertEqual(
result, error_status, msg="The promo code is already applied on this order"
)

0 comments on commit 3f80b00

Please sign in to comment.