def setUp(self):
     self.client = Client()
     self.academic_year = test_academic_year.create_academic_year()
     group = _create_group('students')
     group.permissions.add(Permission.objects.get(codename='is_student'))
     self.user = User.objects.create_user(username='******',
                                          email='jsmith@localhost',
                                          password='******')
     self.user2 = User.objects.create_user(username='******',
                                           email='jsmath@localhost',
                                           password='******')
     self.user_not_student = User.objects.create_user(
         username='******', email='pjashar@localhost', password='******')
     self.user.groups.add(group)
     self.user2.groups.add(group)
     self.person = test_person.create_person_with_user(self.user,
                                                       first_name="James",
                                                       last_name="Smith")
     self.person2 = test_person.create_person_with_user(self.user2,
                                                        first_name="Jimmy",
                                                        last_name="Smath")
     self.student = test_student.create_student_with_registration_person(
         "12345678", self.person)
     self.student2 = test_student.create_student_with_registration_person(
         "12457896", self.person2)
     offer_year_id = 1234
     self.off_year = test_offer_year.create_offer_year_from_kwargs(
         **{
             'id': offer_year_id,
             'acronym': 'SINF1BA',
             'title': 'Bechelor in informatica',
             'academic_year': self.academic_year
         })
     self.url = "/exam_enrollment/{}/form/".format(offer_year_id)
     self.correct_exam_enrol_form = load_json_file(
         "exam_enrollment/tests/resources/exam_enrollment_form_example.json"
     )
     self.current_academic_year = test_academic_year.create_academic_year_current(
     )
     self.off_enrol = OfferEnrollmentFactory(
         student=self.student,
         offer_year=OfferYearFactory(
             academic_year=self.current_academic_year))
     learn_unit_year = test_learning_unit_year.create_learning_unit_year({
         'acronym':
         'LDROI1234',
         'specific_title':
         'Bachelor in law',
         'academic_year':
         self.academic_year
     })
     self.learn_unit_enrol = test_learning_unit_enrollment.create_learning_unit_enrollment(
         self.off_enrol, learn_unit_year)
Exemple #2
0
 def create_tutor(self):
     self.a_user = self.create_user(username='******',
                                    email='jacob@localhost',
                                    password='******')
     self.a_person = test_person.create_person_with_user(self.a_user)
     Group.objects.get_or_create(name='tutors')
     self.a_tutor = test_tutor.create_tutor_with_person(self.a_person)
Exemple #3
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):
        self.user = User.objects.create_user("username", "*****@*****.**", "passtest",
                                             first_name='first_name', last_name='last_name')
        self.user.save()
        add_permission(self.user, "is_internship_manager")
        self.person = test_person.create_person_with_user(self.user)
        self.client.force_login(self.user)

        self.cohort = CohortFactory()

        self.student = test_student.create_student("first", "last", "64641200")

        self.speciality_1 = test_internship_speciality.create_speciality(name="urgence", cohort=self.cohort)
        self.speciality_2 = test_internship_speciality.create_speciality(name="chirurgie", cohort=self.cohort)

        self.organization_1 = test_organization.create_organization(reference="01", cohort=self.cohort)
        self.organization_2 = test_organization.create_organization(reference="02", cohort=self.cohort)
        self.organization_3 = test_organization.create_organization(reference="03", cohort=self.cohort)
        self.organization_4 = test_organization.create_organization(reference="04", cohort=self.cohort)
        self.organization_5 = test_organization.create_organization(reference="05", cohort=self.cohort)

        self.offer_1 = test_internship_offer.create_specific_internship_offer(self.organization_1, self.speciality_1, cohort=self.cohort)
        self.offer_2 = test_internship_offer.create_specific_internship_offer(self.organization_2, self.speciality_1, cohort=self.cohort)
        self.offer_3 = test_internship_offer.create_specific_internship_offer(self.organization_3, self.speciality_1, cohort=self.cohort)
        self.offer_4 = test_internship_offer.create_specific_internship_offer(self.organization_4, self.speciality_1, cohort=self.cohort)

        self.offer_5 = test_internship_offer.create_specific_internship_offer(self.organization_1, self.speciality_2, cohort=self.cohort)
        self.offer_6 = test_internship_offer.create_specific_internship_offer(self.organization_5, self.speciality_2, cohort=self.cohort)
Exemple #5
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)
Exemple #6
0
 def setUp(self):
     group = Group(name="tutors")
     group.save()
     self.attribution = AttributionFactory()
     today = datetime.datetime.today()
     self.an_academic_year = AcademicYearFactory(year=today.year)
     self.user = UserFactory()
     self.person = test_person.create_person_with_user(self.user)
     self.tutor = TutorFactory(person=self.person)
def create_student_information(user, cohort=None, person=None):
    if person is None:
        person = test_person.create_person_with_user(user)

    if cohort is None:
        cohort = CohortFactory()
    student_information = mdl_student_information.InternshipStudentInformation(
        person=person,
        location="location",
        cohort=cohort,
        postal_code="00",
        city="city",
        country="country")
    student_information.save()
    return student_information
Exemple #8
0
    def setUp(self):
        self.a_user = User.objects.create_user(username='******',
                                               email='legat@localhost',
                                               password='******')
        self.a_person = test_person.create_person_with_user(self.a_user)
        Group.objects.get_or_create(name='tutors')
        self.a_tutor = test_tutor.create_tutor_with_person(self.a_person)
        self.a_current_academic_yr = test_academic_year.create_academic_year_with_year(
            CURRENT_YEAR)
        self.a_learning_unit_year = test_learning_unit_year.create_learning_unit_year(
            {
                'acronym': ACRONYM,
                'title': TITLE,
                'academic_year': self.a_current_academic_yr,
                'weight': WEIGHT
            })
        self.a_learning_unit_component_lecture = test_learning_unit_component.create_learning_unit_component(
            {
                'learning_unit_year': self.a_learning_unit_year,
                'type': component_type.LECTURING,
                'duration': LEARNING_UNIT_LECTURING_DURATION
            })
        self.a_learning_unit_component_practice = \
            test_learning_unit_component.create_learning_unit_component({
                'learning_unit_year': self.a_learning_unit_year,
                'type': component_type.PRACTICAL_EXERCISES,
                'duration': LEARNING_UNIT_PRACTICAL_EXERCISES_DURATION})
        self.a_tutor_application = test_tutor_application.create_tutor_application(
            {
                'function': function.CO_HOLDER,
                'tutor': self.a_tutor,
                'learning_unit_year': self.a_learning_unit_year
            })

        self.an_application_charge_lecturing = test_application_charge.create_application_charge(
            {
                'tutor_application': self.a_tutor_application,
                'learning_unit_component':
                self.a_learning_unit_component_lecture,
                'allocation_charge': 15
            })
        self.an_application_charge_practical = test_application_charge.create_application_charge(
            {
                'tutor_application': self.a_tutor_application,
                'learning_unit_component':
                self.a_learning_unit_component_practice,
                'allocation_charge': 20
            })
Exemple #9
0
    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.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
        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,
            score_responsible=True)
        self.attribution_children = test_attribution.create_attribution(
            tutor=self.tutor,
            learning_unit_year=self.learning_unit_year_children,
            score_responsible=True)
    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.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
        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,
            score_responsible=True)
        self.attribution_children = test_attribution.create_attribution(
            tutor=self.tutor,
            learning_unit_year=self.learning_unit_year_children,
            score_responsible=True)
    def setUp(self):
        self.user = User.objects.create_user("username", "*****@*****.**", "passtest",
                                             first_name='first_name', last_name='last_name')
        self.user.save()
        add_permission(self.user, "is_internship_manager")
        self.person = test_person.create_person_with_user(self.user)

        self.cohort = CohortFactory()

        self.client.force_login(self.user)

        self.speciality = test_internship_speciality.create_speciality(name="urgence", cohort=self.cohort)
        self.organization = test_organization.create_organization(reference="01", cohort=self.cohort)
        self.offer = test_internship_offer.create_specific_internship_offer(self.organization, self.speciality, cohort=self.cohort)

        MAX_PERIOD = 12
        for period in range(1, MAX_PERIOD + 1):
            test_period.create_period("P%d" % period, cohort=self.cohort)
    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()
    def setUpTestData(cls):
        cls.user = User.objects.create_user("username",
                                            "*****@*****.**",
                                            "passtest",
                                            first_name='first_name',
                                            last_name='last_name')
        cls.user.save()
        add_permission(cls.user, "is_internship_manager")
        cls.person = test_person.create_person_with_user(cls.user)

        cls.cohort = CohortFactory()

        cls.student = test_student.create_student("first", "last", "64641200")

        cls.speciality_1 = test_internship_speciality.create_speciality(
            name="urgence", cohort=cls.cohort)
        cls.speciality_2 = test_internship_speciality.create_speciality(
            name="chirurgie", cohort=cls.cohort)

        cls.organization_1 = test_organization.create_organization(
            reference="01", cohort=cls.cohort)
        cls.organization_2 = test_organization.create_organization(
            reference="02", cohort=cls.cohort)
        cls.organization_3 = test_organization.create_organization(
            reference="03", cohort=cls.cohort)
        cls.organization_4 = test_organization.create_organization(
            reference="04", cohort=cls.cohort)
        cls.organization_5 = test_organization.create_organization(
            reference="05", cohort=cls.cohort)

        cls.offer_1 = test_internship_offer.create_specific_internship_offer(
            cls.organization_1, cls.speciality_1, cohort=cls.cohort)
        cls.offer_2 = test_internship_offer.create_specific_internship_offer(
            cls.organization_2, cls.speciality_1, cohort=cls.cohort)
        cls.offer_3 = test_internship_offer.create_specific_internship_offer(
            cls.organization_3, cls.speciality_1, cohort=cls.cohort)
        cls.offer_4 = test_internship_offer.create_specific_internship_offer(
            cls.organization_4, cls.speciality_1, cohort=cls.cohort)

        cls.offer_5 = test_internship_offer.create_specific_internship_offer(
            cls.organization_1, cls.speciality_2, cohort=cls.cohort)
        cls.offer_6 = test_internship_offer.create_specific_internship_offer(
            cls.organization_5, cls.speciality_2, cohort=cls.cohort)
Exemple #14
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
        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,
            score_responsible=True)
        self.attribution_children = test_attribution.create_attribution(
            tutor=self.tutor,
            learning_unit_year=self.learning_unit_year_children,
            score_responsible=True)
    def setUpTestData(cls):
        cls.user = User.objects.create_user("username",
                                            "*****@*****.**",
                                            "passtest",
                                            first_name='first_name',
                                            last_name='last_name')
        cls.user.save()
        add_permission(cls.user, "is_internship_manager")
        cls.person = test_person.create_person_with_user(cls.user)

        cls.cohort = CohortFactory()

        cls.speciality = test_internship_speciality.create_speciality(
            name="urgence", cohort=cls.cohort)
        cls.organization = test_organization.create_organization(
            reference="01", cohort=cls.cohort)
        cls.offer = test_internship_offer.create_specific_internship_offer(
            cls.organization, cls.speciality, cohort=cls.cohort)

        MAX_PERIOD = 12
        for period in range(1, MAX_PERIOD + 1):
            test_period.create_period("P%d" % period, cohort=cls.cohort)

        cls.internship_offer = OfferFactory(cohort=cls.cohort)
 def create_student(self, cpt):
     a_student_user = self.create_user(username='******'.format(cpt),
                                       email='student{0}@localhost'.format(cpt),
                                       password='******')
     return test_student.create_student_with_registration_person(cpt, test_person.create_person_with_user(a_student_user))
Exemple #17
0
 def setUp(self):
     today = datetime.datetime.today()
     self.an_academic_year = AcademicYearFactory(year=today.year)
     self.user = UserFactory()
     self.person = test_person.create_person_with_user(self.user)