Beispiel #1
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)
 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)
Beispiel #3
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)
 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)
    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)
Beispiel #6
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)
Beispiel #7
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)
    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)
 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})
Beispiel #10
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})