コード例 #1
0
    def test_not_enough_stock(self):
        ShopConfigFactory()
        cart = CartFactory()

        request = self.factory.get("/shop/checkout/ingenico/")
        request.user = cart.customer.user
        request.session = {"cart": cart.id, "custID": cart.customer.id}

        response = pay_ship_info(request)
        self.assertEqual(response.status_code, 302)
        self.assertEqual(
            response._headers["location"],
            ("Location", "{}/cart/".format(
                getattr(settings, "SHOP_BASE", "/store"))),
        )
コード例 #2
0
ファイル: test_declined.py プロジェクト: ToeKnee/jelly-roll
    def test_order_available(self):
        ShopConfigFactory()
        order = TestOrderFactory()

        request = self.factory.get("/shop/checkout/ingenico/declined/")
        request.user = order.contact.user
        request.session = {"orderID": order.id}

        response = declined(request)
        self.assertEqual(response.status_code, 200)
        self.assertIn("declined".encode("utf-8"), response.content)

        order = Order.objects.get(id=order.id)
        self.assertTrue(order.frozen)
        self.assertEqual(order.status.status.status, "Declined")
コード例 #3
0
    def test_has_enough_stock(self):
        ShopConfigFactory()
        cart = CartFactory()
        # Make sure the items are in stock
        for item in cart.cartitem_set.all():
            item.product.items_in_stock = item.quantity
            item.product.save()

        request = self.factory.get("/shop/checkout/ingenico/")
        request.user = cart.customer.user
        request.session = {"cart": cart.id, "custID": cart.customer.id}

        response = pay_ship_info(request)
        self.assertEqual(response.status_code, 200)
        self.assertNotIn("Your cart is empty".encode("utf-8"),
                         response.content)
コード例 #4
0
ファイル: test_accepted.py プロジェクト: ToeKnee/jelly-roll
    def test_order_available(self):
        ShopConfigFactory()
        order = TestOrderFactory()

        request = self.factory.get("/shop/checkout/ingenico/accepted/")
        request.user = order.contact.user
        request.session = {"orderID": order.id}

        response = accepted(request)
        self.assertEqual(response.status_code, 200)
        self.assertIn("Accepted".encode("utf-8"), response.content)
        self.assertIn("Paid through Ingenico".encode("utf-8"), response.content)
        for item in order.orderitem_set.all():
            self.assertIn(item.product.name.encode("utf-8"), response.content)

        order = Order.objects.get(id=order.id)
        self.assertTrue(order.frozen)
        self.assertEqual(order.status.status.status, "Accepted")
        for item in order.orderitem_set.all():
            self.assertEqual(item.product.items_in_stock, 0)
            self.assertEqual(item.product.total_sold, item.quantity)
コード例 #5
0
    def test_not_enough_stock(self):
        ShopConfigFactory()
        cart = CartFactory()
        order = TestOrderFactory()
        # Make all items out of stock
        for item in cart.cartitem_set.all():
            item.product.items_in_stock = 0
            item.product.save()

        request = self.factory.get("/shop/checkout/paypal/confirm/")
        request.user = order.contact.user
        request.session = {
            "cart": cart.id,
            "custID": cart.customer.id,
            "orderID": order.id,
        }

        response = confirm_info(request)
        self.assertEqual(response.status_code, 302)
        self.assertEqual(
            response._headers["location"],
            ("Location", "{}/cart/".format(getattr(settings, "SHOP_BASE", "/store"))),
        )
コード例 #6
0
 def test_base_url(self):
     ShopConfigFactory()
     config = Config.objects.get_current()
     self.assertEqual(config.base_url, "http://example.com")
コード例 #7
0
 def setUp(self):
     ShopConfigFactory.create()
コード例 #8
0
 def setUp(self):
     self.au = AUFactory.create()
     ShopConfigFactory.create(country=self.au)
     self.shop = Config.objects.get_current()
コード例 #9
0
 def setUp(self):
     self.us = USFactory.create()
     ShopConfigFactory.create(country=self.us)
コード例 #10
0
ファイル: test_utils.py プロジェクト: ToeKnee/jelly-roll
 def setUp(self):
     self.request_factory = RequestFactory()
     ShopConfigFactory.create(country=CAFactory())
コード例 #11
0
ファイル: tests.py プロジェクト: ToeKnee/jelly-roll
 def setUp(self):
     ShopConfigFactory.create()
コード例 #12
0
ファイル: tests.py プロジェクト: ToeKnee/jelly-roll
 def setUp(self):
     self.au = AUFactory.create()
     ShopConfigFactory.create(country=self.au)
     self.shop = Config.objects.get_current()
コード例 #13
0
ファイル: tests.py プロジェクト: ToeKnee/jelly-roll
 def setUp(self):
     self.us = USFactory.create()
     ShopConfigFactory.create(country=self.us)
コード例 #14
0
 def setUp(self):
     self.request_factory = RequestFactory()
     ShopConfigFactory.create(country=CAFactory())