def test_invoice_get_rates_paidtask_rates(member):
"""Tests that `Invoice.get_rates()` returns the rates set for users in their
`PaidTask` entries.
"""
USER_RATE_ONE = 0.5
USER_RATE_TWO = 0.2
# Set some user rate
member.hourly_rate = USER_RATE_ONE
member.save()
month = timezone.datetime(2014, 04, 01)
paid_task_kwargs = {
'rate': USER_RATE_ONE,
'datetime': month,
'user': member,
'task_type': PaidTaskTypes.HOURLY_WORK,
}
PaidTaskFactory(**paid_task_kwargs)
invoice = Invoice(member, FAKE_CONFIG, month=month)
# Set user rate to something else to ensure we get the recorded rates
member.hourly_rate = USER_RATE_TWO
member.save()
rate, review_rate, hourly_rate = invoice.get_rates()
assert hourly_rate == USER_RATE_ONE
评论列表
文章目录