Exemplo n.º 1
0
 def test_voucher_used_error_msg(self):
     """ Verify correct error message is returned when voucher has been used (Single use). """
     self.mock_access_token_response()
     self.mock_account_api(self.request, self.user.username, data={'is_active': True})
     voucher, product = prepare_voucher(code=COUPON_CODE)
     self.basket.add_product(product)
     order = factories.OrderFactory()
     VoucherApplication.objects.create(voucher=voucher, user=self.user, order=order)
     self.assert_form_valid_message("Coupon code '{code}' has already been redeemed.".format(code=COUPON_CODE))
Exemplo n.º 2
0
 def test_voucher_else_error_msg(self):
     """ Verify correct error message is returned when error case in not covered. """
     voucher, __ = prepare_voucher(code=COUPON_CODE,
                                   usage=Voucher.ONCE_PER_CUSTOMER)
     order = factories.OrderFactory()
     VoucherApplication.objects.create(voucher=voucher,
                                       user=self.user,
                                       order=order)
     self.assertMessage(
         _("Coupon code '{code}' is invalid.").format(code=COUPON_CODE))
Exemplo n.º 3
0
 def test_voucher_used_error_msg(self):
     """ Verify correct error message is returned when voucher has been used (Single use). """
     voucher, __ = prepare_voucher(code=COUPON_CODE)
     order = factories.OrderFactory()
     VoucherApplication.objects.create(voucher=voucher,
                                       user=self.user,
                                       order=order)
     self.assertMessage(
         _("Coupon code '{code}' has already been redeemed.").format(
             code=COUPON_CODE))