def setUp(self): self.organization = test_organization.create_organization() self.student = test_student.create_student(first_name="first", last_name="last", registration_id="64641200") self.other_student = test_student.create_student( first_name="first", last_name="last", registration_id="606012") self.cohort = CohortFactory() self.speciality = test_internship_speciality.create_speciality( cohort=self.cohort) self.internship = InternshipFactory(cohort=self.cohort) self.other_internship = InternshipFactory(cohort=self.cohort) self.student_information = test_internship_student_information.create_student_information( person=self.student.person, cohort=self.cohort) self.other_student_information = test_internship_student_information.create_student_information( person=self.other_student.person, cohort=self.cohort) self.choice_1 = create_internship_choice( self.organization, self.student, self.speciality, internship=self.other_internship) self.choice_2 = create_internship_choice(self.organization, self.student, self.speciality, internship=self.internship) self.choice_3 = create_internship_choice( self.organization, self.other_student, self.speciality, internship=self.other_internship)
def setUpTestData(cls): cls.organization = test_organization.create_organization() cls.student = test_student.create_student(first_name="first", last_name="last", registration_id="64641200") cls.other_student = test_student.create_student( first_name="first", last_name="last", registration_id="606012") cls.cohort = CohortFactory() cls.speciality = test_internship_speciality.create_speciality( cohort=cls.cohort) cls.internship = InternshipFactory(cohort=cls.cohort) cls.other_internship = InternshipFactory(cohort=cls.cohort) cls.student_information = test_internship_student_information.create_student_information( person=cls.student.person, cohort=cls.cohort) cls.other_student_information = test_internship_student_information.create_student_information( person=cls.other_student.person, cohort=cls.cohort) cls.choice_1 = create_internship_choice( cls.organization, cls.student, cls.speciality, internship=cls.other_internship) cls.choice_2 = create_internship_choice(cls.organization, cls.student, cls.speciality, internship=cls.internship) cls.choice_3 = create_internship_choice( cls.organization, cls.other_student, cls.speciality, internship=cls.other_internship)
def setUp(self) -> None: self.organization = test_organization.create_organization() self.student = test_student.create_student("64641200") self.other_student = test_student.create_student("60601200") self.speciality = test_internship_speciality.create_speciality() self.other_speciality = test_internship_speciality.create_speciality() self.internship = InternshipFactory(speciality=self.speciality) self.other_internship = InternshipFactory(speciality=self.speciality) self.choice_1 = create_internship_choice( self.organization, self.student, self.other_speciality, internship=self.other_internship) self.choice_2 = create_internship_choice(self.organization, self.student, self.speciality, internship=self.internship) self.choice_3 = create_internship_choice( self.organization, self.other_student, self.other_speciality, internship=self.other_internship) self.choice_4 = create_internship_choice(self.organization, self.other_student, self.speciality, internship=self.internship)
def setUpTestData(cls): cls.academic_year = create_current_academic_year() cls.offer_year = test_offer_year.create_offer_year( 'SINF1BA', 'Bachelor in informatica', cls.academic_year) cls.learn_unit_year = LearningUnitYearFactory( acronym='LSINF1010', specific_title='Introduction to algorithmic', academic_year=cls.academic_year) cls.session_exam = test_session_exam.create_session_exam( 1, cls.learn_unit_year, cls.offer_year) cls.student = test_student.create_student('Pierre', 'Lacazette', '12345678') cls.offer_enrollment = test_offer_enrollment.create_offer_enrollment( cls.student, cls.offer_year) cls.learn_unit_enrol = test_learning_unit_enrollment.create_learning_unit_enrollment( cls.learn_unit_year, cls.offer_enrollment) cls.exam_enrollment = ExamEnrollmentFactory( session_exam=cls.session_exam, learning_unit_enrollment=cls.learn_unit_enrol, score_final=12.6, enrollment_state=enrollment_states.ENROLLED) student_unsuscribed = test_student.create_student( 'Marco', 'Dubois', '12345679') offer_enrollment_2 = test_offer_enrollment.create_offer_enrollment( student_unsuscribed, cls.offer_year) learn_unit_enrol_2 = test_learning_unit_enrollment.create_learning_unit_enrollment( cls.learn_unit_year, offer_enrollment_2) cls.exam_enrollment_2 = ExamEnrollmentFactory( session_exam=cls.session_exam, learning_unit_enrollment=learn_unit_enrol_2, enrollment_state=enrollment_states.NOT_ENROLLED)
def setUp(self): self.cohort = CohortFactory() organization = test_organization.create_organization( cohort=self.cohort) self.student_1 = test_student.create_student( first_name="first", last_name="last", registration_id="64641200") self.student_2 = test_student.create_student(first_name="first", last_name="last", registration_id="606012") speciality = test_internship_speciality.create_speciality( cohort=self.cohort) self.internship = InternshipFactory(cohort=self.cohort) self.internship_2 = InternshipFactory(cohort=self.cohort) self.internship_3 = InternshipFactory(cohort=self.cohort) self.internship_4 = InternshipFactory(cohort=self.cohort) self.choice_1 = test_internship_choice.create_internship_choice( organization, self.student_1, speciality, internship=self.internship) self.choice_2 = test_internship_choice.create_internship_choice( organization, self.student_1, speciality, internship=self.internship_2) self.choice_3 = test_internship_choice.create_internship_choice( organization, self.student_1, speciality, internship=self.internship_3) self.choice_4 = test_internship_choice.create_internship_choice( organization, self.student_1, speciality, internship=self.internship_4) self.choice_5 = test_internship_choice.create_internship_choice( organization, self.student_2, speciality, internship=self.internship) self.choice_6 = test_internship_choice.create_internship_choice( organization, self.student_2, speciality, internship=self.internship_2) self.choice_7 = test_internship_choice.create_internship_choice( organization, self.student_2, speciality, internship=self.internship_3)
def setUp(self): self.cohort = CohortFactory() student_1 = test_student.create_student("first", "last", "01") student_2 = test_student.create_student("first", "last", "02") student_3 = test_student.create_student("first", "last", "03") student_4 = test_student.create_student("first", "last", "04") contest_generalist = "GENERALIST" contest_specialist = "SPECIALIST" create_student_information(student_1.person, contest_generalist, cohort=self.cohort) create_student_information(student_2.person, contest_generalist, cohort=self.cohort) create_student_information(student_3.person, contest_generalist, cohort=self.cohort) create_student_information(student_4.person, contest_specialist, cohort=self.cohort)
def setUpTestData(cls): cls.cohort = CohortFactory() organization = test_organization.create_organization(cohort=cls.cohort) cls.student_1 = test_student.create_student(first_name="first", last_name="last", registration_id="64641200") cls.student_2 = test_student.create_student(first_name="first", last_name="last", registration_id="606012") speciality = test_internship_speciality.create_speciality( cohort=cls.cohort) cls.internship = InternshipFactory(cohort=cls.cohort) cls.internship_2 = InternshipFactory(cohort=cls.cohort) cls.internship_3 = InternshipFactory(cohort=cls.cohort) cls.internship_4 = InternshipFactory(cohort=cls.cohort) cls.choice_1 = create_internship_choice(organization, cls.student_1, speciality, internship=cls.internship) cls.choice_2 = create_internship_choice(organization, cls.student_1, speciality, internship=cls.internship_2) cls.choice_3 = create_internship_choice(organization, cls.student_1, speciality, internship=cls.internship_3) cls.choice_4 = create_internship_choice(organization, cls.student_1, speciality, internship=cls.internship_4) cls.choice_5 = create_internship_choice(organization, cls.student_2, speciality, internship=cls.internship) cls.choice_6 = create_internship_choice(organization, cls.student_2, speciality, internship=cls.internship_2) cls.choice_7 = create_internship_choice(organization, cls.student_2, speciality, internship=cls.internship_3) cls.url = reverse(internships_student_resume, kwargs={ 'cohort_id': cls.cohort.id, })
def create_exam_enrollment_with_student(num_id, registration_id, offer_year, learning_unit_year): student = test_student.create_student("Student" + str(num_id), "Etudiant" + str(num_id), registration_id) offer_enrollment = test_offer_enrollment.create_offer_enrollment(student, offer_year) learning_unit_enrollment = test_learning_unit_enrollment.create_learning_unit_enrollment(learning_unit_year, offer_enrollment) session_exam = test_session_exam.create_session_exam(1, learning_unit_year, offer_year) return create_exam_enrollment(session_exam, learning_unit_enrollment)
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)
def test_get_number_first_choice_by_organization(self): number_first_choice = list( mdl_internship_choice.get_number_first_choice_by_organization( self.speciality, self.internship)) expected = [{ "organization": self.organization.id, "organization__count": 2 }] self.assertEqual(expected, number_first_choice) other_organization = test_organization.create_organization( reference="10") yet_another_student = test_student.create_student("64641201") create_internship_choice(other_organization, yet_another_student, self.speciality, self.internship) number_first_choice = list( mdl_internship_choice.get_number_first_choice_by_organization( self.speciality, self.internship)) expected = [{ "organization": self.organization.id, "organization__count": 2 }, { "organization": other_organization.id, "organization__count": 1 }] self.assertCountEqual(number_first_choice, expected) self.assertIn(expected[0], number_first_choice) self.assertIn(expected[1], number_first_choice)
def setUp(self): self.academic_year = test_academic_year.create_academic_year() self.offer_year = test_offer_year.create_offer_year('SINF1BA', 'Bachelor in informatica', self.academic_year) self.learn_unit_year = test_learning_unit_year.create_learning_unit_year('LSINF1010', 'Introduction to algorithmic', self.academic_year) self.session_exam = test_session_exam.create_session_exam(1, self.learn_unit_year, self.offer_year) self.student = test_student.create_student('Pierre', 'Lacazette', '12345678') self.offer_enrollment = test_offer_enrollment.create_offer_enrollment(self.student, self.offer_year) self.learn_unit_enrol = test_learning_unit_enrollment.create_learning_unit_enrollment(self.learn_unit_year, self.offer_enrollment) self.exam_enrollment = exam_enrollment.ExamEnrollment(session_exam=self.session_exam, learning_unit_enrollment=self.learn_unit_enrol, score_final=12.6)
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)
def setUpTestData(cls): cls.student = test_student.create_student("64641200") cls.other_student = test_student.create_student("60601200")