Пример #1
0
 def setUp(self):
     """
     Add some transactions to a VirtualAcct.
     """
     user = User(username = '******', email = '*****@*****.**')
     user.save()
     profile = UserProfile(user = user)
     profile.save()
     budget = Budget(owner = profile, period_budget_amount = '100.00')
     year = Year()
     year.save()
     budget.period_length = year
     budget.save()
     
     category = Category(owner = profile, name = 'test', budget = budget)
     category.save()
     
     self.acct = RealAcct(owner = profile)
     self.acct.save()
     self.vacct = VirtualAcct(owner = profile, real_acct = self.acct, parent_budget = budget)
     self.vacct.save()
     
     self.txn_1 = RealTxn(value = '110.00', category = category, real_acct = self.acct)
     self.txn_1.save()
     self.vtxn_1 = VirtualTxn(value = '90.00', real_txn = self.txn_1, virtual_acct = self.vacct)
     self.vtxn_1.save()
     self.vtxn_2 = VirtualTxn(value = '20.00', real_txn = self.txn_1, virtual_acct = self.vacct)
     self.vtxn_2.save()
Пример #2
0
 def test_periodlength_inheritance(self):
     """
     See if having PeriodLength as not abstract will call PeriodLength
     methods or subclass methods
     """
     user = User(username = '******', email = '*****@*****.**')
     user.save()
     profile = UserProfile(user = user)
     profile.save()
     budget = Budget(owner = profile, period_budget_amount = '100.00')
     year = Year()
     year.save()
     budget.period_length = year
     budget.save()
     length = budget.period_length
     assert(length.__unicode__() == 'Year PeriodLength')