def test_latest_version(): """ The latest_version property should return the latest product version """ versions_to_create = 4 product = ProductFactory.create() versions = ProductVersionFactory.create_batch(versions_to_create, product=product) assert str(product) == "Product for {}".format(str(product.content_object)) assert str(versions[0]) == "ProductVersion for {}, ${}".format( versions[0].description, versions[0].price) # Latest version should be the most recently created assert product.latest_version == versions[versions_to_create - 1]
def coupon_product_ids(): """ Product ids for creating coupons """ product_versions = ProductVersionFactory.create_batch(3) return [product_version.product.id for product_version in product_versions]