Esempio n. 1
0
 def add_voucher_to_basket(self, voucher=None):
     if voucher is None:
         voucher = factories.create_voucher()
     basket_page = self.get(reverse('basket:summary'))
     form = basket_page.forms['voucher_form']
     form['code'] = voucher.code
     form.submit()
Esempio n. 2
0
 def add_voucher_to_basket(self, voucher=None):
     if voucher is None:
         voucher = factories.create_voucher()
     basket_page = self.get(reverse("basket:summary"))
     form = basket_page.forms["voucher_form"]
     form["code"] = voucher.code
     form.submit()
Esempio n. 3
0
 def add_voucher_to_basket(self, voucher=None):
     if voucher is None:
         voucher = factories.create_voucher()
     basket_page = self.get(reverse('basket:summary'))
     form = basket_page.forms['voucher_form']
     form['code'] = voucher.code
     form.submit()
Esempio n. 4
0
 def test_can_be_created_with_a_voucher(self):
     voucher = create_voucher()
     order = create_order(number='100002')
     discount = OrderDiscount.objects.create(order=order, amount=D('10.00'),
                                             voucher_id=voucher.id)
     self.assertEqual(voucher.id, discount.voucher.id)
     self.assertEqual(voucher.code, discount.voucher_code)
Esempio n. 5
0
 def test_can_be_created_with_a_voucher(self):
     voucher = create_voucher()
     order = create_order(number='100002')
     discount = OrderDiscount.objects.create(order=order, amount=D('10.00'),
                                             voucher_id=voucher.id)
     self.assertEqual(voucher.id, discount.voucher.id)
     self.assertEqual(voucher.code, discount.voucher_code)
Esempio n. 6
0
 def test_can_be_created_with_a_voucher_and_specidied_voucher_code(self):
     voucher = create_voucher()
     order = create_order(number='100002')
     discount = OrderDiscount.objects.create(order=order, amount=D('10.00'),
                                             voucher_id=voucher.id,
                                             voucher_code="anothercode")
     self.assertEqual(voucher.id, discount.voucher.id)
     self.assertEqual('anothercode', discount.voucher_code)
Esempio n. 7
0
 def test_can_be_created_with_a_voucher_and_specidied_voucher_code(self):
     voucher = create_voucher()
     order = create_order(number='100002')
     discount = OrderDiscount.objects.create(order=order, amount=D('10.00'),
                                             voucher_id=voucher.id,
                                             voucher_code="anothercode")
     self.assertEqual(voucher.id, discount.voucher.id)
     self.assertEqual('anothercode', discount.voucher_code)
Esempio n. 8
0
    def test_contains_voucher_details_after_voucher_is_deleted(self):
        voucher = create_voucher()
        order = create_order(number="100002")
        discount = OrderDiscount.objects.create(order=order, amount=D("10.00"), voucher_id=voucher.id)
        voucher.delete()

        self.assertTrue(discount.voucher is None)
        self.assertTrue(discount.offer is None)

        self.assertEquals(discount.description(), voucher.code)
Esempio n. 9
0
    def setUp(self):
        super(TestPlacingOrderUsingAVoucher, self).setUp()
        self.add_product_to_basket()
        voucher = create_voucher()
        self.add_voucher_to_basket(voucher)
        self.complete_shipping_address()
        self.complete_shipping_method()
        self.response = self.submit()

        # Reload voucher
        self.voucher = Voucher.objects.get(id=voucher.id)
Esempio n. 10
0
    def setUp(self):
        self.login()
        self.add_product_to_basket()
        voucher = create_voucher()
        self.add_voucher_to_basket(voucher)
        self.complete_shipping_address()
        self.complete_shipping_method()
        self.response = self.submit()

        # Reload voucher
        self.voucher = Voucher.objects.get(id=voucher.id)
Esempio n. 11
0
    def test_contains_voucher_details_after_voucher_is_deleted(self):
        voucher = create_voucher()
        order = create_order(number='100002')
        discount = OrderDiscount.objects.create(order=order, amount=D('10.00'),
                                                voucher_id=voucher.id)
        voucher.delete()

        self.assertTrue(discount.voucher is None)
        self.assertTrue(discount.offer is None)

        self.assertEqual(discount.description(), voucher.code)
Esempio n. 12
0
    def setUp(self):
        self.login()
        self.add_product_to_basket()
        voucher = create_voucher()
        self.add_voucher_to_basket(voucher)
        self.complete_shipping_address()
        self.complete_shipping_method()
        self.response = self.submit()

        # Reload voucher
        self.voucher = Voucher.objects.get(id=voucher.id)
Esempio n. 13
0
    def setUp(self):
        super(TestPlacingOrderUsingAVoucher, self).setUp()
        self.add_product_to_basket()
        voucher = create_voucher()
        self.add_voucher_to_basket(voucher)
        self.complete_shipping_address()
        self.complete_shipping_method()
        self.response = self.submit()

        # Reload voucher
        self.voucher = Voucher.objects.get(id=voucher.id)
Esempio n. 14
0
 def add_voucher_to_basket(self, voucher=None):
     if voucher is None:
         voucher = create_voucher()
     self.client.post(reverse('basket:vouchers-add'),
                      {'code': voucher.code})
Esempio n. 15
0
 def setUp(self):
     self.voucher = factories.create_voucher()
     super().setUp()
Esempio n. 16
0
 def add_voucher_to_basket(self, voucher=None):
     if voucher is None:
         voucher = create_voucher()
     self.client.post(reverse('basket:vouchers-add'),
                      {'code': voucher.code})
Esempio n. 17
0
 def add_voucher_to_basket(self, voucher=None):
     if voucher is None:
         voucher = create_voucher()
     self.client.post(reverse("basket:vouchers-add"), {"code": voucher.code})