Example #1
0
    def test_get_entity_list_for_one_entity(self):
        entity_parent1 = StructureFactory(acronym='P1')

        entity_child1 = StructureFactory(acronym='C1', part_of=entity_parent1)
        StructureFactory(acronym='C11', part_of=entity_child1)

        entity_child2 = StructureFactory(acronym='C2', part_of=entity_parent1)
        StructureFactory(acronym='C21', part_of=entity_child2)
        StructureFactory(acronym='C22', part_of=entity_child2)

        self.assertEqual(
            len(
                pgm_manager_administration.get_entity_list(
                    entity_child1.id, None)), 1)
        self.assertIsNone(pgm_manager_administration.get_entity_list(5, None))
    def test_get_entity_list_for_one_entity(self):
        entity_parent1 = StructureFactory(acronym='P1')

        entity_child1 = StructureFactory(acronym='C1', part_of=entity_parent1)
        StructureFactory(acronym='C11', part_of=entity_child1)

        entity_child2 = StructureFactory(acronym='C2', part_of=entity_parent1)
        StructureFactory(acronym='C21', part_of=entity_child2)
        StructureFactory(acronym='C22', part_of=entity_child2)

        self.assertEqual(len(pgm_manager_administration.get_entity_list(entity_child1.id, None)), 1)
    def test_get_entity_list_for_entity_hierarchy(self):
        entity_parent1 = StructureFactory(acronym='P1')

        entity_child1 = StructureFactory(acronym='C1', part_of=entity_parent1)
        StructureFactory(acronym='C11', part_of=entity_child1)

        entity_child2 = StructureFactory(acronym='P2', part_of=entity_parent1)
        StructureFactory(acronym='P21', part_of=entity_child2)
        StructureFactory(acronym='P22', part_of=entity_child2)

        self.assertEqual(len(pgm_manager_administration.get_entity_list(None, entity_parent1)), 6)
    def test_get_entity_list_for_entity_hierarchy(self):
        entity_parent1 = StructureFactory(acronym='P1')

        entity_child1 = StructureFactory(acronym='C1', part_of=entity_parent1)
        StructureFactory(acronym='C11', part_of=entity_child1)

        entity_child2 = StructureFactory(acronym='P2', part_of=entity_parent1)
        StructureFactory(acronym='P21', part_of=entity_child2)
        StructureFactory(acronym='P22', part_of=entity_child2)

        self.assertEqual(len(pgm_manager_administration.get_entity_list(None, entity_parent1)), 6)