Пример #1
0
 def setUp(self):
     # override some of the customer forms 
     settings.CCCHECKOUT_ADAPTER = 'cccheckout.tests.mock.testcase_adapter'
     settings.CCCHECKOUT_PAYMENT_FORMS = (
             'cccheckout.payments.stripe.forms.StripeForm',)
     # set up the session
     reload(c_settings)
     session_key = '11111111111111111111111111111111'
     # make mock basket lines
     p1 = MockBasketLine('10.00', 2, 'test thing')
     p2 = MockBasketLine('2.00', 1, 'another')
     # make the checkout
     c = Checkout()
     c.session_id = session_key
     c.items = [p1, p2]
     c.item_total = Decimal('10.00')
     c.lines = 3
     c.save()
     # now add a customer 
     customer = Customer()
     customer.email = '*****@*****.**'
     customer.save()
     c.customer = customer
     c.save()
     self.checkout = c
     # make request
     self.rf = MockRequest()
Пример #2
0
 def setUp(self):
     """Ensure postage form returns something"""
     #
     # LINE 1
     #
     line1 = Line(name='Test case line based postage')
     line1.save()
     country1  = LineCountry(
                     country='GB',
                     line = line1)
     country1.save()
     # add the tiers
     tier1 = LineTier(
                 minimum=1,
                 maximum=4,
                 price=Decimal('1.00'),
                 line=line1
             )
     tier1.save()
     # tier 2
     tier2 = LineTier(
                 minimum=5,
                 maximum=8,
                 price=Decimal('2.00'),
                 line=line1
             )
     tier2.save()
     # tier 3
     tier3 = LineTier(
                 minimum=9,
                 maximum=20,
                 price=Decimal('3.00'),
                 line=line1
             )
     tier3.save()
     #
     #
     # LINE 2
     line2 = Line(name='Swanky case line based postage')
     line2.save()
     country2  = LineCountry(
                     country='GB',
                     line=line2)
     country2.save()
     # add the tiers
     tier4 = LineTier(
                 minimum=1,
                 maximum=8,
                 price=Decimal('5.00'),
                 line=line2
             )
     tier4.save()
     # tier 2
     tier5 = LineTier(
                 minimum=9,
                 maximum=20,
                 price=Decimal('10.00'),
                 line=line2
             )
     tier5.save()
     #
     #
     # the checkout
     customer = Customer(delivery_country='GB')
     customer.save()
     checkout = Checkout(
                 session_id='test',
                 customer=customer)
     checkout.save()
     # now the content types
     line_ct = ContentType.objects.get_for_model(line1)
     tier_ct = ContentType.objects.get_for_model(tier1)
     # set up the selfs
     self.checkout = checkout
     self.line1 = line1
     self.line2 = line2
     self.country1 = country1
     self.country2 = country2
     self.tier1 = tier1
     self.tier2 = tier2
     self.tier3 = tier3
     self.tier4 = tier4
     self.tier5 = tier5
     self.line_ct = line_ct
     self.tier_ct = tier_ct