def test_variant_images_fallback_to_parent(self): parent = factories.ProductFactory(structure='parent') variant = factories.create_product(parent=parent) factories.create_product_image(product=parent, caption='Parent Product Image') all_images = variant.get_all_images() self.assertEquals(all_images.count(), 1) product_image = all_images.first() self.assertEquals(product_image.caption, 'Parent Product Image')
def test_images_are_in_consecutive_order(self): product = factories.create_product() for i in range(4): factories.create_product_image(product=product, display_order=i) product.images.all()[2].delete() for idx, im in enumerate(product.images.all()): self.assertEqual(im.display_order, idx)