test: verificando que se preserve el id del producto en importaciones.
This commit is contained in:
		@@ -3,7 +3,7 @@ from django.contrib.auth.models import AnonymousUser, User
 | 
				
			|||||||
from django.conf import settings
 | 
					from django.conf import settings
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from .views import import_products, products
 | 
					from .views import import_products, products
 | 
				
			||||||
from .models import ProductCategory
 | 
					from .models import ProductCategory, Product
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
import json
 | 
					import json
 | 
				
			||||||
@@ -41,6 +41,13 @@ class TestProducts(TestCase):
 | 
				
			|||||||
        seconds_products = self._get_products()
 | 
					        seconds_products = self._get_products()
 | 
				
			||||||
        self.assertEqual(len(first_products), len(seconds_products))
 | 
					        self.assertEqual(len(first_products), len(seconds_products))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def test_preserve_id_on_import(self):
 | 
				
			||||||
 | 
					        self._import_csv()
 | 
				
			||||||
 | 
					        id_aceite = Product.objects.get(name='Aceite').id
 | 
				
			||||||
 | 
					        self._import_csv('example_products2.csv')
 | 
				
			||||||
 | 
					        id_post_updated = Product.objects.get(name='Aceite').id
 | 
				
			||||||
 | 
					        self.assertEqual(id_aceite, id_post_updated)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_update_price(self):
 | 
					    def test_update_price(self):
 | 
				
			||||||
        self._import_csv()
 | 
					        self._import_csv()
 | 
				
			||||||
        first_products = self._get_products()
 | 
					        first_products = self._get_products()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user