]> asedeno.scripts.mit.edu Git - bluechips.git/blob - bluechips/tests/splits/test_fixed.py
Split tests aren't testing a controller, so don't use TestController
[bluechips.git] / bluechips / tests / splits / test_fixed.py
1 from unittest import TestCase
2 from bluechips.tests import *
3 from bluechips import model
4 from bluechips.model import meta
5 from bluechips.model.types import Currency
6
7 class TestSplitFixed(TestCase):
8     def test_simpleSplit(self):
9         createUsers(4)
10         
11         e = model.Expenditure()
12         e.spender = meta.Session.query(model.User).first()
13         e.amount = Currency("100.00")
14         meta.Session.save(e)
15         e.even_split()
16         meta.Session.commit()
17         
18         for s in meta.Session.query(model.Split).\
19                 filter(model.Split.expenditure==e):
20             assert s.share == Currency("25.00"), \
21                 "$100 expenditure did not split evenly"
22         
23         deleteExpenditures()
24         deleteUsers()