from django.test import TestCase

# Create your tests here.

@@ -8,53 +8,1100 @@
 ango
-.test import TestCase%0A%0A# Create your tests here.
+_webtest import WebTest%0A%0Afrom django.conf import settings%0Afrom django.shortcuts import reverse%0A%0Afrom apps.shop.models import Product%0A%0A%0Aclass CartWebTests(WebTest):%0A%0A    fixtures = %5B'../load_data.json'%5D%0A%0A    def test_cart_add_product(self):%0A        product = Product.objects.order_by('?').first()%0A%0A        # test GET Method (GET is not allowed)%0A        self.app.get(%0A            reverse(%0A                'cart:add_product',%0A                kwargs=%7B'product_id': product.id%7D%0A            ),%0A            status=405,  # webtest.app.AppError in other case%0A        )%0A%0A        # test POST Method%0A        form = self.app.get(%0A            reverse(%0A                'shop:product_detail',%0A                kwargs=%7B'slug': product.slug%7D,%0A            ),%0A        ).form%0A        qty = product.stock - 1 if product.stock != 1 else 1%0A        form%5B'quantity'%5D = qty%0A        form.submit()%0A%0A        cart = self.app.session%5Bsettings.CART_SESSION_ID%5D%0A        product_data = cart%5Bstr(product.id)%5D%0A        self.assertEqual(product_data%5B'price'%5D, str(product.price))%0A        self.assertEqual(product_data%5B'quantity'%5D, qty)
 %0A

Add first test