refactoring(Purchase): simplify payment_method #47
This commit is contained in:
		| @@ -1,4 +1,6 @@ | ||||
| from django.test import TestCase | ||||
| from django.core.exceptions import ValidationError | ||||
|  | ||||
| from ..models import Customer, Product, Sale, SaleLine | ||||
|  | ||||
|  | ||||
| @@ -24,6 +26,17 @@ class ConfiaoTest(TestCase): | ||||
|  | ||||
|         self.assertIsInstance(sale, Sale) | ||||
|  | ||||
|     def test_can_create_sale_without_payment_method(self): | ||||
|         sale = Sale() | ||||
|         sale.customer = self.customer | ||||
|         sale.date = "2024-06-22" | ||||
|         sale.phone = '666666666' | ||||
|         sale.description = "Description" | ||||
|         sale.payment_method = '' | ||||
|  | ||||
|         with self.assertRaises(ValidationError): | ||||
|             sale.full_clean() | ||||
|  | ||||
|     def test_create_sale_line(self): | ||||
|         sale = Sale() | ||||
|         sale.customer = self.customer | ||||
|   | ||||
| @@ -19,6 +19,7 @@ class PurchaseFormTest(TestCase): | ||||
|             "csrfmiddlewaretoken": _csrf_token, | ||||
|             "customer": self.customer.id, | ||||
|             "date": "2024-08-03", | ||||
|             "payment_method": "CASH", | ||||
|             "phone": "sfasfd", | ||||
|             "description": "dasdadad", | ||||
|             "saleline_set-TOTAL_FORMS": "1", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user