def test_project_start_single_action(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')
)
action_count = Action.objects.filter(verb=START).count()
assert action_count == 0
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 phase starts within the last hour but script has already run
with freeze_time(phase.start_date + timedelta(minutes=45)):
call_command('create_system_actions')
action_count = Action.objects.filter(verb=START).count()
assert action_count == 1
评论列表
文章目录