def test_project_closed_points(client, data):
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points_per_role'] == {})
    data.user_story1.is_closed = True
    data.user_story1.save()
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points_per_role'] == {data.role1.pk: 1, data.role2.pk: 0})
    data.user_story2.is_closed = True
    data.user_story2.save()
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points_per_role'] == {data.role1.pk: 3, data.role2.pk: 0})
    data.user_story3.is_closed = True
    data.user_story3.save()
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points_per_role'] == {data.role1.pk: 7, data.role2.pk: 0})
    data.user_story4.is_closed = True
    data.user_story4.save()
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points_per_role'] == {data.role1.pk: 15, data.role2.pk: 0})
    data.user_story5.is_closed = True
    data.user_story5.save()
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points_per_role'] == {data.role1.pk: 31, data.role2.pk: 0})
    data.user_story6.is_closed = True
    data.user_story6.save()
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points_per_role'] == {data.role1.pk: 63, data.role2.pk: 0})
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points'] == 63)
    assert (project_stats['speed'] == 24)
def test_project_closed_points(client, data):
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points_per_role'] == {})
    data.user_story1.is_closed = True
    data.user_story1.save()
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points_per_role'] == {data.role1.pk: 1, data.role2.pk: 0})
    data.user_story2.is_closed = True
    data.user_story2.save()
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points_per_role'] == {data.role1.pk: 3, data.role2.pk: 0})
    data.user_story3.is_closed = True
    data.user_story3.save()
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points_per_role'] == {data.role1.pk: 7, data.role2.pk: 0})
    data.user_story4.is_closed = True
    data.user_story4.save()
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points_per_role'] == {data.role1.pk: 15, data.role2.pk: 0})
    data.user_story5.is_closed = True
    data.user_story5.save()
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points_per_role'] == {data.role1.pk: 31, data.role2.pk: 0})
    data.user_story6.is_closed = True
    data.user_story6.save()
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points_per_role'] == {data.role1.pk: 63, data.role2.pk: 0})
    project_stats = get_stats_for_project(data.project)
    assert (project_stats['closed_points'] == 63)
    assert (project_stats['speed'] == 24)