예제 #1
0
 def test_zero_tax_with_postage_and_discount(self):
     """test tax with postage and discount"""
     settings.CCCHECKOUT_TAX = Decimal('0.00')
     # make the postage
     line = Line()
     line.name='test postage'
     line.save()
     tier = LineTier()
     tier.price = Decimal('2.50')
     tier.minimum = 0
     tier.maximum = 100
     tier.line = line
     tier.save()
     # add the postages to the checkout
     self.checkout.postage = line
     self.checkout.postage_tier = tier
     self.checkout.save()
     # add a discount to the checkout
     d = DiscountCode()
     d.type = d.PERCENTAGE
     d.discount = Decimal('50.00')
     d.title = 'test discount'
     d.save()
     self.checkout.discount = d
     self.checkout.save()
     # now the tax should be 5,24
     self.assertEqual(Decimal('0.00'), self.checkout.total_tax())
예제 #2
0
 def test_with_postage_no_discount(self):
     """test tax with postage and without discount"""
     # make the postage
     line = Line()
     line.name='test postage'
     line.save()
     tier = LineTier()
     tier.price = Decimal('2.50')
     tier.minimum = 0
     tier.maximum = 100
     tier.line = line
     tier.save()
     # add the postages to the checkout
     self.checkout.postage = line
     self.checkout.postage_tier = tier
     self.checkout.save()
     self.assertEqual(Decimal('4.90'), self.checkout.total_tax())
예제 #3
0
 def test_payment_responds_with_postage(self):
     """If there is postage then payment responds 200"""
     p = Line()
     p.name = 'test'
     p.save()
     p_tier = LineTier()
     p_tier.line = p
     p_tier.minimum = Decimal('0.00')
     p_tier.maximum = Decimal('0.00')
     p_tier.price = Decimal('2.00')
     p_tier.save()
     p_country = LineCountry()
     p_country.line = p
     p_country.country = 'GB'
     p_country.save()
     checkout = deepcopy(self.checkout)
     checkout.postage = p
     checkout.postage_tier = p_tier
     checkout.save()
     # process and all is fine
     request = self.rf.get(reverse('cccheckout:payment'))
     request.session['cccheckout'] = checkout
     r = payment(request)
     self.assertEqual(200, r.status_code)