def test_get_for_currencies_multiple_currencies(self): currencies = [Mock(), Mock()] moneys = [Money(10, currencies[0]), Money(-8, currencies[1])] balance = Balance(moneys) assert balance.get_for_currency(currencies[0]) == Money( 10, currencies[0]) assert balance.get_for_currency(currencies[1]) == Money( -8, currencies[1])
def test_get_for_currency_not_present_return_zero(self): currencies = [Mock(), Mock()] money = Money(10, currencies[0]) balance = Balance([money]) assert balance.get_for_currency(currencies[1]) == Money( 0, currencies[1])
def test_get_for_currency_present_two_movements(self): currency = Mock() moneys = [Money(10, currency), Money(20, currency)] balance = Balance(moneys) assert balance.get_for_currency(currency) == Money(30, currency)
def test_get_for_currency_empty(self): currency = Mock() balance = Balance([]) assert balance.get_for_currency(currency) == Money(0, currency)