|
@@ -114,7 +114,7 @@ class BillingInvoiceCreationTests(TestCase):
|
|
|
datetime.date(2014, 4, 1))
|
|
|
self.assertEqual(invoice_test_2.details.first().period_to,
|
|
|
datetime.date(2014, 5, 31))
|
|
|
-
|
|
|
+
|
|
|
def test_invoice_amount(self):
|
|
|
invoice = Invoice(member=self.member)
|
|
|
invoice.save()
|
|
@@ -132,7 +132,7 @@ class BillingInvoiceCreationTests(TestCase):
|
|
|
period_from=datetime.date(2014, 6, 1),
|
|
|
period_to=datetime.date(2014, 8, 31),
|
|
|
tax=10)
|
|
|
-
|
|
|
+
|
|
|
self.assertEqual(invoice.amount(), 111)
|
|
|
|
|
|
def test_invoice_partial_payment(self):
|
|
@@ -145,10 +145,26 @@ class BillingInvoiceCreationTests(TestCase):
|
|
|
period_from=datetime.date(2014, 1, 1),
|
|
|
period_to=datetime.date(2014, 3, 31),
|
|
|
tax=0)
|
|
|
+ invoice.validate()
|
|
|
+ invoice.save()
|
|
|
+
|
|
|
self.assertEqual(invoice.status, 'open')
|
|
|
- invoice.payments.create(payment_mean='cash', amount=10)
|
|
|
+ p1 = Payment.objects.create(member=self.member,
|
|
|
+ invoice=invoice,
|
|
|
+ payment_mean='cash',
|
|
|
+ amount=10)
|
|
|
+ p1.save()
|
|
|
+
|
|
|
+ invoice = Invoice.objects.get(pk=invoice.pk)
|
|
|
self.assertEqual(invoice.status, 'open')
|
|
|
- invoice.payments.create(payment_mean='cash', amount=90)
|
|
|
+
|
|
|
+ p2 = Payment.objects.create(member=self.member,
|
|
|
+ invoice=invoice,
|
|
|
+ payment_mean='cash',
|
|
|
+ amount=90)
|
|
|
+ p2.save()
|
|
|
+
|
|
|
+ invoice = Invoice.objects.get(pk=invoice.pk)
|
|
|
self.assertEqual(invoice.status, 'closed')
|
|
|
|
|
|
def test_invoice_amount_before_tax(self):
|
|
@@ -168,7 +184,7 @@ class BillingInvoiceCreationTests(TestCase):
|
|
|
period_from=datetime.date(2014, 6, 1),
|
|
|
period_to=datetime.date(2014, 8, 31),
|
|
|
tax=10)
|
|
|
-
|
|
|
+
|
|
|
self.assertEqual(invoice.amount_before_tax(), 110)
|
|
|
|
|
|
def test_non_billable_offer_isnt_charged(self):
|