def test_simple_shipping(self): # Product.is_shippable should be True unless the Product has a subtype # where is_shippable == False self.assert_(self.cartitem1.is_shippable) self.assert_(self.product1.is_shippable) self.assert_(self.cart1.is_shippable) self.assertEqual(flat(self.cart1, None).cost(), Decimal("4.00")) self.assertEqual(per(self.cart1, None).cost(), Decimal("12.00"))
def test_downloadable_zero_shipping(self): subtype2 = DownloadableProduct.objects.create(product=self.product1) self.assertEqual(self.product1.get_subtypes(), ('DownloadableProduct',)) self.assertFalse(subtype2.is_shippable) self.assertFalse(self.product1.is_shippable) self.assertFalse(self.cart1.is_shippable) self.assertEqual(flat(self.cart1, None).cost(), Decimal("0.00")) self.assertEqual(per(self.cart1, None).cost(), Decimal("0.00"))
def test_simple_shipping(self): # Product.is_shippable should be True unless the Product has a subtype # where is_shippable == False subtype1 = ConfigurableProduct.objects.create(product=self.product1) self.assert_(getattr(subtype1, 'is_shippable', True)) self.assert_(self.cartitem1.is_shippable) self.assert_(self.product1.is_shippable) self.assert_(self.cart1.is_shippable) self.assertEqual(flat(self.cart1, None).cost(), Decimal("4.00")) self.assertEqual(per(self.cart1, None).cost(), Decimal("12.00"))
def test_downloadable_zero_shipping(self): subtypes = config_value('PRODUCT','PRODUCT_TYPES') if "product::DownloadableProduct" in subtypes: subtype2 = DownloadableProduct.objects.create(product=product1) self.assertEqual(product1.get_subtypes(), ('ConfigurableProduct', 'DownloadableProduct')) self.assertFalse(subtype2.is_shippable) self.assertFalse(self.product1.is_shippable) self.assertFalse(self.cart1.is_shippable) self.assertEqual(flat(self.cart1, None).cost(), Decimal("0.00")) self.assertEqual(per(self.cart1, None).cost(), Decimal("0.00"))