invoice.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:zing 作者: evernote 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号