def test_delete_products(self): save_product_count = 30 product_data = { str(product.uuid): 'any data' for product in Product.objects.all()[:save_product_count] } update_products.delete(data=product_data) self.assertEqual(Product.objects.count(), save_product_count)
def test_delete_products(self): save_product_count = 30 product_data = { str(product.uuid): 'any data' for product in Product.objects.all()[:save_product_count] } update_products.delete(data=product_data) self.assertEqual(Product.objects.count(), save_product_count)
def test_product_pages_consistency(self): """Full import cycle with delete/update/create should keep db pages consistency.""" # - take some existing prod product = Product.objects.first() product_data = {str(product.uuid): {'name': product.name}} # - delete all products. Our product is among them update_products.delete(data={}) # - set our product to db again updated_products = update_products.update(product_data) update_products.create(product_data, updated_products) # - assert if product's page is unique by name self.assertEqual(1, ProductPage.objects.filter(name=product.name).count()) old_named_pages = ProductPage.objects.filter(name=product.name) # - and this unique page should be active self.assertTrue(old_named_pages.first().is_active)
def test_product_pages_consistency(self): """Full import cycle with delete/update/create should keep db pages consistency.""" # - take some existing prod product = Product.objects.first() product_data = {str(product.uuid): {'name': product.name}} # - delete all products. Our product is among them update_products.delete(data={}) # - set our product to db again updated_products = update_products.update(product_data) update_products.create(product_data, updated_products) # - assert if product's page is unique by name self.assertEqual(1, ProductPage.objects.filter(name=product.name).count()) old_named_pages = ProductPage.objects.filter(name=product.name) # - and this unique page should be active self.assertTrue(old_named_pages.first().is_active)
def test_product_delete(self): """Function called "delete" should not delete, but should deactivate product page.""" product = Product.objects.first() # - delete all products. Our product is among them update_products.delete(data={}) self.assertFalse(product.page.is_active)
def test_product_delete(self): """Function called "delete" should not delete, but should deactivate product page.""" product = Product.objects.first() # - delete all products. Our product is among them update_products.delete(data={}) self.assertFalse(product.page.is_active)