def test_two_personal_internships_at_most(self): organization = test_organization.create_organization(name="Stage personnel") speciality = test_internship_speciality.create_speciality(name="Stage personnel", acronym="SP") offer = test_internship_offer.create_specific_internship_offer(organization, speciality, title="Stage personnel") choice_1 = test_internship_choice.create_internship_choice( organization, self.student, speciality, self.internship_1 ) choice_2 = test_internship_choice.create_internship_choice( organization, self.student, speciality, self.internship_2 ) selection_url = reverse("select_internship", kwargs={'cohort_id': self.cohort.id}) self.client.post(selection_url, data={ '{}-TOTAL_FORMS'.format(self.speciality_2.name): '2', '{}-INITIAL_FORMS'.format(self.speciality_2.name): '0', '{}-MIN_NUM_FORMS'.format(self.speciality_2.name): '2', '{}-MAX_NUM_FORMS'.format(self.speciality_2.name): '2', 'form-0-offer': str(offer.id), 'form-0-preference': '1', 'current_internship'.format(self.speciality_2.name): self.internship_2.id, }) choices = list(mdl_internship_choice.search(student=self.student)) self.assertEqual(len(choices), 2) self.assertIn(choice_1, choices) self.assertIn(choice_2, choices)
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 setUp(self): self.student = StudentFactory() self.user = self.student.person.user add_permission(self.user, "can_access_internship") self.cohort = CohortFactory() self.student_information = test_internship_student_information.create_student_information( self.user, self.cohort, self.student.person ) 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.internship_1 = InternshipFactory( name=self.speciality_1.name, cohort=self.cohort, speciality=self.speciality_1 ) self.internship_2 = InternshipFactory( name=self.speciality_2.name, cohort=self.cohort, speciality=self.speciality_2 ) 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 ) self.client.force_login(self.user)
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 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 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)