diff --git a/registrasion/tests/test_helpers.py b/registrasion/tests/test_helpers.py new file mode 100644 index 00000000..cdd23de2 --- /dev/null +++ b/registrasion/tests/test_helpers.py @@ -0,0 +1,11 @@ +class TestHelperMixin(object): + + def _invoice_containing_prod_1(self, qty=1): + cart = TestingCartController.for_user(self.USER_1) + cart.add_to_cart(self.PROD_1, qty) + + return TestingInvoiceController.for_cart(self.reget(cart.cart)) + + def _credit_note_for_invoice(self, invoice): + note = commerce.CreditNote.objects.get(invoice=invoice) + return TestingCreditNoteController(note) diff --git a/registrasion/tests/test_invoice.py b/registrasion/tests/test_invoice.py index 4f73bf3c..334db137 100644 --- a/registrasion/tests/test_invoice.py +++ b/registrasion/tests/test_invoice.py @@ -10,23 +10,14 @@ from registrasion.models import inventory from controller_helpers import TestingCartController from controller_helpers import TestingCreditNoteController from controller_helpers import TestingInvoiceController +from test_helpers import TestHelperMixin from test_cart import RegistrationCartTestCase UTC = pytz.timezone('UTC') -class InvoiceTestCase(RegistrationCartTestCase): - - def _invoice_containing_prod_1(self, qty=1): - cart = TestingCartController.for_user(self.USER_1) - cart.add_to_cart(self.PROD_1, qty) - - return TestingInvoiceController.for_cart(self.reget(cart.cart)) - - def _credit_note_for_invoice(self, invoice): - note = commerce.CreditNote.objects.get(invoice=invoice) - return TestingCreditNoteController(note) +class InvoiceTestCase(TestHelperMixin, RegistrationCartTestCase): def test_create_invoice(self): current_cart = TestingCartController.for_user(self.USER_1)