コード例 #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()
コード例 #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()
コード例 #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()
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #8
0
ファイル: model_tests.py プロジェクト: nitishr/django-oscar
    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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #13
0
ファイル: checkout_tests.py プロジェクト: onjin/django-oscar
    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)
コード例 #14
0
ファイル: checkout_tests.py プロジェクト: onjin/django-oscar
 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})
コード例 #15
0
 def setUp(self):
     self.voucher = factories.create_voucher()
     super().setUp()
コード例 #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})
コード例 #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})