Example #1
0
class LFSDownloadsTestCase(TestCase):
    """
    Test lfs_downloads

    LFS downloads react when user buys a product. It doesn't care what kind of
    product has been bought. If the product 
    """
    fixtures = ['lfs_shop.xml']

    def setUp(self):
        # User
        self.username = '******'
        self.password = '******'
        self.email = '*****@*****.**'
        self.user = User.objects.create_user(self.username, self.email, self.password)

        self.product = Product.objects.create(
            name="Product 1",
            slug="product-1",
            sku="sku-1",
            price=1.1,
            active=True,
        )
        self.product.save()


        # Create a digital asset
        self.asset = DigitalAsset(
            product=self.product
        )
        self.asset.save()


    def test_digital_delivery(self):
        self.client.login(username=self.user, password=self.password)
Example #2
0
    def setUp(self):
        # User
        self.username = '******'
        self.password = '******'
        self.email = '*****@*****.**'
        self.user = User.objects.create_user(self.username, self.email, self.password)

        self.product = Product.objects.create(
            name="Product 1",
            slug="product-1",
            sku="sku-1",
            price=1.1,
            active=True,
        )
        self.product.save()


        # Create a digital asset
        self.asset = DigitalAsset(
            product=self.product
        )
        self.asset.save()
 def on_completion(self, uploaded_file, request):
     digiproduct = DigitalAsset(file=uploaded_file, product=self.product)
     digiproduct.save()
     product_changed.send(self.product, request=request)