aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA.Avenel <avenel.alexandre@gmail.com>2011-11-02 15:26:35 +0100
committerA.Avenel <avenel.alexandre@gmail.com>2011-11-02 15:26:35 +0100
commit6df3bcdf1385a17e9d3d3dff6ba9278cb4e57247 (patch)
treec09c588de896f0463ec123fe5d705167922cc331
parent66bd6268fad3b9e50dab568a12dee9ef0eece24d (diff)
downloadihatemoney-mirror-6df3bcdf1385a17e9d3d3dff6ba9278cb4e57247.zip
ihatemoney-mirror-6df3bcdf1385a17e9d3d3dff6ba9278cb4e57247.tar.gz
ihatemoney-mirror-6df3bcdf1385a17e9d3d3dff6ba9278cb4e57247.tar.bz2
Oops, forgot to commit tests
-rw-r--r--budget/tests.py33
1 files changed, 23 insertions, 10 deletions
diff --git a/budget/tests.py b/budget/tests.py
index 3f261fa..de6317b 100644
--- a/budget/tests.py
+++ b/budget/tests.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import os
import tempfile
-import unittest
+import unittest2 as unittest
import base64
import json
@@ -283,15 +283,6 @@ class BudgetTestCase(TestCase):
bill = models.Bill.query.one()
self.assertEqual(bill.amount, 25)
- self.app.post("/raclette/add", data={
- 'date': '2011-08-10',
- 'what': u'fromage à raclette',
- 'payer': members_ids[0],
- 'payed_for': members_ids,
- 'amount': '-25', # bill with a negative value is not possible
- })
- self.assertEqual(1, models.Bill.query.count())
-
# edit the bill
resp = self.app.post("/raclette/edit/%s" % bill.id, data={
'date': '2011-08-10',
@@ -336,6 +327,28 @@ class BudgetTestCase(TestCase):
balance = models.Project.query.get("raclette").balance
self.assertEqual(set(balance.values()), set([19.0, -19.0]))
+ #Bill with negative amount
+ self.app.post("/raclette/add", data={
+ 'date': '2011-08-12',
+ 'what': u'fromage à raclette',
+ 'payer': members_ids[0],
+ 'payed_for': members_ids,
+ 'amount': '-25', # bill with a negative value should be converted to a positive value
+ })
+ bill = models.Bill.query.filter(models.Bill.date=='2011-08-12')[0]
+ self.assertEqual(bill.amount, 25)
+
+ #add a bill with a comma
+ self.app.post("/raclette/add", data={
+ 'date': '2011-08-01',
+ 'what': u'fromage à raclette',
+ 'payer': members_ids[0],
+ 'payed_for': members_ids,
+ 'amount': '25,02',
+ })
+ bill = models.Bill.query.filter(models.Bill.date=='2011-08-01')[0]
+ self.assertEqual(bill.amount, 25.02)
+
def test_rounding(self):
self.post_project("raclette")