2016-03-27 08:25:24 +00:00
|
|
|
import pytz
|
|
|
|
|
2016-04-07 00:19:18 +00:00
|
|
|
from controller_helpers import TestingCartController
|
2016-04-07 00:23:38 +00:00
|
|
|
from controller_helpers import TestingInvoiceController
|
2016-03-27 08:25:24 +00:00
|
|
|
|
|
|
|
from test_cart import RegistrationCartTestCase
|
|
|
|
|
|
|
|
UTC = pytz.timezone('UTC')
|
|
|
|
|
|
|
|
|
|
|
|
class RefundTestCase(RegistrationCartTestCase):
|
|
|
|
|
|
|
|
def test_refund_marks_void_and_unpaid_and_cart_released(self):
|
2016-04-03 00:06:35 +00:00
|
|
|
current_cart = TestingCartController.for_user(self.USER_1)
|
2016-03-27 08:25:24 +00:00
|
|
|
|
|
|
|
# Should be able to create an invoice after the product is added
|
|
|
|
current_cart.add_to_cart(self.PROD_1, 1)
|
2016-04-07 00:23:38 +00:00
|
|
|
invoice = TestingInvoiceController.for_cart(current_cart.cart)
|
2016-03-27 08:25:24 +00:00
|
|
|
|
|
|
|
invoice.pay("A Payment!", invoice.invoice.value)
|
|
|
|
self.assertFalse(invoice.invoice.void)
|
|
|
|
self.assertTrue(invoice.invoice.paid)
|
|
|
|
self.assertFalse(invoice.invoice.cart.released)
|
|
|
|
|
|
|
|
invoice.refund("A Refund!", invoice.invoice.value)
|
|
|
|
self.assertTrue(invoice.invoice.void)
|
|
|
|
self.assertFalse(invoice.invoice.paid)
|
|
|
|
self.assertTrue(invoice.invoice.cart.released)
|