コード例 #1
0
 def setUp(self):
     self.client = Client()
     self.request = self.client.post('/assistants/manager/mandates/upload/')
     self.request._messages = FakeMessages()
     self.manager = ManagerFactory()
     self.client.force_login(self.manager.person.user)
     self.request.user = self.manager.person.user
     now = timezone.now()
     AcademicYearFactory.produce_in_past()
     self.previous_academic_year = academic_year.find_academic_year_by_year(now.year - 2)
     self.person1 = PersonFactory(global_id='00201968')
     self.assistant1 = AcademicAssistantFactory(person=self.person1)
     self.record1 = {
         'SECTOR': 'SST', 'LOGISTICS_ENTITY': 'None', 'FACULTY': 'SC', 'SCHOOL': 'CHIM', 'INSTITUTE': 'IMCN',
         'POLE': 'MOST', 'SAP_ID': '1122199', 'GLOBAL_ID': '1122199', 'LAST_NAME': self.assistant1.person.last_name,
         'FIRST_NAME': self.assistant1.person.first_name, 'FULLTIME_EQUIVALENT': '1', 'ENTRY_DATE': '01/02/2015',
         'END_DATE': '03-10-2017', 'ASSISTANT_TYPE_CODE': 'ST', 'SCALE': '021', 'CONTRACT_DURATION': '4',
         'CONTRACT_DURATION_FTE': '4', 'RENEWAL_TYPE': 'NORMAL', 'ABSENCES': None, 'COMMENT': None,
         'OTHER_STATUS': None, 'EMAIL': None, 'FGS': '00201968'
     }
     self.person2 = PersonFactory(global_id='00201979')
     self.assistant2 = AcademicAssistantFactory()
     self.record2 = {
         'SECTOR': 'SST', 'LOGISTICS_ENTITY': 'None', 'FACULTY': 'SC', 'SCHOOL': 'CHIM', 'INSTITUTE': 'IMCN',
         'POLE': 'MOST', 'SAP_ID': '1122199', 'GLOBAL_ID': '1122199', 'LAST_NAME': self.person2.last_name,
         'FIRST_NAME': self.person2.first_name, 'FULLTIME_EQUIVALENT': '1', 'ENTRY_DATE': '01/02/2015',
         'END_DATE': '03-10-2017', 'ASSISTANT_TYPE_CODE': 'AS', 'SCALE': '021', 'CONTRACT_DURATION': '4',
         'CONTRACT_DURATION_FTE': '4', 'RENEWAL_TYPE': 'exceptional', 'ABSENCES': None, 'COMMENT': None,
         'OTHER_STATUS': None, 'EMAIL': None, 'FGS': '00201979'
     }
     self.assistant3 = AcademicAssistantFactory()
     self.record3 = {
         'SECTOR': 'SST', 'LOGISTICS_ENTITY': 'None', 'FACULTY': 'SC', 'SCHOOL': 'CHIM', 'INSTITUTE': 'IMCN',
         'POLE': 'MOST', 'SAP_ID': '1122599', 'GLOBAL_ID': '1322199', 'LAST_NAME': 'last_name',
         'FIRST_NAME': 'first_name', 'FULLTIME_EQUIVALENT': '1', 'ENTRY_DATE': '01/02/2015',
         'END_DATE': '03-10-2017', 'ASSISTANT_TYPE_CODE': 'AS', 'SCALE': '021', 'CONTRACT_DURATION': '4',
         'CONTRACT_DURATION_FTE': '4', 'RENEWAL_TYPE': 'SPECIAL', 'ABSENCES': None, 'COMMENT': None,
         'OTHER_STATUS': None, 'EMAIL': None, 'FGS': None
     }
     self.entity_version1 = EntityVersionFactory(entity_type=entity_type.SECTOR,
                                                 acronym='SST',
                                                 title='Secteur des Sciences et Technologies',
                                                 end_date=datetime.datetime(datetime.date.today().year + 1, 9, 14))
     self.entity_version2 = EntityVersionFactory(entity_type=entity_type.SECTOR,
                                                 acronym='SSH',
                                                 end_date=datetime.datetime(datetime.date.today().year + 1, 9, 14))
     self.assistant_mandate1 = AssistantMandateFactory(
         assistant=self.assistant1
     )
コード例 #2
0
    def setUp(self):

        self.factory = RequestFactory()
        self.client = Client()
        self.settings = SettingsFactory()
        today = datetime.date.today()
        self.current_academic_year = AcademicYearFactory(start_date=today,
                                                         end_date=today.replace(year=today.year + 1),
                                                         year=today.year)
        self.current_academic_year.save()
        self.phd_supervisor = PersonFactory()
        self.assistant = AcademicAssistantFactory(supervisor=self.phd_supervisor)

        self.assistant_mandate = AssistantMandateFactory(
            academic_year=self.current_academic_year,
            assistant=self.assistant,
            state=assistant_mandate_state.RESEARCH
        )
        self.assistant_mandate2 = AssistantMandateFactory(
            academic_year=self.current_academic_year,
            assistant=self.assistant,
            state=assistant_mandate_state.RESEARCH
        )
        self.phd_supervisor_review = ReviewFactory(
            reviewer=None,
            mandate=self.assistant_mandate,
            status=review_status.DONE
        )
        self.entity_version = EntityVersionFactory(entity_type=entity_type.INSTITUTE)
        self.entity_mandate = MandateEntityFactory(assistant_mandate=self.assistant_mandate,
                                                   entity=self.entity_version.entity)
        self.entity_mandate2 = MandateEntityFactory(
            assistant_mandate=self.assistant_mandate2,
            entity=self.entity_version.entity
        )
        self.reviewer = ReviewerFactory(role=reviewer_role.RESEARCH,
                                        entity=self.entity_version.entity)
        self.review = ReviewFactory(reviewer=self.reviewer, mandate=self.assistant_mandate,
                                    status=review_status.IN_PROGRESS)
        self.entity_version2 = EntityVersionFactory(entity_type=entity_type.FACULTY)
        self.entity_mandate2 = MandateEntityFactory(
            assistant_mandate=self.assistant_mandate,
            entity=self.entity_version2.entity
        )
        self.reviewer2 = ReviewerFactory(
            role=reviewer_role.SUPERVISION,
            entity=self.entity_version2.entity
        )
        self.entity_version3 = EntityVersionFactory(entity_type=entity_type.SECTOR)
        self.entity_mandate3 = MandateEntityFactory(
            assistant_mandate=self.assistant_mandate,
            entity=self.entity_version3.entity
        )
        self.reviewer3 = ReviewerFactory(
            role=reviewer_role.VICE_RECTOR,
            entity=self.entity_version3.entity
        )
コード例 #3
0
    def setUpTestData(cls):
        ProgramManagerGroupFactory()

        cls.user = SuperUserFactory()
        cls.person = PersonFactory()

        cls.structure_parent1 = StructureFactory(acronym='SSH')

        cls.structure_child1 = StructureFactory(acronym='TECO', part_of=cls.structure_parent1)
        cls.structure_child11 = StructureFactory(acronym='TEBI', part_of=cls.structure_child1)

        cls.structure_child2 = StructureFactory(acronym='ESPO', part_of=cls.structure_parent1)
        cls.structure_child21 = StructureFactory(acronym='ECON', part_of=cls.structure_child2)
        cls.structure_child22 = StructureFactory(acronym='COMU', part_of=cls.structure_child2)
        EntityManagerFactory(person__user=cls.user, structure=cls.structure_parent1)

        cls.academic_year_previous, cls.academic_year_current = AcademicYearFactory.produce_in_past(quantity=2)
コード例 #4
0
    def setUpTestData(cls):
        cls.user = UserFactory()
        cls.user_adri = UserFactory()
        entity_version = EntityVersionFactory(acronym='ADRI')
        PartnershipEntityManagerFactory(entity=entity_version.entity, person__user=cls.user_adri)

        cls.academic_year = AcademicYearFactory.produce_in_future(quantity=3)[-1]
        PartnershipConfiguration.objects.create(
            partnership_creation_update_min_year=cls.academic_year,
        )

        cls.url = resolve_url('partnerships:financings:list')
        cls.create_url = resolve_url('partnerships:financings:add', model='source')
        source = FundingSourceFactory(name="Bar")
        cls.edit_url = resolve_url(
            'partnerships:financings:edit', model=source, pk=source.pk
        )
        cls.delete_url = resolve_url(
            'partnerships:financings:delete', model=source, pk=source.pk
        )
コード例 #5
0
    def setUp(self):
        self.country = CountryFactory()
        self.academic_yr = AcademicYearFactory(year=timezone.now().year)
        self.start_date = self.academic_yr.start_date
        self.end_date = self.academic_yr.end_date

        self.list_learning_unit_container_year = self._create_list_containers(
            4)
        self.list_learning_unit_year = self._create_list_learning_units_from_containers(
            self.list_learning_unit_container_year)
        self.list_entity_version = self._create_list_entities_version()
        self.list_entity_container_year = self._create_list_entity_container_years(
            self.list_entity_version, self.list_learning_unit_container_year)
        self.tutor = TutorFactory()
        self.attribution = AttributionNewFactory(tutor=self.tutor)
        self.learning_unit_component = LearningUnitComponentFactory(
            learning_unit_year=self.list_learning_unit_year[0])
        self.attribution_charge_new = \
            AttributionChargeNewFactory(attribution=self.attribution,
                                        learning_component_year=self.learning_unit_component.learning_component_year)
コード例 #6
0
    def setUpTestData(cls):
        cls.language = settings.LANGUAGE_CODE_EN
        cls.anac = AcademicYearFactory()
        common_ba = EducationGroupYearCommonBachelorFactory(academic_year=cls.anac)
        common_m = EducationGroupYearCommonMasterFactory(academic_year=cls.anac)
        common_mc = EducationGroupYearCommonSpecializedMasterFactory(academic_year=cls.anac)
        common_2a = EducationGroupYearCommonAgregationFactory(academic_year=cls.anac)
        cls.common_egy = [common_ba, common_m, common_mc, common_2a]
        cls.data = {}
        for egy in cls.common_egy:
            ac = AdmissionConditionFactory(education_group_year=egy)
            relevant_attr = general_information_sections.COMMON_TYPE_ADMISSION_CONDITIONS[
                egy.education_group_type.name
            ]
            cls.data[egy.acronym] = {
                field: getattr(ac, 'text_{}{}'.format(field, '_en')) or None
                for field in relevant_attr
            }

        cls.serializer = CommonAdmissionConditionSerializer(cls.data, context={'language': cls.language})
コード例 #7
0
    def setUp(self):
        self.academic_year = AcademicYearFactory(year=2017)
        external_id = tutor_application_epc.LEARNING_CONTAINER_YEAR_PREFIX_EXTERNAL_ID + '35654987_2017'
        self.lbir1200 = LearningContainerYearFactory(academic_year=self.academic_year, acronym="LBIR1200",
                                                     external_id=external_id)
        self.lagro2630 = LearningContainerYearFactory(academic_year=self.academic_year, acronym="LAGRO2630")

        # Creation Person/Tutor
        Group.objects.create(name="tutors")
        person = PersonFactory(global_id="98363454")
        external_id = tutor_application_epc.TUTOR_PREFIX_EXTERNAL_ID + '2089590559'
        self.tutor = TutorFactory(external_id=external_id, person=person)

        # Create two tutor applications
        applications = [_get_application_example(self.lbir1200, '30.5', '40.5'),
                        _get_application_example(self.lagro2630, '12.5', '0')]
        self.attribution = AttributionNewFactory(
            global_id=person.global_id,
            applications=applications
        )
コード例 #8
0
    def test_load_admission_conditions_common(self):
        item = {
            "year": 2018,
            "2m.alert_message": "Test",
            "2m.introduction": "IntroTest"
        }
        self.command.json_content = item
        academic_year = AcademicYearFactory(year=2018)
        education_group_year_common = EducationGroupYearFactory(
            academic_year=academic_year, acronym='common-2m')
        self.command.load_admission_conditions_common()

        common = EducationGroupYear.objects.filter(
            academic_year=education_group_year_common.academic_year,
            acronym='common-2m').first()

        admission_condition = AdmissionCondition.objects.get(
            education_group_year=common)
        self.assertEqual(admission_condition.text_alert_message,
                         item['2m.alert_message'])
コード例 #9
0
    def setUpTestData(cls):
        cls.settings = SettingsFactory()
        today = datetime.date.today()
        cls.current_academic_year = AcademicYearFactory(start_date=today,
                                                        end_date=today.replace(year=today.year + 1),
                                                        year=today.year)
        cls.phd_supervisor = PersonFactory()
        cls.assistant = AcademicAssistantFactory(supervisor=cls.phd_supervisor)
        cls.assistant_mandate = AssistantMandateFactory(academic_year=cls.current_academic_year,
                                                        assistant=cls.assistant)
        cls.assistant_mandate.state = assistant_mandate_state.PHD_SUPERVISOR
        cls.assistant_mandate.save()
        cls.review = ReviewFactory(reviewer=None, mandate=cls.assistant_mandate,
                                   status=review_status.IN_PROGRESS)
        cls.entity = EntityFactory()
        cls.entity_version = EntityVersionFactory(entity=cls.entity, entity_type=entity_type.INSTITUTE)
        cls.mandate_entity = MandateEntityFactory(assistant_mandate=cls.assistant_mandate, entity=cls.entity)

        cls.reviewer = ReviewerFactory(role=reviewer_role.RESEARCH,
                                       entity=cls.entity_version.entity)
コード例 #10
0
 def setUpTestData(cls):
     cls.academic_year = AcademicYearFactory(year=2018)
     cls.education_group = EducationGroupFactory()
     EducationGroupYearFactory(
         education_group=cls.education_group,
         academic_year=cls.academic_year
     )
     cls.formation = ContinuingEducationTrainingFactory(
         education_group=cls.education_group
     )
     group = GroupFactory(name='continuing_education_managers')
     cls.manager = PersonWithPermissionsFactory('view_admission', 'change_admission')
     cls.manager.user.groups.add(group)
     cls.admission = AdmissionFactory(
         formation=cls.formation,
         state=SUBMITTED
     )
     cls.admission_file = AdmissionFileFactory(
         admission=cls.admission
     )
コード例 #11
0
ファイル: test_attach.py プロジェクト: allouchmed/osis
    def setUpTestData(cls):
        cls.academic_year = AcademicYearFactory()
        cls.master_120 = TrainingFactory(
            education_group_type__name=TrainingType.PGRM_MASTER_120.name,
            education_group__end_year=None,
            academic_year=cls.academic_year
        )

        cls.option_in_parent = MiniTrainingFactory(education_group_type__name=MiniTrainingType.OPTION.name,
                                                   academic_year=cls.academic_year)
        GroupElementYearFactory(parent=cls.master_120, child_branch=cls.option_in_parent)

        # Create finality and attach some options
        cls.finality_group = GroupFactory(education_group_type__name=GroupType.FINALITY_120_LIST_CHOICE.name,
                                          academic_year=cls.academic_year)
        GroupElementYearFactory(parent=cls.master_120, child_branch=cls.finality_group)

        cls.master_120_specialized = TrainingFactory(education_group_type__name=TrainingType.MASTER_MS_120.name,
                                                     academic_year=cls.academic_year)
        GroupElementYearFactory(parent=cls.finality_group, child_branch=cls.master_120_specialized)
コード例 #12
0
    def setUpTestData(cls):
        cls.student = PersonWithPermissionsFactory('view_admission', 'change_received_file_state',
                                                   groups=[STUDENT_WORKERS_GROUP])
        cls.admission = AdmissionFactory()

        cls.academic_year = AcademicYearFactory(year=2018)
        cls.education_group = EducationGroupFactory()
        EducationGroupYearFactory(
            education_group=cls.education_group,
            academic_year=cls.academic_year,
        )
        cls.formation = ContinuingEducationTrainingFactory(
            education_group=cls.education_group,
            active=True
        )
        cls.training_manager = PersonWithPermissionsFactory(
            'view_admission',
            'change_admission',
            employee=True, groups=['continuing_education_training_managers']
        )
コード例 #13
0
    def setUp(self):
        academic_year = AcademicYearFactory(year=2020)
        self.education_group_year = TrainingFactory(
            academic_year=academic_year)
        self.person = CentralManagerFactory("delete_educationgroup",
                                            "change_educationgroup",
                                            "add_educationgroup")
        PersonEntityFactory(person=self.person,
                            entity=self.education_group_year.management_entity)

        self.url = reverse(
            'delete_education_group',
            args=[self.education_group_year.id, self.education_group_year.id])
        self.client.force_login(user=self.person.user)
        self.request = RequestFactory().get("")
        self.context = {
            "person": self.person,
            "education_group_year": self.education_group_year,
            "request": self.request
        }
コード例 #14
0
ファイル: test_training.py プロジェクト: allouchmed/osis
 def setUpTestData(cls):
     cls.academic_year = AcademicYearFactory(year=2018)
     cls.entity_version = EntityVersionFactory(
         entity__organization__type=organization_type.MAIN
     )
     cls.training = TrainingFactory(
         acronym='BIR1BA',
         partial_acronym='LBIR1000I',
         academic_year=cls.academic_year,
         management_entity=cls.entity_version.entity,
         administration_entity=cls.entity_version.entity,
     )
     url = reverse('education_group_api_v1:training_read', kwargs={
         'acronym': cls.training.acronym,
         'year': cls.academic_year.year
     })
     cls.serializer = TrainingDetailSerializer(cls.training, context={
         'request': RequestFactory().get(url),
         'language': settings.LANGUAGE_CODE_EN
     })
コード例 #15
0
ファイル: test_build_tree.py プロジェクト: aelwhishi/osis
 def setUp(self):
     self.academic_year = AcademicYearFactory()
     self.parent = EducationGroupYearFactory(academic_year=self.academic_year)
     self.group_element_year_1 = GroupElementYearFactory(
         parent=self.parent,
         child_branch=EducationGroupYearFactory(academic_year=self.academic_year)
     )
     self.group_element_year_1_1 = GroupElementYearFactory(
         parent=self.group_element_year_1.child_branch,
         child_branch=EducationGroupYearFactory(academic_year=self.academic_year)
     )
     self.group_element_year_2 = GroupElementYearFactory(
         parent=self.parent,
         child_branch=EducationGroupYearFactory(academic_year=self.academic_year)
     )
     self.group_element_year_2_1 = GroupElementYearFactory(
         parent=self.group_element_year_2.child_branch,
         child_branch=None,
         child_leaf=LearningUnitYearFactory()
     )
コード例 #16
0
    def setUp(self):
        yr = timezone.now().year
        self.entity_1 = EntityFactory()
        EntityVersionFactory(entity=self.entity_1)
        self.an_academic_year = AcademicYearFactory(year=yr)
        self.an_acronym = "LBIO1212"

        self.learning_container_yr = LearningContainerYearFactory(
            academic_year=self.an_academic_year,
            requirement_entity=self.entity_1,
        )
        a_learning_unit_year = LearningUnitYearFactory(
            acronym=self.an_acronym,
            academic_year=self.an_academic_year,
            learning_container_year=self.learning_container_yr)
        self.a_proposal_learning_unit = ProposalLearningUnitFactory(
            learning_unit_year=a_learning_unit_year,
            type=proposal_type.ProposalType.CREATION,
            state=proposal_state.ProposalState.CENTRAL,
            entity=self.entity_1)
コード例 #17
0
    def test_extends_only_components_of_learning_unit_year(self):
        # Creating partim with components for the same learningContainerYear
        _create_learning_unit_year_with_components(
            self.learning_container_year,
            create_lecturing_component=True,
            create_pratical_component=True,
            subtype=learning_unit_year_subtypes.PARTIM)

        inital_components_count = LearningComponentYear.objects.all().count()
        number_of_components = LearningComponentYear.objects.filter(
            learning_unit_year=self.learning_unit_year).count()
        expected_count = inital_components_count + number_of_components
        next_year = self.academic_year.year + 1

        business_edition.duplicate_learning_unit_year(
            self.learning_unit_year, AcademicYearFactory(year=next_year))

        # assert components of partims are not duplicated too
        self.assertEqual(LearningComponentYear.objects.all().count(),
                         expected_count)
コード例 #18
0
    def setUpTestData(cls):
        cls.academic_year = AcademicYearFactory()
        cls.education_group_year_parents = [TrainingFactory(academic_year=cls.academic_year) for _ in range(0,2)]
        cls.learning_unit_year_child = LearningUnitYearFakerFactory(
            learning_container_year__academic_year=cls.academic_year
        )
        cls.group_element_years = [
            GroupElementYearFactory(parent=cls.education_group_year_parents[i],
                                    child_leaf=cls.learning_unit_year_child,
                                    child_branch=None)
            for i in range(0, 2)
        ]

        cls.prerequisite = PrerequisiteFactory(
            learning_unit_year = cls.learning_unit_year_child,
            education_group_year = cls.education_group_year_parents[0]
        )
        cls.person = PersonWithPermissionsFactory("can_access_education_group")
        cls.url = reverse("learning_unit_prerequisite",
                          args=[cls.education_group_year_parents[0].id, cls.learning_unit_year_child.id])
コード例 #19
0
    def test_get_acronym_as_href(self):
        current_academic_yr = create_current_academic_year()

        learning_unit_yr = LearningUnitYearFactory(academic_year=current_academic_yr)
        learning_unit_yr_prerequisite = LearningUnitYearFactory(academic_year=current_academic_yr)

        prerequisite_item = PrerequisiteItemFactory(
            prerequisite=PrerequisiteFactory(learning_unit_year=learning_unit_yr),
            learning_unit=learning_unit_yr_prerequisite.learning_unit
        )

        previous_academic_yr = AcademicYearFactory(year=current_academic_yr.year - 1)
        self.assertEqual(
            base.templatetags.prerequisite._get_acronym_as_href({}, prerequisite_item, previous_academic_yr),
            '')

        self.assertEqual(
            base.templatetags.prerequisite._get_acronym_as_href({}, prerequisite_item, current_academic_yr),
            _get_acronym_as_href(learning_unit_yr_prerequisite)
        )
コード例 #20
0
    def setUp(self):
        self.person = PersonFactory()
        self.user = self.person.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
        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.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.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)
コード例 #21
0
    def setUp(self):

        self.title_acronym_12 = 'Acronym 12'
        self.continuing_education_group_type = EducationGroupTypeFactory(
            name=random.choice(CONTINUING_EDUCATION_TRAINING_TYPES))

        self.academic_year = AcademicYearFactory(year=2018)
        self.entity_version = create_entity_version("ENTITY_PREV")
        entity_version_2 = create_entity_version("FAC2")

        self.iufc_education_group_yr_ACRO_10 = EducationGroupYearFactory(
            acronym="ACRO_10",
            education_group_type=self.continuing_education_group_type,
            title='Acronym 10',
            management_entity=self.entity_version.entity,
            academic_year=self.academic_year)
        self.iufc_education_group_yr_ACRO_12 = EducationGroupYearFactory(
            acronym="ACRO_12",
            education_group_type=self.continuing_education_group_type,
            title=self.title_acronym_12,
            management_entity=entity_version_2.entity,
            academic_year=self.academic_year)

        education_group_not_organized = EducationGroupFactory()
        self.education_group_yr_not_organized = EducationGroupYearFactory(
            acronym="CODE_12",
            education_group_type=self.continuing_education_group_type,
            title="Other title",
            management_entity=self.entity_version.entity,
            education_group=education_group_not_organized,
            academic_year=self.academic_year)
        self.active_continuing_education_training = ContinuingEducationTrainingFactory(
            education_group=self.iufc_education_group_yr_ACRO_10.
            education_group,
            active=True,
        )
        self.inactive_continuing_education_training = ContinuingEducationTrainingFactory(
            education_group=self.iufc_education_group_yr_ACRO_12.
            education_group,
            active=False,
        )
    def test_formation_administrators(self):
        academic_year = AcademicYearFactory(year=2018)
        EducationGroupYearFactory(
            education_group=self.education_group,
            academic_year=academic_year,
        )
        a_training = ContinuingEducationTraining(
            education_group=self.education_group)
        a_training.save()
        person_1 = PersonFactory(first_name="Louis", last_name="Lesquoy")
        person_2 = PersonFactory(first_name="Arnaud", last_name="Jadoulle")

        PersonTrainingFactory(person=person_1, training=a_training)
        PersonTrainingFactory(person=person_2, training=a_training)

        self.assertEqual(
            a_training.formation_administrators,
            "{}, {} - {}, {}".format(person_2.last_name.upper(),
                                     person_2.first_name,
                                     person_1.last_name.upper(),
                                     person_1.first_name))
コード例 #23
0
    def setUpTestData(cls):
        cls.url = reverse('partnerships:autocomplete:partnership_year_offers')

        academic_year = AcademicYearFactory.produce_in_future(quantity=3)[-1]
        PartnershipConfiguration.objects.create(
            partnership_creation_update_min_year=academic_year,
        )

        # university_offer
        cls.university_offer = EducationGroupYearFactory(
            joint_diploma=True,
            academic_year=academic_year
        )

        # education_level
        cls.education_level = PartnershipYearEducationLevelFactory()
        cls.education_level.education_group_types.add(
            cls.university_offer.education_group_type
        )

        cls.user = PartnershipEntityManagerFactory().person.user
コード例 #24
0
    def test_find_by_parent(self):
        academic_year = AcademicYearFactory()

        education_group_year_parent = EducationGroupYearFactory(
            academic_year=academic_year)

        education_group_branch_1 = EducationGroupYearFactory(
            academic_year=academic_year)
        education_group_brancg_2 = EducationGroupYearFactory(
            academic_year=academic_year)

        group_element_year_1 = GroupElementYearFactory(
            parent=education_group_year_parent,
            child_branch=education_group_branch_1)
        group_element_year_2 = GroupElementYearFactory(
            parent=education_group_year_parent,
            child_branch=education_group_brancg_2)

        self.assertCountEqual(
            group_element_year.find_by_parent(education_group_year_parent),
            [group_element_year_1, group_element_year_2])
コード例 #25
0
ファイル: test_perms.py プロジェクト: allouchmed/osis
    def setUpTestData(cls):
        cls.learning_unit = LearningUnitFactory()
        cls.current_academic_year = create_current_academic_year()
        cls.next_academic_yr = AcademicYearFactory(
            year=cls.current_academic_year.year + 1)
        academic_years = [cls.current_academic_year, cls.next_academic_yr]
        cls.lcy = LearningContainerYearFactory(
            academic_year=cls.current_academic_year,
            container_type=learning_container_year_types.COURSE,
            requirement_entity=EntityVersionFactory().entity)
        cls.central_manager = CentralManagerFactory(
            'can_edit_learningunit_pedagogy')
        cls.luy = LearningUnitYearFactory(
            learning_unit=cls.learning_unit,
            academic_year=cls.current_academic_year,
            learning_container_year=cls.lcy,
        )
        cls.central_manager.linked_entities = [cls.lcy.requirement_entity.id]

        generate_creation_or_end_date_proposal_calendars(academic_years)
        generate_modification_transformation_proposal_calendars(academic_years)
コード例 #26
0
 def test_with_filters_case_direct_parent_academic_year_is_different(
         self):
     current_academic_year = create_current_academic_year()
     root_group_type = EducationGroupTypeFactory(
         name='Bachelor', category=education_group_categories.TRAINING)
     self.root = EducationGroupYearFactory(
         academic_year=current_academic_year,
         education_group_type=root_group_type)
     child_branch = EducationGroupYearFactory(
         academic_year=AcademicYearFactory(
             year=current_academic_year.year - 1),
         education_group_type=EducationGroupTypeFactory(
             category=education_group_categories.GROUP))
     GroupElementYearFactory(parent=self.root,
                             child_branch=child_branch)
     GroupElementYearFactory(parent=child_branch,
                             child_branch=None,
                             child_leaf=self.child_leaf)
     result = group_element_year._find_related_formations(
         [self.child_leaf], self.filters)
     self.assertEqual(result[self.child_leaf.id], [self.root.id])
コード例 #27
0
ファイル: test_read.py プロジェクト: aelwhishi/osis
 def setUpTestData(cls):
     cls.academic_year = AcademicYearFactory()
     cls.education_group_year = EducationGroupYearFactory(
         academic_year=cls.academic_year)
     cls.group_element_year = GroupElementYearFactory(
         parent=cls.education_group_year,
         child_branch__academic_year=cls.academic_year)
     cls.person = CentralManagerFactory()
     cls.person.user.user_permissions.add(
         Permission.objects.get(codename="can_access_education_group"))
     cls.url = reverse("group_content",
                       kwargs={
                           "root_id":
                           cls.education_group_year.id,
                           "education_group_year_id":
                           cls.education_group_year.id
                       })
     cls.post_valid_data = {
         'action': 'Generate pdf',
         'language': LANGUAGE_CODE_EN
     }
コード例 #28
0
    def setUpTestData(cls):
        cls.nb_session = number_session.ONE
        current_year = datetime.now().year
        current_date = datetime(year=current_year, month=9, day=1, hour=12)
        cls.academic_year = AcademicYearFactory(year=current_year,
                                                start_date=current_date,
                                                end_date=current_date + timedelta(days=365))

        cls.off_year = OfferYearFactory()
        cls.education_group_year = EducationGroupYearFactory()
        cls.academic_calendar_deliberation = AcademicCalendarFactory(
            academic_year=cls.academic_year,
            reference=academic_calendar_type.DELIBERATION,
            start_date=cls.academic_year.start_date,
            end_date=cls.academic_year.end_date,
        )

        SessionExamCalendarFactory(
            academic_calendar=cls.academic_calendar_deliberation,
            number_session=cls.nb_session,
        )
コード例 #29
0
    def test_update_luy_in_past(self, mock_baseform_save):
        """ Check if there is no postponement when the learning_unit_year is in the past """

        self.learning_unit_year_full.academic_year = AcademicYearFactory(
            year=2010)
        self.learning_unit_year_full.save()
        instance_luy_base_form = _instantiate_base_learning_unit_form(
            self.learning_unit_year_full, self.person)
        form = _instanciate_postponement_form(
            self.person,
            self.learning_unit_year_full.academic_year,
            learning_unit_instance=instance_luy_base_form.
            learning_unit_instance,
            data=instance_luy_base_form.data)
        self.assertEqual(len(form._forms_to_upsert), 1)
        self.assertEqual(form._forms_to_upsert[0].instance.learning_unit,
                         self.learning_unit_year_full.learning_unit)
        self.assertEqual(len(form._forms_to_delete), 0)

        form.save()
        self.assertEqual(mock_baseform_save.call_count, 1)
コード例 #30
0
    def test_find_parent_faculty_version_no_parent(self):
        start_date = datetime.datetime(now.year - 1, now.month, 16)
        end_date = datetime.datetime(now.year, now.month, 27)

        ac_yr = AcademicYearFactory(
            year=(now.year - 1),
            start_date=datetime.datetime(now.year - 1, now.month, 15),
            end_date=datetime.datetime(now.year, now.month, 28))
        entity_school_no_parent = EntityFactory(country=self.country,
                                                organization=self.organization)
        entity_school_version_no_parent = EntityVersionFactory(
            entity=entity_school_no_parent,
            acronym="ENTITY_LEVEL2",
            title="This is the entity version level 2",
            entity_type="SCHOOL",
            parent=None,
            start_date=start_date,
            end_date=end_date)

        self.assertIsNone(
            entity_school_version_no_parent.find_faculty_version(ac_yr))
コード例 #31
0
    def create_learning_unit_years_and_dependencies(self):
        l1 = LearningUnitFactory(start_year=2015)

        learning_unit_years = []
        for year in range(4):
            ac_year = AcademicYearFactory(year=2000 + year)
            l_containeryear = LearningContainerYearFactory(academic_year=ac_year)
            EntityContainerYearFactory(learning_container_year=l_containeryear, entity=self.entity_version.entity,
                                       type=entity_container_year_link_type.REQUIREMENT_ENTITY)
            learning_unit_year = LearningUnitYearFactory(learning_unit=l1, academic_year=ac_year,
                                                         learning_container_year=l_containeryear)
            learning_unit_years.append(learning_unit_year)

        learning_unit_years[1].subtype = learning_unit_year_subtypes.FULL
        learning_unit_years[1].save()
        lcomponent = LearningComponentYearFactory()
        LearningClassYearFactory(learning_component_year=lcomponent)
        LearningClassYearFactory(learning_component_year=lcomponent)
        LearningUnitComponentFactory(learning_unit_year=learning_unit_years[1],
                                     learning_component_year=lcomponent)
        return learning_unit_years
コード例 #32
0
 def setUpTestData(cls):
     cls.academic_year = AcademicYearFactory()
     cls.education_group_year = EducationGroupYearFactory(
         academic_year=cls.academic_year)
     cls.luy = LearningUnitYearFactory()
     cls.group_element_year_root = GroupElementYearFactory(
         parent__academic_year=cls.academic_year,
         child_branch=cls.education_group_year)
     cls.group_element_year = GroupElementYearFactory(
         parent=cls.education_group_year,
         child_branch=None,
         child_leaf=cls.luy)
     cls.person = CentralManagerFactory()
     cls.person.user.user_permissions.add(
         Permission.objects.get(codename="can_access_education_group"))
     cls.url = reverse("group_element_year_delete",
                       args=[
                           cls.education_group_year.id,
                           cls.education_group_year.id,
                           cls.group_element_year.id
                       ])
コード例 #33
0
    def setUp(self):
        self.academic_year = AcademicYearFactory(
            year=datetime.date.today().year)
        self.academic_calendar = AcademicCalendarFactory.build(
            title="Submission of score encoding - 1",
            start_date=self.academic_year.start_date,
            end_date=self.academic_year.end_date,
            academic_year=self.academic_year,
            reference=academic_calendar_type.SCORES_EXAM_SUBMISSION)
        self.academic_calendar.save(functions=[])
        SessionExamCalendarFactory(academic_calendar=self.academic_calendar,
                                   number_session=number_session.ONE)
        # Offer year CHIM1BA
        self.offer_year = OfferYearFactory(acronym="CHIM1BA",
                                           academic_year=self.academic_year)
        self.learning_unit_year = LearningUnitYearFactory(
            acronym="LBIR1210", academic_year=self.academic_year)
        self._create_context_exam_enrollments(self.learning_unit_year,
                                              self.offer_year, 10, 3)
        self.learning_unit_year_2 = LearningUnitYearFactory(
            acronym="LBIR1211", academic_year=self.academic_year)
        self._create_context_exam_enrollments(self.learning_unit_year_2,
                                              self.offer_year, 5)

        # Offer year DIR2BA
        self.offer_year_2 = OfferYearFactory(acronym="DIR2BA",
                                             academic_year=self.academic_year)
        self._create_context_exam_enrollments(self.learning_unit_year,
                                              self.offer_year_2, 8, 5)
        self.program_manager = ProgramManagerFactory(
            offer_year=self.offer_year)
        ProgramManagerFactory(offer_year=self.offer_year_2,
                              person=self.program_manager.person)
        # Tutor [Tom Dupont] have an attribution to LBIR1210
        person = PersonFactory(last_name="Dupont", first_name="Thierry")
        self.tutor = TutorFactory(person=person)
        test_attribution.create_attribution(
            tutor=self.tutor,
            learning_unit_year=self.learning_unit_year,
            score_responsible=True)
コード例 #34
0
class ReviewerReviewViewTestCase(TestCase):

    def setUp(self):

        self.factory = RequestFactory()
        self.client = Client()
        self.settings = SettingsFactory()
        today = datetime.date.today()
        self.current_academic_year = AcademicYearFactory(start_date=today,
                                                         end_date=today.replace(year=today.year + 1),
                                                         year=today.year)
        self.current_academic_year.save()
        self.phd_supervisor = PersonFactory()
        self.assistant = AcademicAssistantFactory(supervisor=self.phd_supervisor)

        self.assistant_mandate = AssistantMandateFactory(
            academic_year=self.current_academic_year,
            assistant=self.assistant,
            state=assistant_mandate_state.RESEARCH
        )
        self.assistant_mandate2 = AssistantMandateFactory(
            academic_year=self.current_academic_year,
            assistant=self.assistant,
            state=assistant_mandate_state.RESEARCH
        )
        self.phd_supervisor_review = ReviewFactory(
            reviewer=None,
            mandate=self.assistant_mandate,
            status=review_status.DONE
        )
        self.entity_version = EntityVersionFactory(entity_type=entity_type.INSTITUTE)
        self.entity_mandate = MandateEntityFactory(assistant_mandate=self.assistant_mandate,
                                                   entity=self.entity_version.entity)
        self.entity_mandate2 = MandateEntityFactory(
            assistant_mandate=self.assistant_mandate2,
            entity=self.entity_version.entity
        )
        self.reviewer = ReviewerFactory(role=reviewer_role.RESEARCH,
                                        entity=self.entity_version.entity)
        self.review = ReviewFactory(reviewer=self.reviewer, mandate=self.assistant_mandate,
                                    status=review_status.IN_PROGRESS)
        self.entity_version2 = EntityVersionFactory(entity_type=entity_type.FACULTY)
        self.entity_mandate2 = MandateEntityFactory(
            assistant_mandate=self.assistant_mandate,
            entity=self.entity_version2.entity
        )
        self.reviewer2 = ReviewerFactory(
            role=reviewer_role.SUPERVISION,
            entity=self.entity_version2.entity
        )
        self.entity_version3 = EntityVersionFactory(entity_type=entity_type.SECTOR)
        self.entity_mandate3 = MandateEntityFactory(
            assistant_mandate=self.assistant_mandate,
            entity=self.entity_version3.entity
        )
        self.reviewer3 = ReviewerFactory(
            role=reviewer_role.VICE_RECTOR,
            entity=self.entity_version3.entity
        )

    def test_pst_form_view(self):
        self.client.force_login(self.reviewer.person.user)
        response = self.client.post('/assistants/reviewer/pst_form/', {'mandate_id': self.assistant_mandate.id})
        self.assertEqual(response.status_code, HTTP_OK)

    def test_review_edit(self):
        self.client.force_login(self.reviewer.person.user)
        response = self.client.post('/assistants/reviewer/review/edit/', {'mandate_id': self.assistant_mandate2.id})
        self.assertEqual(response.status_code, HTTP_OK)

    def test_review_save(self):
        self.client.force_login(self.reviewer.person.user)
        response = self.client.post('/assistants/reviewer/review/save/', {'mandate_id': self.assistant_mandate.id,
                                                                          'review_id': self.review.id
                                                                          })
        self.assertEqual(response.status_code, HTTP_OK)

    def test_validate_review_and_update_mandate(self):
        validate_review_and_update_mandate(self.review, self.assistant_mandate)
        self.assertEqual(self.review.status, review_status.DONE)
        self.assertEqual(self.assistant_mandate.state, assistant_mandate_state.SUPERVISION)
        self.review2 = ReviewFactory(
            reviewer=self.reviewer2, mandate=self.assistant_mandate,
            status=review_status.IN_PROGRESS
        )
        validate_review_and_update_mandate(self.review2, self.assistant_mandate)
        self.assertEqual(self.review2.status, review_status.DONE)
        self.assertEqual(self.assistant_mandate.state, assistant_mandate_state.VICE_RECTOR)
        self.review3 = ReviewFactory(reviewer=self.reviewer3, mandate=self.assistant_mandate,
                                     status=review_status.IN_PROGRESS)
        validate_review_and_update_mandate(self.review3, self.assistant_mandate)
        self.assertEqual(self.review3.status, review_status.DONE)
        self.assertEqual(self.assistant_mandate.state, assistant_mandate_state.DONE)

    def test_review_view(self):
        self.client.force_login(self.reviewer.person.user)
        response = self.client.post('/assistants/reviewer/review/view/', {'mandate_id': self.assistant_mandate.id,
                                                                          'role': reviewer_role.PHD_SUPERVISOR})
        self.assertEqual(response.status_code, HTTP_OK)
        response = self.client.post('/assistants/reviewer/review/view/', {'mandate_id': self.assistant_mandate.id,
                                                                          'role': reviewer_role.RESEARCH})
        self.assertEqual(response.status_code, HTTP_OK)

    def test_generate_reviewer_menu_tabs(self):
        self.client.force_login(self.reviewer.person.user)
        self.assertEqual([{'action': 'view', 'class': '', 'item': 'PHD_SUPERVISOR'},
                          {'item': 'RESEARCH', 'class': '', 'action': 'edit'}],
                         generate_reviewer_menu_tabs(reviewer_role.RESEARCH, self.assistant_mandate, None))
        self.review.status = review_status.DONE
        self.review.save()
        self.assistant_mandate.state = assistant_mandate_state.SUPERVISION
        self.assistant_mandate.save()
        self.review2 = ReviewFactory(
            reviewer=self.reviewer2,
            mandate=self.assistant_mandate,
            status=review_status.IN_PROGRESS
        )
        self.assertEqual([{'action': 'view', 'class': '', 'item': 'PHD_SUPERVISOR'},
                          {'item': 'RESEARCH', 'class': 'active', 'action': 'view'}],
                         generate_reviewer_menu_tabs(reviewer_role.RESEARCH, self.assistant_mandate,
                                                     assistant_mandate_state.RESEARCH))
        self.assertEqual([{'action': 'view', 'class': '', 'item': 'PHD_SUPERVISOR'},
                          {'item': 'RESEARCH', 'class': '', 'action': 'view'},
                          {'item': 'SUPERVISION', 'class': '', 'action': 'edit'}],
                         generate_reviewer_menu_tabs(reviewer_role.SUPERVISION, self.assistant_mandate, None))