Starts test_helpers.py, so we can get credit note testing stuff into its own module.

This commit is contained in:
Christopher Neugebauer 2016-09-15 09:29:31 +10:00
parent 1cf6645061
commit 23658be49a
2 changed files with 13 additions and 11 deletions

View file

@ -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)

View file

@ -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)