예제 #1
0
파일: tests.py 프로젝트: 34/T
 def setUp(self):
     self.carrier = Carrier(name="pricing", active=True)
     self.carrier.save()
     self.product = Product.objects.get(slug='dj-rocks')
     t = ProductShippingPrice(carrier=self.carrier,
         product=self.product,
         price=Decimal("10.00"),
         )
     t.save()
예제 #2
0
 def setUp(self):
     self.carrier = Carrier(name="pricing", active=True)
     self.carrier.save()
     self.product = Product.objects.get(slug='dj-rocks')
     t = ProductShippingPrice(
         carrier=self.carrier,
         product=self.product,
         price=Decimal("10.00"),
     )
     t.save()
예제 #3
0
파일: tests.py 프로젝트: 34/T
 def testCreate(self):
     c = Carrier(key="test", active=True)
     c.save()
     product = Product.objects.get(slug='dj-rocks')
     p = ProductShippingPrice(carrier=c, 
         product=product,
         price=Decimal("10.00"),
         )
     p.save()
     
     self.assertEqual(c.price(product), Decimal("10.00"))
예제 #4
0
파일: tests.py 프로젝트: 34/T
 def test2Prices(self):
     c2 = Carrier(name="test2", active=True)
     c2.save()
     t = ProductShippingPrice(carrier=c2,
         product=self.product,
         price=Decimal("20.00"),
         )
     t.save()
     
     self.assertEqual(self.carrier.price(self.product), Decimal("10.00"))
     self.assertEqual(c2.price(self.product), Decimal("20.00"))
예제 #5
0
    def test2Prices(self):
        c2 = Carrier(name="test2", active=True)
        c2.save()
        t = ProductShippingPrice(
            carrier=c2,
            product=self.product,
            price=Decimal("20.00"),
        )
        t.save()

        self.assertEqual(self.carrier.price(self.product), Decimal("10.00"))
        self.assertEqual(c2.price(self.product), Decimal("20.00"))
예제 #6
0
    def testCreate(self):
        c = Carrier(key="test", active=True)
        c.save()
        product = Product.objects.get(slug='dj-rocks')
        p = ProductShippingPrice(
            carrier=c,
            product=product,
            price=Decimal("10.00"),
        )
        p.save()

        self.assertEqual(c.price(product), Decimal("10.00"))
예제 #7
0
파일: tests.py 프로젝트: 34/T
 def testVariantPrices(self):
     """price for shipping a variant is the same as the master, except when it is explicitly set"""
     
     variant = Product.objects.get(slug='dj-rocks-s-b')
     
     self.assertEqual(self.carrier.price(variant), Decimal("10.00"))
     
     t = ProductShippingPrice(carrier=self.carrier,
         product=variant,
         price=Decimal("20.00"),
         )
     t.save()
     
     self.assertEqual(self.carrier.price(variant), Decimal("20.00"))
예제 #8
0
    def testVariantPrices(self):
        """price for shipping a variant is the same as the master, except when it is explicitly set"""

        variant = Product.objects.get(slug='dj-rocks-s-b')

        self.assertEqual(self.carrier.price(variant), Decimal("10.00"))

        t = ProductShippingPrice(
            carrier=self.carrier,
            product=variant,
            price=Decimal("20.00"),
        )
        t.save()

        self.assertEqual(self.carrier.price(variant), Decimal("20.00"))