def data():
    m = type("Models", (object, ), {})

    m.registered_user = f.UserFactory.create()
    m.project_member_with_perms = f.UserFactory.create()
    m.project_member_without_perms = f.UserFactory.create()
    m.project_owner = f.UserFactory.create()
    m.other_user = f.UserFactory.create()

    m.public_project = f.ProjectFactory(
        is_private=False,
        anon_permissions=list(map(lambda x: x[0], ANON_PERMISSIONS)),
        public_permissions=list(map(lambda x: x[0], ANON_PERMISSIONS)),
        owner=m.project_owner,
        userstories_csv_uuid=uuid.uuid4().hex)
    m.private_project1 = f.ProjectFactory(
        is_private=True,
        anon_permissions=list(map(lambda x: x[0], ANON_PERMISSIONS)),
        public_permissions=list(map(lambda x: x[0], ANON_PERMISSIONS)),
        owner=m.project_owner,
        userstories_csv_uuid=uuid.uuid4().hex)
    m.private_project2 = f.ProjectFactory(
        is_private=True,
        anon_permissions=[],
        public_permissions=[],
        owner=m.project_owner,
        userstories_csv_uuid=uuid.uuid4().hex)
    m.blocked_project = f.ProjectFactory(
        is_private=True,
        anon_permissions=[],
        public_permissions=[],
        owner=m.project_owner,
        userstories_csv_uuid=uuid.uuid4().hex,
        blocked_code=project_choices.BLOCKED_BY_STAFF)

    m.public_membership = f.MembershipFactory(project=m.public_project,
                                              user=m.project_member_with_perms,
                                              role__project=m.public_project,
                                              role__permissions=list(
                                                  map(lambda x: x[0],
                                                      MEMBERS_PERMISSIONS)))
    m.private_membership1 = f.MembershipFactory(
        project=m.private_project1,
        user=m.project_member_with_perms,
        role__project=m.private_project1,
        role__permissions=list(map(lambda x: x[0], MEMBERS_PERMISSIONS)))
    f.MembershipFactory(project=m.private_project1,
                        user=m.project_member_without_perms,
                        role__project=m.private_project1,
                        role__permissions=[])
    m.private_membership2 = f.MembershipFactory(
        project=m.private_project2,
        user=m.project_member_with_perms,
        role__project=m.private_project2,
        role__permissions=list(map(lambda x: x[0], MEMBERS_PERMISSIONS)))
    f.MembershipFactory(project=m.private_project2,
                        user=m.project_member_without_perms,
                        role__project=m.private_project2,
                        role__permissions=[])
    m.blocked_membership = f.MembershipFactory(
        project=m.blocked_project,
        user=m.project_member_with_perms,
        role__project=m.blocked_project,
        role__permissions=list(map(lambda x: x[0], MEMBERS_PERMISSIONS)))
    f.MembershipFactory(project=m.blocked_project,
                        user=m.project_member_without_perms,
                        role__project=m.blocked_project,
                        role__permissions=[])

    f.MembershipFactory(project=m.public_project,
                        user=m.project_owner,
                        is_admin=True)

    f.MembershipFactory(project=m.private_project1,
                        user=m.project_owner,
                        is_admin=True)

    f.MembershipFactory(project=m.private_project2,
                        user=m.project_owner,
                        is_admin=True)

    f.MembershipFactory(project=m.blocked_project,
                        user=m.project_owner,
                        is_admin=True)

    m.public_points = f.PointsFactory(project=m.public_project)
    m.private_points1 = f.PointsFactory(project=m.private_project1)
    m.private_points2 = f.PointsFactory(project=m.private_project2)
    m.blocked_points = f.PointsFactory(project=m.blocked_project)

    m.public_role_points = f.RolePointsFactory(
        role=m.public_project.roles.all()[0],
        points=m.public_points,
        user_story__project=m.public_project,
        user_story__milestone__project=m.public_project,
        user_story__status__project=m.public_project)
    m.private_role_points1 = f.RolePointsFactory(
        role=m.private_project1.roles.all()[0],
        points=m.private_points1,
        user_story__project=m.private_project1,
        user_story__milestone__project=m.private_project1,
        user_story__status__project=m.private_project1)
    m.private_role_points2 = f.RolePointsFactory(
        role=m.private_project2.roles.all()[0],
        points=m.private_points2,
        user_story__project=m.private_project2,
        user_story__milestone__project=m.private_project2,
        user_story__status__project=m.private_project2)
    m.blocked_role_points = f.RolePointsFactory(
        role=m.blocked_project.roles.all()[0],
        points=m.blocked_points,
        user_story__project=m.blocked_project,
        user_story__milestone__project=m.blocked_project,
        user_story__status__project=m.blocked_project)

    m.public_user_story = m.public_role_points.user_story
    m.private_user_story1 = m.private_role_points1.user_story
    m.private_user_story2 = m.private_role_points2.user_story
    m.blocked_user_story = m.blocked_role_points.user_story

    return m
def data():
    m = type("Models", (object, ), {})

    m.registered_user = f.UserFactory.create()
    m.project_member_with_perms = f.UserFactory.create()
    m.project_member_without_perms = f.UserFactory.create()
    m.project_owner = f.UserFactory.create()
    m.other_user = f.UserFactory.create()

    m.public_project = f.ProjectFactory(
        is_private=False,
        anon_permissions=list(map(lambda x: x[0], ANON_PERMISSIONS)),
        public_permissions=list(map(lambda x: x[0], USER_PERMISSIONS)),
        owner=m.project_owner)
    m.private_project1 = f.ProjectFactory(
        is_private=True,
        anon_permissions=list(map(lambda x: x[0], ANON_PERMISSIONS)),
        public_permissions=list(map(lambda x: x[0], USER_PERMISSIONS)),
        owner=m.project_owner)
    m.private_project2 = f.ProjectFactory(is_private=True,
                                          anon_permissions=[],
                                          public_permissions=[],
                                          owner=m.project_owner)

    m.public_membership = f.MembershipFactory(project=m.public_project,
                                              user=m.project_member_with_perms,
                                              role__project=m.public_project,
                                              role__permissions=list(
                                                  map(lambda x: x[0],
                                                      MEMBERS_PERMISSIONS)))
    m.private_membership1 = f.MembershipFactory(
        project=m.private_project1,
        user=m.project_member_with_perms,
        role__project=m.private_project1,
        role__permissions=list(map(lambda x: x[0], MEMBERS_PERMISSIONS)))
    f.MembershipFactory(project=m.private_project1,
                        user=m.project_member_without_perms,
                        role__project=m.private_project1,
                        role__permissions=[])
    m.private_membership2 = f.MembershipFactory(
        project=m.private_project2,
        user=m.project_member_with_perms,
        role__project=m.private_project2,
        role__permissions=list(map(lambda x: x[0], MEMBERS_PERMISSIONS)))
    f.MembershipFactory(project=m.private_project2,
                        user=m.project_member_without_perms,
                        role__project=m.private_project2,
                        role__permissions=[])

    m.public_points = f.PointsFactory(project=m.public_project)
    m.private_points1 = f.PointsFactory(project=m.private_project1)
    m.private_points2 = f.PointsFactory(project=m.private_project2)

    m.public_role_points = f.RolePointsFactory(
        role=m.public_project.roles.all()[0],
        points=m.public_points,
        user_story__project=m.public_project)
    m.private_role_points1 = f.RolePointsFactory(
        role=m.private_project1.roles.all()[0],
        points=m.private_points1,
        user_story__project=m.private_project1)
    m.private_role_points2 = f.RolePointsFactory(
        role=m.private_project2.roles.all()[0],
        points=m.private_points2,
        user_story__project=m.private_project2)

    m.public_user_story = m.public_role_points.user_story
    m.private_user_story1 = m.private_role_points1.user_story
    m.private_user_story2 = m.private_role_points2.user_story

    return m