def setUpTestData(cls): cls.maxDiff = None cls.manager = AdviserManagerFactory() a_person_teacher = PersonFactory.create(first_name='Pierre', last_name='Dupont', email='*****@*****.**') cls.teacher = AdviserTeacherFactory(person=a_person_teacher) a_person_teacher2 = PersonFactory.create(first_name='Marco', last_name='Millet', email='*****@*****.**') cls.teacher2 = AdviserTeacherFactory(person=a_person_teacher2) a_person_student = PersonWithoutUserFactory.create( last_name="Durant", email='*****@*****.**') cls.student = StudentFactory.create(person=a_person_student) cls.education_group_1 = EducationGroupFactory() cls.academic_year1 = AcademicYearFactory() cls.education_group_year_1 = EducationGroupYearFactory( acronym="test_offer1", education_group=cls.education_group_1, academic_year=cls.academic_year1, title="test_offer1") cls.offer_proposition1 = OfferPropositionFactory( education_group=cls.education_group_1, global_email_to_commission=True) cls.proposition_dissertation = PropositionDissertationFactory( author=cls.teacher, creator=a_person_teacher, title='Proposition 1212121') FacultyAdviserFactory(adviser=cls.manager, education_group=cls.education_group_1) cls.dissertation_1 = DissertationFactory( author=cls.student, title='Dissertation_test_email', education_group_year=cls.education_group_year_1, proposition_dissertation=cls.proposition_dissertation, status='DRAFT', active=True, dissertation_role__adviser=cls.teacher, dissertation_role__status='PROMOTEUR') FacultyAdviserFactory(adviser=cls.manager, education_group=cls.education_group_1) cls.dissert_role = DissertationRoleFactory( dissertation=cls.dissertation_1, adviser=cls.teacher2, status='READER')
def setUpTestData(cls): cls.maxDiff = None cls.manager = AdviserManagerFactory() a_person_teacher = PersonFactory.create( first_name='Pierre', last_name='Dupont', email='*****@*****.**') cls.teacher = AdviserTeacherFactory(person=a_person_teacher) a_person_teacher2 = PersonFactory.create( first_name='Marco', last_name='Millet', email='*****@*****.**') cls.teacher2 = AdviserTeacherFactory(person=a_person_teacher2) a_person_student = PersonWithoutUserFactory.create( last_name="Durant", email='*****@*****.**') cls.student = StudentFactory.create(person=a_person_student) cls.education_group = EducationGroupFactory() cls.education_group3 = EducationGroupFactory() cls.academic_year1 = create_current_academic_year() cls.academic_year2 = AcademicYearFactory(year=cls.academic_year1.year - 1) cls.education_group_year = EducationGroupYearFactory( academic_year=cls.academic_year1, education_group=cls.education_group, acronym="test_offer1") cls.faculty_manager = FacultyAdviserFactory( adviser=cls.manager, education_group=cls.education_group) cls.offer_proposition1 = OfferPropositionFactory( global_email_to_commission=True, evaluation_first_year=True, education_group=cls.education_group_year.education_group) cls.offer_proposition2 = OfferPropositionFactory( education_group=cls.education_group3, global_email_to_commission=False) cls.education_group_year2 = EducationGroupYearFactory( acronym="test_offer2", education_group=cls.offer_proposition2.education_group, academic_year=cls.academic_year1) cls.proposition_dissertation = PropositionDissertationFactory( author=cls.teacher, creator=a_person_teacher, title='Proposition 1212121') cls.dissertation_test_email = DissertationFactory( author=cls.student, title='Dissertation_test_email', proposition_dissertation=cls.proposition_dissertation, status='DRAFT', active=True, dissertation_role__adviser=cls.teacher, dissertation_role__status='PROMOTEUR', education_group_year=cls.education_group_year, ) FacultyAdviserFactory( adviser=cls.manager, education_group=cls.education_group_year.education_group) cls.manager2 = AdviserManagerFactory() FacultyAdviserFactory( adviser=cls.manager, education_group=cls.education_group_year2.education_group) FacultyAdviserFactory( adviser=cls.manager, education_group=cls.education_group_year.education_group) roles = [ 'PROMOTEUR', 'CO_PROMOTEUR', 'READER', 'PROMOTEUR', 'ACCOMPANIST', 'PRESIDENT' ] status = [ 'DRAFT', 'COM_SUBMIT', 'EVA_SUBMIT', 'TO_RECEIVE', 'DIR_SUBMIT', 'DIR_SUBMIT' ] cls.dissertations_list = list() for x in range(0, 6): proposition_dissertation = PropositionDissertationFactory( author=cls.teacher, creator=a_person_teacher, title='Proposition {}'.format(x)) PropositionOfferFactory( proposition_dissertation=proposition_dissertation, offer_proposition=cls.offer_proposition1) cls.dissertations_list.append( DissertationFactory( author=cls.student, title='Dissertation {}'.format(x), education_group_year=cls.education_group_year, proposition_dissertation=proposition_dissertation, status=status[x], active=True, dissertation_role__adviser=cls.teacher, dissertation_role__status=roles[x])) cls.dissertation_1 = DissertationFactory( author=cls.student, title='Dissertation 2017', education_group_year=cls.education_group_year, proposition_dissertation=cls.proposition_dissertation, status='COM_SUBMIT', active=True, dissertation_role__adviser=cls.teacher2, dissertation_role__status='PROMOTEUR') cls.url = reverse('manager_dissertations_search')
def test_find_by_with_person_last_name_case_insensitive(self): a_person = PersonWithoutUserFactory.create(last_name="Smith") a_student = StudentFactory.create(person=a_person) found = list(student.find_by(person_name="smith")) self.assertEqual(len(found), 1) self.assertEqual(found[0].id, a_student.id)