def test_validate_voucher_not_applicable_once_per_customer( voucher, customer_user): voucher.apply_once_per_customer = True voucher.save() VoucherCustomer.objects.create(voucher=voucher, customer_email=customer_user.email) with pytest.raises(NotApplicable): validate_voucher(voucher, 0, 0, customer_user.email)
def test_validate_voucher( total, min_amount_spent, total_quantity, min_checkout_items_quantity, discount_value_type, ): voucher = Voucher.objects.create( code="unique", type=VoucherType.ENTIRE_ORDER, discount_value_type=discount_value_type, discount_value=50, min_amount_spent=get_min_amount_spent(min_amount_spent), min_checkout_items_quantity=min_checkout_items_quantity, ) total_price = Money(total, "USD") validate_voucher(voucher, total_price, total_quantity, "*****@*****.**")
def test_validate_voucher_not_applicable( total, min_spent_amount, total_quantity, min_checkout_items_quantity, discount_value, discount_value_type, ): voucher = Voucher.objects.create( code="unique", currency="USD", type=VoucherType.ENTIRE_ORDER, discount_value_type=discount_value_type, discount_value=discount_value, min_spent_amount=min_spent_amount, min_checkout_items_quantity=min_checkout_items_quantity, ) total_price = Money(total, "USD") with pytest.raises(NotApplicable): validate_voucher(voucher, total_price, total_quantity, "*****@*****.**")