Starts test_helpers.py, so we can get credit note testing stuff into its own module.
This commit is contained in:
		
							parent
							
								
									1cf6645061
								
							
						
					
					
						commit
						23658be49a
					
				
					 2 changed files with 13 additions and 11 deletions
				
			
		
							
								
								
									
										11
									
								
								registrasion/tests/test_helpers.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								registrasion/tests/test_helpers.py
									
										
									
									
									
										Normal 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) | ||||
|  | @ -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) | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Christopher Neugebauer
						Christopher Neugebauer