Esempio n. 1
0
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': {}}
Esempio n. 2
0
    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)
Esempio n. 3
0
 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)
Esempio n. 4
0
 def setUp(self):
     self.strategy = strategy.US()
Esempio n. 5
0
 def strategy(self, request=None, user=None, **kwargs):
     return strategy.US(request)