Ejemplo n.º 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()
Ejemplo n.º 2
0
 def setUp(self):
     """set up the environment for the tests"""
     reload(c_settings)
     session_key = '11111111111111111111111111111111'
     settings.CCCHECKOUT_ADAPTER = 'cccheckout.tests.mock.testcase_adapter'
     engine = import_module(settings.SESSION_ENGINE)
     # make mock basket lines
     p1 = MockBasketLine('10.00', 2, 'test thing')
     p2 = MockBasketLine('2.00', 1, 'anotjer')
     # make a customer
     customer = Customer(delivery_country='GB')
     customer.save()
     # make a checkout on the session
     c = Checkout()
     c.session_id = session_key
     c.customer = customer
     c.items = [p1, p2]
     c.item_total = Decimal('10.00')
     c.lines = 3
     c.save()
     self.checkout = c
     # make request & add checkout
     self.rf = MockRequest()
     # add the postages
     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=22,
                 price=Decimal('1.00'),
                 line=line1)
     tier1.save()
     # tier 2
     tier2 = LineTier(
                 minimum=23,
                 maximum=50,
                 price=Decimal('2.00'),
                 line=line1)
     tier2.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.line1 = line1
     self.country1 = country1
     self.tier1 = tier1
     self.tier2 = tier2
     self.line_ct = line_ct
     self.tier_ct = tier_ct