def test_stats_hours(self):
"""Test CACHE PROJECT STATS hours works."""
pr = ProjectFactory.create()
task = TaskFactory.create(n_answers=1)
today = datetime.now(pytz.utc)
TaskFactory.create()
TaskRunFactory.create(project=pr, task=task)
AnonymousTaskRunFactory.create(project=pr)
hours, hours_anon, hours_auth, max_hours, \
max_hours_anon, max_hours_auth = stats_hours(pr.id)
assert len(hours) == 24, len(hours)
assert hours[today.strftime('%H')] == 2, hours[today.strftime('%H')]
assert hours_anon[today.strftime('%H')] == 1, hours_anon[today.strftime('%H')]
assert hours_auth[today.strftime('%H')] == 1, hours_auth[today.strftime('%H')]
assert max_hours == 2
assert max_hours_anon == 1
assert max_hours_auth == 1
test_cache_project_stats.py 文件源码
python
阅读 33
收藏 0
点赞 0
评论 0
评论列表
文章目录