Ejemplo n.º 1
0
    def create_fixtures(self):
        cart_modifiers_pool.USE_CACHE = False

        self.user = User.objects.create(username="******",
                                        email="*****@*****.**",
                                        first_name="Test",
                                        last_name="Toto")

        self.product = Product()
        self.product.name = "TestPrduct"
        self.product.slug = "TestPrduct"
        self.product.short_description = "TestPrduct"
        self.product.long_description = "TestPrduct"
        self.product.active = True
        self.product.unit_price = self.PRODUCT_PRICE
        self.product.save()

        self.ogroup = OptionGroup()
        self.ogroup.product = self.product
        self.ogroup.name = 'Test group'
        self.ogroup.save()

        self.option = Option()
        self.option.group = self.ogroup
        self.option.name = "Awesome"
        self.option.price = self.AWESOME_OPTION_PRICE
        self.option.save()

        self.cart = Cart()
        self.cart.user = self.user
        self.cart.save()

        self.cartitem = CartItem()
        self.cartitem.cart = self.cart
        self.cartitem.quantity = 1
        self.cartitem.product = self.product
        self.cartitem.save()