@@ -25,28 +25,31 @@ class TestingCartController(CartController):
old_quantity = product_item.quantity
except ObjectDoesNotExist:
old_quantity = 0
self.set_quantity(product, old_quantity + quantity)
def next_cart(self):
self.cart.active = False
self.cart.save()
class TestingInvoiceController(InvoiceController):
def pay(self, reference, amount):
def pay(self, reference, amount, pre_validate=True):
''' Testing method for simulating an invoice paymenht by the given
amount. '''
if pre_validate:
# Manual payments don't pre-validate; we should test that things
# still work if we do silly things.
self.validate_allowed_to_pay()
''' Adds a payment '''
commerce.ManualPayment.objects.create(
invoice=self.invoice,
reference=reference,
amount=amount,
)
self.update_status()