def test_list_view(rf, phase, module_factory, idea_factory):
module = phase.module
project = module.project
idea = idea_factory(module=module)
other_module = module_factory()
other_idea = idea_factory(module=other_module)
with freeze_time(phase.start_date):
view = views.IdeaListView.as_view()
request = rf.get('/ideas')
response = view(request, project=project, module=module)
assert idea in response.context_data['idea_list']
assert other_idea not in response.context_data['idea_list']
assert response.context_data['idea_list'][0].comment_count == 0
assert response.context_data['idea_list'][0].positive_rating_count == 0
assert response.context_data['idea_list'][0].negative_rating_count == 0
评论列表
文章目录