Example #1
0
 def setUp(self):
     self.maxDiff = None
     self.manager = AdviserManagerFactory()
     a_person_teacher = PersonFactory.create(
         first_name='Pierre',
         last_name='Dupont',
         email='*****@*****.**')
     self.teacher = AdviserTeacherFactory(person=a_person_teacher)
     a_person_teacher2 = PersonFactory.create(
         first_name='Marco',
         last_name='Millet',
         email='*****@*****.**')
     self.teacher2 = AdviserTeacherFactory(person=a_person_teacher2)
     self.teacher3 = AdviserTeacherFactory()
     self.teacher4 = AdviserTeacherFactory()
     a_person_student = PersonFactory.create(
         last_name="Durant",
         user=None,
         email='*****@*****.**')
     self.student = StudentFactory.create(person=a_person_student)
     self.offer1 = OfferFactory(title="test_offer1")
     self.offer2 = OfferFactory(title="test_offer2")
     self.academic_year1 = AcademicYearFactory()
     self.academic_year2 = AcademicYearFactory(
         year=self.academic_year1.year - 1)
     self.offer_year_start1 = OfferYearFactory(
         acronym="test_offer1",
         offer=self.offer1,
         academic_year=self.academic_year1)
     self.offer_year_start2 = OfferYearFactory(
         acronym="test_offer2",
         offer=self.offer2,
         academic_year=self.academic_year1)
     self.offer_proposition1 = OfferPropositionFactory(
         offer=self.offer1,
         global_email_to_commission=True,
         evaluation_first_year=True)
     self.offer_proposition2 = OfferPropositionFactory(
         offer=self.offer2, global_email_to_commission=False)
     self.proposition_dissertation = PropositionDissertationFactory(
         author=self.teacher,
         creator=a_person_teacher,
         title='Proposition 1212121')
     FacultyAdviserFactory(adviser=self.manager, offer=self.offer1)
     self.dissertation1 = DissertationFactory(
         author=self.student,
         title='Dissertation_test_email',
         offer_year_start=self.offer_year_start1,
         proposition_dissertation=self.proposition_dissertation,
         status='DIR_SUBMIT',
         active=True,
         dissertation_role__adviser=self.teacher,
         dissertation_role__status='PROMOTEUR')
     DissertationRoleFactory(adviser=self.teacher2,
                             status='CO_PROMOTEUR',
                             dissertation=self.dissertation1)
     DissertationRoleFactory(adviser=self.teacher3,
                             status='READER',
                             dissertation=self.dissertation1)
Example #2
0
    def setUp(self):
        self.maxDiff = None
        self.manager = AdviserManagerFactory()
        a_person_teacher = PersonFactory.create(first_name='Pierre', last_name='Dupont')
        self.teacher = AdviserTeacherFactory(person=a_person_teacher)
        a_person_teacher2 = PersonFactory.create(first_name='Marco', last_name='Millet')
        self.teacher2 = AdviserTeacherFactory(person=a_person_teacher2)
        a_person_student = PersonFactory.create(last_name="Durant", user=None)
        student = StudentFactory.create(person=a_person_student)
        self.offer1 = OfferFactory(title="test_offer1")
        self.offer2 = OfferFactory(title="test_offer2")
        self.academic_year1 = AcademicYearFactory()
        self.academic_year2 = AcademicYearFactory(year=self.academic_year1.year-1)
        self.offer_year_start1 = OfferYearFactory(acronym="test_offer1", offer=self.offer1,
                                             academic_year=self.academic_year1)
        offer_year_start2 = OfferYearFactory(academic_year=self.academic_year2, acronym="test_offer2", offer=self.offer1)
        self.offer_proposition1 = OfferPropositionFactory(offer=self.offer1)
        self.offer_proposition2 = OfferPropositionFactory(offer=self.offer2)
        FacultyAdviserFactory(adviser=self.manager, offer=self.offer1)
        self.manager2 = AdviserManagerFactory()
        FacultyAdviserFactory(adviser=self.manager, offer=self.offer2)
        roles = ['PROMOTEUR', 'CO_PROMOTEUR', 'READER', 'PROMOTEUR', 'ACCOMPANIST', 'PRESIDENT']
        status = ['DRAFT', 'COM_SUBMIT', 'EVA_SUBMIT', 'TO_RECEIVE', 'DIR_SUBMIT', 'DIR_SUBMIT']
        self.dissertations_list = list()
        for x in range(0, 6):
            proposition_dissertation = PropositionDissertationFactory(author=self.teacher,
                                                                      creator=a_person_teacher,
                                                                      title='Proposition {}'.format(x)
                                                                      )
            PropositionOfferFactory(proposition_dissertation=proposition_dissertation,
                                    offer_proposition=self.offer_proposition1)

            self.dissertations_list.append(DissertationFactory(author=student,
                                title='Dissertation {}'.format(x),
                                offer_year_start=self.offer_year_start1,
                                proposition_dissertation=proposition_dissertation,
                                status=status[x],
                                active=True,
                                dissertation_role__adviser=self.teacher,
                                dissertation_role__status=roles[x]
                                ))
        self.dissertation_1 = DissertationFactory\
            (author=student,
            title='Dissertation 2017',
            offer_year_start=self.offer_year_start1,
            proposition_dissertation=proposition_dissertation,
            status='COM_SUBMIT',
            active=True,
            dissertation_role__adviser=self.teacher2,
            dissertation_role__status='PROMOTEUR')
 def test_offer_proposition_exist(self):
     OfferPropositionGroupFactory.create(name_short="PSP",
                                         name_long="Faculté de Psychologie")
     offer_proposition_g = OfferPropositionGroup.objects.get(
         name_short='PSP')
     offer_PSP2MSG = OfferFactory.create(title='PSP2MSG')
     OfferProposition.objects.create(
         acronym="PSP2MSG",
         offer=offer_PSP2MSG,
         offer_proposition_group=offer_proposition_g)
     offer_proposition_psp = OfferProposition.objects.get(acronym='PSP2MSG')
     self.assertEqual(offer_proposition_psp.offer_proposition_group,
                      OfferPropositionGroup.objects.get(name_short='PSP'))
Example #4
0
 def test_find_by_offers_and_academic_year(self):
     tmp_student = StudentFactory()
     tmp_offer = OfferFactory()
     tmp_academic_year = AcademicYearFactory()
     tmp_offer_year = OfferYearFactory(offer=tmp_offer,
                                       academic_year=tmp_academic_year)
     OfferEnrollmentFactory.create(offer_year=tmp_offer_year,
                                   student=tmp_student)
     db_student = list(
         student.find_by_offers_and_academic_year([tmp_offer],
                                                  tmp_academic_year))[0]
     self.assertIsNotNone(db_student)
     self.assertEqual(db_student, tmp_student)
def create_offer(title):
    offer = OfferFactory.create(title)
    return offer
Example #6
0
 def test_find_by_offers_and_year(self):
     ac_year = academic_year.create_current_academic_year()
     offer1 = OfferFactory()
     offer_year1 = OfferYearFactory(offer=offer1, academic_year=ac_year)
     result = list(offer_year.find_by_offers_and_year([offer1], ac_year))
     self.assertEqual(result[0], offer_year1)
Example #7
0
 def test_find_by_id_with_instance(self):
     of = OfferFactory()
     self.assertEqual(of, offer.find_by_id(of.pk))
Example #8
0
def create_offer(title):
    return OfferFactory(title=title)
Example #9
0
 def setUp(self):
     self.offer = OfferFactory()
     self.title = self.offer.title
Example #10
0
    def _prepare_context_education_groups_search(self):
        # Create a structure [Entity / Entity version]
        country = CountryFactory()
        structure = StructureFactory()
        ssh_entity = EntityFactory(country=country)
        ssh_entity_v = EntityVersionFactory(acronym="SSH",
                                            end_date=None,
                                            entity=ssh_entity)

        agro_entity = EntityFactory(country=country)
        envi_entity = EntityFactory(country=country)
        ages_entity = EntityFactory(country=country)
        agro_entity_v = EntityVersionFactory(entity=agro_entity,
                                             parent=ssh_entity_v.entity,
                                             acronym="AGRO",
                                             end_date=None)
        envi_entity_v = EntityVersionFactory(entity=envi_entity,
                                             parent=agro_entity_v.entity,
                                             acronym="ENVI",
                                             end_date=None)
        ages_entity_v = EntityVersionFactory(entity=ages_entity,
                                             parent=agro_entity_v.entity,
                                             acronym="AGES",
                                             end_date=None)

        # Create EG and put entity charge [AGRO]
        agro_education_group = EducationGroupFactory()
        agro_education_group_type = EducationGroupTypeFactory(
            category=TRAINING)

        agro_education_group_year = EducationGroupYearFactory(
            acronym='EDPH2',
            academic_year=self.academic_year,
            education_group=agro_education_group,
            education_group_type=agro_education_group_type)

        agro_offer = OfferFactory()
        agro_offer_year = OfferYearFactory(offer=agro_offer,
                                           entity_management=structure,
                                           entity_administration_fac=structure)

        OfferYearEntityFactory(offer_year=agro_offer_year,
                               entity=agro_entity,
                               education_group_year=agro_education_group_year,
                               type=offer_year_entity_type.ENTITY_MANAGEMENT)

        # Create EG and put entity charge [ENVI]
        envi_education_group = EducationGroupFactory()
        envi_education_group_type = EducationGroupTypeFactory(
            category=TRAINING)

        envi_education_group_year = EducationGroupYearFactory(
            academic_year=self.academic_year,
            education_group=envi_education_group,
            education_group_type=envi_education_group_type)

        envi_offer = OfferFactory()
        envi_offer_year = OfferYearFactory(offer=envi_offer,
                                           entity_management=structure,
                                           entity_administration_fac=structure)

        OfferYearEntityFactory(offer_year=envi_offer_year,
                               entity=envi_entity,
                               education_group_year=envi_education_group_year,
                               type=offer_year_entity_type.ENTITY_MANAGEMENT)

        # Create EG and put entity charge [AGES]
        ages_education_group = EducationGroupFactory()
        ages_education_group_type = EducationGroupTypeFactory(
            category=TRAINING)

        ages_education_group_year = EducationGroupYearFactory(
            academic_year=self.academic_year,
            education_group=ages_education_group,
            education_group_type=ages_education_group_type)

        ages_offer = OfferFactory()
        ages_offer_year = OfferYearFactory(offer=ages_offer,
                                           entity_management=structure,
                                           entity_administration_fac=structure)

        OfferYearEntityFactory(offer_year=ages_offer_year,
                               entity=ages_entity,
                               education_group_year=ages_education_group_year,
                               type=offer_year_entity_type.ENTITY_MANAGEMENT)