def build_submission(): basket = factories.create_basket() # Ensure taxes aren't set by default basket.strategy = strategy.US() # Ensure partner has an address partner = basket.lines.all()[0].stockrecord.partner G(partner_models.PartnerAddress, partner=partner) shipping_address = G(models.ShippingAddress, phone_number='') shipping_method = methods.FixedPrice(D('0.99')) shipping_charge = shipping_method.calculate(basket) calculator = calculators.OrderTotalCalculator() total = calculator.calculate(basket, shipping_charge) return { 'user': None, 'basket': basket, 'shipping_address': shipping_address, 'shipping_method': shipping_method, 'shipping_charge': shipping_charge, 'order_total': total, 'order_kwargs': {}, 'payment_kwargs': {}}
def test_respects_effective_price_when_taxes_not_known(self): # Assign US style strategy (no tax known) self.basket.strategy = strategy.US() # Add sufficient products to meet condition add_product(self.basket, price=D('6'), quantity=2) # Ensure discount is correct result = self.offer.apply_benefit(self.basket) self.assertEquals(D('2.40'), result.discount)
def test_pricing_policy_unavailable_if_no_price_excl_tax(self): product = factories.ProductFactory(stockrecords=[]) factories.StockRecordFactory(price_excl_tax=None, product=product) info = strategy.US().fetch_for_product(product) self.assertFalse(info.price.exists)
def setUp(self): self.strategy = strategy.US()
def strategy(self, request=None, user=None, **kwargs): return strategy.US(request)