test_commands.py 文件源码

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

项目:adhocracy4 作者: liqd 项目源码 文件源码
def test_project_start_reschedule(phase_factory):

    phase = phase_factory(
        start_date=parse('2013-01-01 17:00:00 UTC'),
        end_date=parse('2013-01-01 18:00:00 UTC')
    )

    # first phase starts within an hour
    with freeze_time(phase.start_date + timedelta(minutes=30)):
        call_command('create_system_actions')
        action_count = Action.objects.filter(verb=START).count()
        assert action_count == 1

    # first phases start date has been moved forward
    # and the start actions timestamp has to be adapted
    phase.start_date = phase.start_date + timedelta(days=1)
    phase.save()
    with freeze_time(phase.start_date + timedelta(minutes=30)):
        call_command('create_system_actions')
        action_count = Action.objects.filter(verb=START).count()
        assert action_count == 1
        action = Action.objects.filter(verb=START).first()
        assert action.timestamp == phase.start_date
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号