Beispiel #1
0
    def test_get_balances(self):
        currency_one, currency_two = Mock(), Mock()
        transactions = [
            self.gen_transaction_mock([Money('10', currency_one)]),
            self.gen_transaction_mock([Money('20', currency_two)])
        ]
        initial_balance = Balance([Money('20', currency_two)])

        journal = Journal(Mock(), initial_balance, transactions)

        result = journal.get_balances()
        assert result[0] == initial_balance.add_money(Money(
            '10', currency_one))
        assert result[1] == result[0].add_money(Money('20', currency_two))
Beispiel #2
0
 def test_add_money_two_long(self):
     moneys = [Mock(quantity=Decimal(5)), Mock(quantity=Decimal(2))]
     balance = Balance([moneys[0]])
     assert balance.add_money(moneys[1]) == Balance(moneys)
Beispiel #3
0
 def test_add_money_zero(self):
     money = Mock(quantity=Decimal('10'))
     balance = Balance([])
     assert balance.add_money(money) == Balance([money])