Esempio n. 1
0
    def setUpTestData(cls):
        group = EntityManagerGroupFactory()
        group.permissions.add(
            Permission.objects.get(codename='view_scoresresponsible'))
        group.permissions.add(
            Permission.objects.get(codename='change_scoresresponsible'))

        cls.tutor = TutorFactory()
        cls.user = cls.tutor.person.user
        cls.academic_year = AcademicYearFactory(current=True)

        # FIXME: Old structure model [To remove]
        cls.structure = structure.StructureFactory()
        cls.structure_children = structure.StructureFactory(
            part_of=cls.structure)

        # New structure model
        entities_hierarchy = create_entities_hierarchy()
        cls.root_entity = entities_hierarchy.get('root_entity')
        cls.child_one_entity = entities_hierarchy.get('child_one_entity')
        cls.child_two_entity = entities_hierarchy.get('child_two_entity')
        cls.learning_unit_yr_req_entity_acronym = entities_hierarchy.get(
            'child_one_entity_version').acronym
        cls.root_entity_acronym = entities_hierarchy.get(
            'root_entity_version').acronym

        cls.entity_manager = EntityManagerFactory(
            person=cls.tutor.person,
            structure=cls.structure,
            entity=cls.root_entity,
        )

        cls.learning_unit_year = LearningUnitYearFactory(
            academic_year=cls.academic_year,
            acronym="LBIR1210",
            structure=cls.structure,
            learning_container_year__academic_year=cls.academic_year,
            learning_container_year__acronym="LBIR1210",
            learning_container_year__requirement_entity=cls.child_one_entity,
        )

        cls.learning_unit_year_children = LearningUnitYearFactory(
            academic_year=cls.academic_year,
            acronym="LBIR1211",
            structure=cls.structure_children,
            learning_container_year__academic_year=cls.academic_year,
            learning_container_year__acronym="LBIR1211",
            learning_container_year__requirement_entity=cls.child_two_entity,
        )

        cls.attribution = AttributionFactory(
            tutor=cls.tutor,
            learning_unit_year=cls.learning_unit_year,
            score_responsible=True)
        cls.attribution_children = AttributionFactory(
            tutor=cls.tutor,
            learning_unit_year=cls.learning_unit_year_children,
            score_responsible=True)
        cls.url = reverse('scores_responsible_list')
        cls.user.groups.add(group)
Esempio n. 2
0
 def setUp(self):
     self.user = user.UserFactory()
     self.user.save()
     self.person = create_person_with_user(self.user)
     self.structure = structure.StructureFactory()
     self.structure_children = structure.StructureFactory(
         part_of=self.structure)
     self.entity_manager = entity_manager.EntityManagerFactory(
         person=self.person, structure=self.structure)
     self.tutor = tutor.TutorFactory(person=self.person)
     self.academic_year = academic_year.AcademicYearFactory(
         year=datetime.date.today().year, start_date=datetime.date.today())
     self.learning_unit_year = learning_unit_year.LearningUnitYearFactory(
         structure=self.structure,
         acronym="LBIR1210",
         academic_year=self.academic_year)
     self.learning_unit_year_children = learning_unit_year.LearningUnitYearFactory(
         structure=self.structure_children,
         acronym="LBIR1211",
         academic_year=self.academic_year)
     self.learning_unit_year_without_attribution = learning_unit_year.LearningUnitYearFactory(
         structure=self.structure,
         acronym="LBIR1212",
         academic_year=self.academic_year)
     self.attribution = create_attribution(
         tutor=self.tutor,
         learning_unit_year=self.learning_unit_year,
         score_responsible=True,
         summary_responsible=True)
     self.attribution_children = create_attribution(
         tutor=self.tutor,
         learning_unit_year=self.learning_unit_year_children,
         score_responsible=False)
    def setUp(self):
        group, created = Group.objects.get_or_create(name='entity_managers')
        content_type = ContentType.objects.get_for_model(EntityManager)
        perm, created = Permission.objects.get_or_create(codename='is_entity_manager', content_type=content_type)
        group.permissions.add(perm)
        self.person = PersonFactory()
        self.user = self.person.user
        self.tutor = TutorFactory(person=self.person)
        self.current_academic_year = create_current_academic_year()
        self.next_academic_year = AcademicYearFactory(
            year=self.current_academic_year.year + 1
        )

        # Old structure model [To remove]
        self.structure = structure.StructureFactory()
        self.structure_children = structure.StructureFactory(part_of=self.structure)

        # New structure model
        entities_hierarchy = create_entities_hierarchy()
        self.root_entity = entities_hierarchy.get('root_entity')
        self.child_one_entity = entities_hierarchy.get('child_one_entity')
        self.child_two_entity = entities_hierarchy.get('child_two_entity')

        self.entity_manager = EntityManagerFactory(
            person=self.person,
            structure=self.structure,
            entity=self.root_entity)

        # Create two learning_unit_year with context (Container + EntityContainerYear)
        self.learning_unit_year = create_learning_unit_with_context(
            academic_year=self.next_academic_year,
            structure=self.structure,
            entity=self.child_one_entity,
            acronym="LBIR1210"
        )
        self.learning_unit_year_children = create_learning_unit_with_context(
            academic_year=self.next_academic_year,
            structure=self.structure_children,
            entity=self.child_two_entity,
            acronym="LBIR1211"
        )

        self.attribution = test_attribution.create_attribution(
            tutor=self.tutor,
            learning_unit_year=self.learning_unit_year,
            summary_responsible=True)
        self.attribution_children = test_attribution.create_attribution(
            tutor=self.tutor,
            learning_unit_year=self.learning_unit_year_children,
            summary_responsible=True)
Esempio n. 4
0
    def setUpTestData(cls):
        group = EntityManagerGroupFactory()
        group.permissions.add(
            Permission.objects.get(codename='view_scoresresponsible'))
        group.permissions.add(
            Permission.objects.get(codename='change_scoresresponsible'))

        cls.person = PersonFactory()
        cls.academic_year = AcademicYearFactory(
            year=datetime.date.today().year, start_date=datetime.date.today())

        # FIXME: Old structure model [To remove]
        cls.structure = structure.StructureFactory()

        entities_hierarchy = create_entities_hierarchy()
        cls.root_entity = entities_hierarchy.get('root_entity')

        cls.entity_manager = EntityManagerFactory(
            person=cls.person,
            structure=cls.structure,
            entity=cls.root_entity,
        )
        cls.entity_manager.person.user.groups.add(group)
        cls.learning_unit_year = LearningUnitYearFactory(
            academic_year=cls.academic_year,
            acronym="LBIR1210",
            structure=cls.structure,
            learning_container_year__academic_year=cls.academic_year,
            learning_container_year__acronym="LBIR1210",
            learning_container_year__requirement_entity=cls.root_entity,
        )
Esempio n. 5
0
    def setUpTestData(cls):
        group = ProgramManagerGroupFactory()
        group.permissions.add(
            Permission.objects.get(codename='view_scoresresponsible'))
        group.permissions.add(
            Permission.objects.get(codename='change_scoresresponsible'))

        cls.academic_year = create_current_academic_year()

        # FIXME: Old structure model [To remove]
        cls.structure = structure.StructureFactory()

        entities_hierarchy = create_entities_hierarchy()
        cls.root_entity = entities_hierarchy.get('root_entity')

        cls.learning_unit_year = LearningUnitYearFactory(
            academic_year=cls.academic_year,
            acronym="LBIR1210",
            structure=cls.structure,
            learning_container_year__academic_year=cls.academic_year,
            learning_container_year__acronym="LBIR1210",
            learning_container_year__requirement_entity=cls.root_entity,
        )
        cls.education_group_year = EducationGroupYearFactory(
            academic_year=cls.academic_year,
            administration_entity=cls.root_entity)
        cls.program_manager = ProgramManagerFactory(
            education_group=cls.education_group_year.education_group)
        cls.program_manager.person.user.groups.add(group)
        offer_enrollment = OfferEnrollmentFactory(
            education_group_year=cls.education_group_year)
        LearningUnitEnrollmentFactory(
            offer_enrollment=offer_enrollment,
            learning_unit_year=cls.learning_unit_year)
Esempio n. 6
0
    def setUp(self):
        self.user = user.UserFactory()
        self.user.save()
        self.person = create_person_with_user(self.user)
        self.tutor = TutorFactory(person=self.person)
        self.academic_year = AcademicYearFactory(
            year=datetime.date.today().year, start_date=datetime.date.today())
        # Old structure model [To remove]
        self.structure = structure.StructureFactory()
        self.structure_children = structure.StructureFactory(
            part_of=self.structure)

        # New structure model
        self.create_new_entity()
        self.entity_manager = EntityManagerFactory(person=self.person,
                                                   structure=self.structure,
                                                   entity=self.root_entity)
        self.create_learning_units()
Esempio n. 7
0
    def setUp(self):
        self.person = PersonFactory()
        self.user = self.person.user
        self.tutor = TutorFactory(person=self.person)
        self.current_academic_year = create_current_academic_year()
        self.next_academic_year = AcademicYearFactory(
            year=self.current_academic_year.year + 1)

        # Old structure model [To remove]
        self.structure = structure.StructureFactory()
        self.structure_children = structure.StructureFactory(
            part_of=self.structure)

        # New structure model
        entities_hierarchy = create_entities_hierarchy()
        self.root_entity = entities_hierarchy.get('root_entity')
        self.child_one_entity = entities_hierarchy.get('child_one_entity')
        self.child_two_entity = entities_hierarchy.get('child_two_entity')

        self.entity_manager = EntityManagerFactory(person=self.person,
                                                   structure=self.structure,
                                                   entity=self.root_entity)

        # Create two learning_unit_year with context (Container + EntityContainerYear)
        self.learning_unit_year = create_learning_unit_with_context(
            academic_year=self.next_academic_year,
            structure=self.structure,
            entity=self.child_one_entity,
            acronym="LBIR1210")
        self.learning_unit_year_children = create_learning_unit_with_context(
            academic_year=self.next_academic_year,
            structure=self.structure_children,
            entity=self.child_two_entity,
            acronym="LBIR1211")

        self.attribution = test_attribution.create_attribution(
            tutor=self.tutor,
            learning_unit_year=self.learning_unit_year,
            summary_responsible=True)
        self.attribution_children = test_attribution.create_attribution(
            tutor=self.tutor,
            learning_unit_year=self.learning_unit_year_children,
            summary_responsible=True)