def test_pay(self):
b = Mock(spec_set=_BillingPeriod)
b_next = Mock(spec_set=_BillingPeriod)
type(b_next).payment_date = PropertyMock(return_value=date(2017, 1, 15))
type(b).next_period = PropertyMock(return_value=b_next)
i = Mock(spec_set=_InterestCalculation)
p = Mock(spec_set=_MinPaymentFormula)
cls = CCStatement(
i, Decimal('1.23'), p, b,
end_balance=Decimal('1.50'), interest_amt=Decimal('0.27')
)
mock_stmt = Mock(spec_set=CCStatement)
with patch(
'biweeklybudget.interest.CCStatement.next_with_transactions',
autospec=True
) as m:
m.return_value = mock_stmt
res = cls.pay(Decimal('98.76'))
assert res == mock_stmt
assert m.mock_calls == [
call(cls, {date(2017, 1, 15): Decimal('98.76')})
]
评论列表
文章目录