@@ -0,0 +1,1057 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22Helper to get a list of all projects that are nested within another project.%22%22%22%0A%0Afrom website.project.model import Node%0Afrom modularodm import Q%0A%0Afrom tests.base import OsfTestCase%0Afrom tests.factories import ProjectFactory%0A%0A%0Adef find_nested_projects():%0A    return %5Bnode for node in Node.find()%0A            if node.category == 'project'%0A            and node.parent_node is not None%5D%0A%0Aclass TestFindNestedProjects(OsfTestCase):%0A%0A    def test_find_nested(self):%0A        project =ProjectFactory.build()%0A        nested_project = ProjectFactory()%0A        project.nodes.append(nested_project)%0A        project.save()%0A%0A        result = find_nested_projects()%0A        assert nested_project in result%0A        assert project not in result%0A%0A    def test_unnested_project(self):%0A        project = ProjectFactory()%0A        assert project not in find_nested_projects()%0A%0A%0Adef main():%0A    result = find_nested_projects()%0A    print('Number of nested projects: %7B0%7D'.format(len(results)))%0A%0Aif __name__ == '__main__':%0A    main()%0A

Add script to get nested projects