Browse Source

Add test for Invoice.amount()

dam 8 years ago
parent
commit
74c92f75c8
1 changed files with 20 additions and 0 deletions
  1. 20 0
      coin/billing/tests.py

+ 20 - 0
coin/billing/tests.py

@@ -113,6 +113,26 @@ 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()
+
+        invoice.details.create(label=self.offer.name,
+                               amount=100,
+                               offersubscription=self.subscription,
+                               period_from=datetime.date(2014, 1, 1),
+                               period_to=datetime.date(2014, 3, 31),
+                               tax=0)
+
+        invoice.details.create(label=self.offer.name,
+                               amount=10,
+                               offersubscription=self.subscription,
+                               period_from=datetime.date(2014, 6, 1),
+                               period_to=datetime.date(2014, 8, 31),
+                               tax=10)
+        
+        self.assertEqual(invoice.amount(), 111)
 
     def test_non_billable_offer_isnt_charged(self):
         """