def setUp(self): self.factory = RequestFactory() self.client = Client() self.settings = SettingsFactory() today = datetime.date.today() self.current_academic_year = AcademicYearFactory( start_date=today, end_date=today.replace(year=today.year + 1), year=today.year) self.current_academic_year.save() self.phd_supervisor = PersonFactory() self.assistant = AcademicAssistantFactory( supervisor=self.phd_supervisor) self.assistant_mandate = AssistantMandateFactory( academic_year=self.current_academic_year, assistant=self.assistant, state=assistant_mandate_state.RESEARCH) self.assistant_mandate2 = AssistantMandateFactory( academic_year=self.current_academic_year, assistant=self.assistant, state=assistant_mandate_state.RESEARCH) self.phd_supervisor_review = ReviewFactory( reviewer=None, mandate=self.assistant_mandate, status=review_status.DONE) self.entity_version = EntityVersionFactory( entity_type=entity_type.INSTITUTE) self.entity_mandate = MandateEntityFactory( assistant_mandate=self.assistant_mandate, entity=self.entity_version.entity) self.entity_mandate2 = MandateEntityFactory( assistant_mandate=self.assistant_mandate2, entity=self.entity_version.entity) self.reviewer = ReviewerFactory(role=reviewer_role.RESEARCH, entity=self.entity_version.entity) self.review = ReviewFactory(reviewer=self.reviewer, mandate=self.assistant_mandate, status=review_status.IN_PROGRESS) self.entity_version2 = EntityVersionFactory( entity_type=entity_type.FACULTY) self.entity_mandate2 = MandateEntityFactory( assistant_mandate=self.assistant_mandate, entity=self.entity_version2.entity) self.reviewer2 = ReviewerFactory(role=reviewer_role.SUPERVISION, entity=self.entity_version2.entity) self.entity_version3 = EntityVersionFactory( entity_type=entity_type.SECTOR) self.entity_mandate3 = MandateEntityFactory( assistant_mandate=self.assistant_mandate, entity=self.entity_version3.entity) self.reviewer3 = ReviewerFactory(role=reviewer_role.VICE_RECTOR, entity=self.entity_version3.entity)
def test_validate_review_and_update_mandate(self): validate_review_and_update_mandate(self.review, self.assistant_mandate) self.assertEqual(self.review.status, review_status.DONE) self.assertEqual(self.assistant_mandate.state, assistant_mandate_state.SUPERVISION) self.review2 = ReviewFactory(reviewer=self.reviewer2, mandate=self.assistant_mandate, status=review_status.IN_PROGRESS) validate_review_and_update_mandate(self.review2, self.assistant_mandate) self.assertEqual(self.review2.status, review_status.DONE) self.assertEqual(self.assistant_mandate.state, assistant_mandate_state.VICE_RECTOR) self.review3 = ReviewFactory(reviewer=self.reviewer3, mandate=self.assistant_mandate, status=review_status.IN_PROGRESS) validate_review_and_update_mandate(self.review3, self.assistant_mandate) self.assertEqual(self.review3.status, review_status.DONE) self.assertEqual(self.assistant_mandate.state, assistant_mandate_state.DONE)
def test_assistant_mandate_step_back_from_done_to_vice_rector(self): self.review4 = ReviewFactory(reviewer=self.reviewer3, mandate=self.assistant_mandate2, status=review_status.DONE) self.review5 = ReviewFactory(reviewer=self.reviewer2, mandate=self.assistant_mandate2, status=review_status.DONE) self.assistant_mandate2.state = assistant_mandate_state.DONE self.assistant_mandate2.save() self.client.post(reverse('assistant_mandate_step_back'), {'mandate_id': self.assistant_mandate2.id}) self.assistant_mandate2.refresh_from_db() self.assertEqual(self.assistant_mandate2.state, assistant_mandate_state.VICE_RECTOR)
def setUpTestData(cls): cls.settings = SettingsFactory() cls.current_academic_year = AcademicYearFactory(current=True) cls.assistant_mandate = AssistantMandateFactory( academic_year=cls.current_academic_year, state=assistant_mandate_state.PHD_SUPERVISOR) cls.review = ReviewFactory(reviewer=None, mandate=cls.assistant_mandate, status=review_status.IN_PROGRESS) cls.institute = EntityVersionFactory(entity_type=entity_type.INSTITUTE, end_date=None) cls.institute_child = EntityVersionFactory(parent=cls.institute.entity, end_date=None) cls.school = EntityVersionFactory(entity_type=entity_type.SCHOOL, end_date=None) cls.sector = EntityVersionFactory(entity_type=entity_type.SECTOR) cls.faculty = EntityVersionFactory(entity_type=entity_type.FACULTY) cls.mandate_entity = MandateEntityFactory( assistant_mandate=cls.assistant_mandate, entity=cls.institute.entity) cls.research_reviewer = ReviewerFactory(role=reviewer_role.RESEARCH, entity=cls.institute.entity) cls.research_assistant_reviewer = ReviewerFactory( role=reviewer_role.RESEARCH_ASSISTANT, entity=cls.institute_child.entity) cls.vice_sector_reviewer = ReviewerFactory( role=reviewer_role.VICE_RECTOR, entity=cls.school.entity) cls.supervision_reviewer = ReviewerFactory( role=reviewer_role.SUPERVISION, entity=cls.faculty.entity) cls.delegate = PersonFactory() cls.delegate2 = PersonFactory()
def setUpTestData(cls): cls.settings = SettingsFactory() cls.previous_academic_year, cls.current_academic_year, _ = AcademicYearFactory.produce( ) cls.phd_supervisor = PersonFactory() cls.assistant = AcademicAssistantFactory(supervisor=cls.phd_supervisor) cls.assistant_mandate = AssistantMandateFactory( academic_year=cls.current_academic_year, assistant=cls.assistant, state=assistant_mandate_state.PHD_SUPERVISOR) cls.assistant2 = AcademicAssistantFactory(supervisor=None) cls.assistant_mandate2 = AssistantMandateFactory( academic_year=cls.current_academic_year, assistant=cls.assistant2, state=assistant_mandate_state.RESEARCH, ) cls.review = ReviewFactory(reviewer=None, mandate=cls.assistant_mandate, status=review_status.IN_PROGRESS) cls.entity_version = EntityVersionFactory( entity_type=entity_type.INSTITUTE, end_date=None) cls.mandate_entity = MandateEntityFactory( assistant_mandate=cls.assistant_mandate, entity=cls.entity_version.entity) cls.mandate_entity2 = MandateEntityFactory( assistant_mandate=cls.assistant_mandate2, entity=cls.entity_version.entity) cls.reviewer = ReviewerFactory(role=reviewer_role.RESEARCH, entity=cls.entity_version.entity, person=cls.phd_supervisor)
def setUp(self): self.maxDiff = None self.factory = RequestFactory() self.assistant = AcademicAssistantFactory( phd_inscription_date=datetime.date(2015, 10, 2), thesis_title='Data fitting on manifolds', confirmation_test_date=datetime.date(2017, 9, 25), remark= "Deux co-promoteurs (l'application ne m'autorise à n'en renseigner qu'un)" ) self.mandate = AssistantMandateFactory( assistant=self.assistant, assistant_type=assistant_type.ASSISTANT, sap_id='1120019', entry_date=datetime.date(2012, 9, 15), end_date=datetime.date(2018, 9, 14), contract_duration='6 ans', contract_duration_fte='6 ans', fulltime_equivalent=1, other_status=None, renewal_type=assistant_mandate_renewal.NORMAL, justification=None, external_contract='', external_functions='', ) self.entity_version = EntityVersionFactory() self.mandate_entity = MandateEntityFactory( assistant_mandate=self.mandate, entity=self.entity_version.entity) self.reviewer = ReviewerFactory(entity=self.mandate_entity.entity) self.styles = getSampleStyleSheet() self.review1 = ReviewFactory(mandate=self.mandate, reviewer=self.reviewer)
def setUp(self): self.factory = RequestFactory() self.client = Client() self.settings = SettingsFactory() today = datetime.date.today() self.current_academic_year = AcademicYearFactory( start_date=today, end_date=today.replace(year=today.year + 1), year=today.year) self.phd_supervisor = PersonFactory() self.assistant = AcademicAssistantFactory( supervisor=self.phd_supervisor) self.assistant_mandate = AssistantMandateFactory( academic_year=self.current_academic_year, assistant=self.assistant) self.assistant_mandate.state = assistant_mandate_state.PHD_SUPERVISOR self.assistant_mandate.save() self.review = ReviewFactory(reviewer=None, mandate=self.assistant_mandate, status=review_status.IN_PROGRESS) self.entity_version = EntityVersionFactory( entity_type=entity_type.INSTITUTE) self.mandate_entity = MandateEntityFactory( assistant_mandate=self.assistant_mandate, entity=self.entity_version.entity)
def setUpTestData(cls): cls.person2 = PersonFactory() cls.manager = ManagerFactory() cls.person = cls.manager.person cls.entity_factory = EntityFactory() cls.entity_factory2 = EntityFactory() cls.entity_version = EntityVersionFactory(entity_type=entity_type.INSTITUTE, end_date=None, entity=cls.entity_factory) cls.entity_version2 = EntityVersionFactory(entity_type=entity_type.INSTITUTE, end_date=None, entity=cls.entity_factory2) cls.phd_supervisor = PersonFactory() cls.assistant = AcademicAssistantFactory(supervisor=cls.phd_supervisor) today = datetime.date.today() cls.current_academic_year = AcademicYearFactory(start_date=today, end_date=today.replace(year=today.year + 1), year=today.year) cls.assistant_mandate = AssistantMandateFactory(academic_year=cls.current_academic_year, assistant=cls.assistant) cls.reviewer = ReviewerFactory(role=reviewer_role.RESEARCH_ASSISTANT, entity=cls.entity_version.entity) cls.reviewer2 = ReviewerFactory(role=reviewer_role.RESEARCH, entity=cls.entity_version.entity) cls.reviewer3 = ReviewerFactory(role=reviewer_role.RESEARCH, entity=cls.entity_version.entity) cls.review = ReviewFactory(reviewer=cls.reviewer2) cls.formset = formset_factory(ReviewersFormset) cls.current_academic_year = AcademicYearFactory(start_date=today, end_date=today.replace(year=today.year + 1), year=today.year)
def test_assistant_mandate_step_back_from_institute_president_to_php_supervisor( self): self.assistant.supervisor = PersonFactory() self.assistant.save() self.review1 = ReviewFactory(reviewer=self.reviewer1, mandate=self.assistant_mandate, status=review_status.DONE) self.review2 = ReviewFactory(reviewer=None, mandate=self.assistant_mandate, status=review_status.DONE) self.assistant_mandate.state = assistant_mandate_state.RESEARCH self.assistant_mandate.save() self.client.post(reverse('assistant_mandate_step_back'), {'mandate_id': self.assistant_mandate.id}) self.assistant_mandate.refresh_from_db() self.assertEqual(self.assistant_mandate.state, assistant_mandate_state.PHD_SUPERVISOR)
def setUp(self): self.mandate = AssistantMandateFactory( assistant=self.assistant, assistant_type=assistant_type.ASSISTANT, sap_id='1120019', entry_date=datetime.date(self.current_academic_year.year - 6, 9, 15), end_date=datetime.date(self.current_academic_year.year, 9, 24), contract_duration='6 ans', contract_duration_fte='6 ans', fulltime_equivalent=1, other_status=None, renewal_type=assistant_mandate_renewal.NORMAL, justification=None, external_contract='', external_functions='', state=assistant_mandate_state.TO_DO) self.mandate2 = AssistantMandateFactory( state=assistant_mandate_state.DECLINED, academic_year=self.current_academic_year) self.mandate3 = AssistantMandateFactory( state=assistant_mandate_state.DECLINED, academic_year=self.current_academic_year) self.tutoring_learning_unit_year = TutoringLearningUnitYearFactory( mandate=self.mandate) self.review3 = ReviewFactory(mandate=self.mandate, reviewer=None) self.entity_version = EntityVersionFactory() self.mandate_entity = MandateEntityFactory( assistant_mandate=self.mandate, entity=self.entity_version.entity) self.entity_version2 = EntityVersionFactory( entity_type=entity_type.FACULTY, end_date=None) self.mandate_entity2 = MandateEntityFactory( assistant_mandate=self.mandate, entity=self.entity_version2.entity) self.reviewer = ReviewerFactory(role=reviewer_role.SUPERVISION, entity=self.mandate_entity.entity) self.reviewer2 = ReviewerFactory(entity=self.mandate_entity2.entity) self.review1 = ReviewFactory(mandate=self.mandate, reviewer=self.reviewer) self.review2 = ReviewFactory(mandate=self.mandate, reviewer=self.reviewer2, status=review_status.IN_PROGRESS) self.review3 = ReviewFactory(mandate=self.mandate, reviewer=None)
def test_assistant_mandate_step_back_from_vice_rector_to_dean_of_faculty( self): self.supervision_review = ReviewFactory(mandate=self.assistant_mandate, reviewer=self.reviewer2) self.assistant_mandate.state = assistant_mandate_state.VICE_RECTOR self.assistant_mandate.save() self.client.post(reverse('assistant_mandate_step_back'), {'mandate_id': self.assistant_mandate.id}) self.assistant_mandate.refresh_from_db() self.assertEqual(self.assistant_mandate.state, assistant_mandate_state.SUPERVISION)
def test_assistant_mandate_step_back_from_dean_of_faculty_to_institute_president( self): self.research_review = ReviewFactory(mandate=self.assistant_mandate, reviewer=self.reviewer1) self.assistant_mandate.state = assistant_mandate_state.SUPERVISION self.assistant_mandate.save() self.client.post(reverse('assistant_mandate_step_back'), {'mandate_id': self.assistant_mandate.id}) self.assistant_mandate.refresh_from_db() self.assertEqual(self.assistant_mandate.state, assistant_mandate_state.RESEARCH)
def test_assistant_mandate_step_back_from_dean_of_faculty_to_assistant( self): # Test if assistant is teaching assistant self.research_review = ReviewFactory(mandate=self.assistant_mandate, reviewer=self.reviewer1) self.assistant_mandate.state = assistant_mandate_state.SUPERVISION self.assistant_mandate.save() self.client.post(reverse('assistant_mandate_step_back'), {'mandate_id': self.assistant_mandate2.id}) self.assistant_mandate2.refresh_from_db() self.assertEqual(self.assistant_mandate2.state, assistant_mandate_state.TRTS)
def test_mandate_can_go_backward(self): self.assertTrue(mandate_can_go_backward(self.assistant_mandate)) self.assistant_mandate.state = assistant_mandate_state.RESEARCH self.assistant_mandate.save() self.review1 = ReviewFactory(reviewer=self.reviewer1, mandate=self.assistant_mandate, status=review_status.IN_PROGRESS) self.assertFalse(mandate_can_go_backward(self.assistant_mandate)) self.review1.delete() self.assistant_mandate.state = assistant_mandate_state.TO_DO self.assistant_mandate.save() self.assertFalse(mandate_can_go_backward(self.assistant_mandate))
def setUp(self): self.assistant_mandate = AssistantMandateFactory( academic_year=self.current_academic_year, assistant=self.assistant, state=assistant_mandate_state.RESEARCH ) self.phd_supervisor_review = ReviewFactory( reviewer=None, mandate=self.assistant_mandate, status=review_status.DONE ) self.entity_mandate = MandateEntityFactory(assistant_mandate=self.assistant_mandate, entity=self.entity_version.entity) self.review = ReviewFactory(reviewer=self.reviewer, mandate=self.assistant_mandate, status=review_status.IN_PROGRESS) self.entity_mandate2 = MandateEntityFactory( assistant_mandate=self.assistant_mandate, entity=self.entity_version2.entity ) self.entity_mandate3 = MandateEntityFactory( assistant_mandate=self.assistant_mandate, entity=self.entity_version3.entity )
def test_generate_phd_supervisor_menu_tabs(self): self.client.force_login(self.reviewer.person.user) self.assertEqual([{ 'action': 'view', 'class': '', 'item': 'PHD_SUPERVISOR' }, { 'item': 'RESEARCH', 'class': '', 'action': 'edit' }], generate_reviewer_menu_tabs(reviewer_role.RESEARCH, self.assistant_mandate, None)) self.review.status = review_status.DONE self.review.save() self.assistant_mandate.state = assistant_mandate_state.SUPERVISION self.assistant_mandate.save() self.review2 = ReviewFactory(reviewer=self.reviewer2, mandate=self.assistant_mandate, status=review_status.IN_PROGRESS) self.assertEqual([{ 'action': 'view', 'class': '', 'item': 'PHD_SUPERVISOR' }, { 'item': 'RESEARCH', 'class': 'active', 'action': 'view' }], generate_reviewer_menu_tabs( reviewer_role.RESEARCH, self.assistant_mandate, assistant_mandate_state.RESEARCH)) self.assertEqual([{ 'action': 'view', 'class': '', 'item': 'PHD_SUPERVISOR' }, { 'item': 'RESEARCH', 'class': '', 'action': 'view' }, { 'item': 'SUPERVISION', 'class': '', 'action': 'edit' }], generate_reviewer_menu_tabs(reviewer_role.SUPERVISION, self.assistant_mandate, None))
def setUp(self): self.factory = RequestFactory() today = datetime.date.today() self.current_academic_year = AcademicYearFactory( start_date=today, end_date=today.replace(year=today.year + 1), year=today.year) self.phd_supervisor = PersonFactory() self.assistant = AcademicAssistantFactory( supervisor=self.phd_supervisor) self.assistant_mandate = AssistantMandateFactory( academic_year=self.current_academic_year, assistant=self.assistant) self.assistant_mandate.state = assistant_mandate_state.PHD_SUPERVISOR self.assistant_mandate.save() self.review = ReviewFactory(reviewer=None, mandate=self.assistant_mandate, status=review_status.IN_PROGRESS)
def setUpTestData(cls): cls.settings = SettingsFactory() today = datetime.date.today() cls.current_academic_year = AcademicYearFactory(start_date=today, end_date=today.replace(year=today.year + 1), year=today.year) cls.phd_supervisor = PersonFactory() cls.assistant = AcademicAssistantFactory(supervisor=cls.phd_supervisor) cls.assistant_mandate = AssistantMandateFactory(academic_year=cls.current_academic_year, assistant=cls.assistant) cls.assistant_mandate.state = assistant_mandate_state.PHD_SUPERVISOR cls.assistant_mandate.save() cls.review = ReviewFactory(reviewer=None, mandate=cls.assistant_mandate, status=review_status.IN_PROGRESS) cls.entity = EntityFactory() cls.entity_version = EntityVersionFactory(entity=cls.entity, entity_type=entity_type.INSTITUTE) cls.mandate_entity = MandateEntityFactory(assistant_mandate=cls.assistant_mandate, entity=cls.entity) cls.reviewer = ReviewerFactory(role=reviewer_role.RESEARCH, entity=cls.entity_version.entity)
def setUp(self): self.factory = RequestFactory() self.client = Client() self.person2 = PersonFactory() self.manager = ManagerFactory() self.person = self.manager.person self.client.force_login(self.person.user) self.entity_factory = EntityFactory() self.entity_factory2 = EntityFactory() self.entity_version = EntityVersionFactory( entity_type=entity_type.INSTITUTE, end_date=None, entity=self.entity_factory) self.entity_version2 = EntityVersionFactory( entity_type=entity_type.INSTITUTE, end_date=None, entity=self.entity_factory2) self.phd_supervisor = PersonFactory() self.assistant = AcademicAssistantFactory( supervisor=self.phd_supervisor) today = datetime.date.today() self.current_academic_year = AcademicYearFactory( start_date=today, end_date=today.replace(year=today.year + 1), year=today.year) self.assistant_mandate = AssistantMandateFactory( academic_year=self.current_academic_year, assistant=self.assistant) self.reviewer = ReviewerFactory(role=reviewer_role.RESEARCH_ASSISTANT, entity=self.entity_version.entity) self.reviewer2 = ReviewerFactory(role=reviewer_role.RESEARCH, entity=self.entity_version.entity) self.reviewer3 = ReviewerFactory(role=reviewer_role.RESEARCH, entity=self.entity_version.entity) self.review = ReviewFactory(reviewer=self.reviewer2) self.formset = formset_factory(ReviewersFormset) self.current_academic_year = AcademicYearFactory( start_date=today, end_date=today.replace(year=today.year + 1), year=today.year)
def setUp(self): self.client = Client() self.settings = SettingsFactory() self.manager = ManagerFactory() self.factory = RequestFactory() self.supervisor = PersonFactory() self.assistant = AcademicAssistantFactory( phd_inscription_date=datetime.date(2015, 10, 2), thesis_title='Data fitting on manifolds', confirmation_test_date=datetime.date(2017, 9, 25), remark= "Deux co-promoteurs (l'application ne m'autorise à n'en renseigner qu'un)", supervisor=self.supervisor) self.mandate = AssistantMandateFactory( assistant=self.assistant, assistant_type=assistant_type.ASSISTANT, sap_id='1120019', entry_date=datetime.date(2012, 9, 15), end_date=datetime.date(2018, 9, 14), contract_duration='6 ans', contract_duration_fte='6 ans', fulltime_equivalent=1, other_status=None, renewal_type=assistant_mandate_renewal.NORMAL, justification=None, external_contract='', external_functions='', ) self.tutoring_learning_unit_year = TutoringLearningUnitYearFactory( mandate=self.mandate) self.review3 = ReviewFactory(mandate=self.mandate, reviewer=None) self.entity_version = EntityVersionFactory() self.mandate_entity = MandateEntityFactory( assistant_mandate=self.mandate, entity=self.entity_version.entity) self.entity_version2 = EntityVersionFactory( entity_type=entity_type.FACULTY, end_date=None) self.mandate_entity2 = MandateEntityFactory( assistant_mandate=self.mandate, entity=self.entity_version2.entity) self.reviewer = ReviewerFactory(role=reviewer_role.SUPERVISION, entity=self.mandate_entity.entity) self.reviewer2 = ReviewerFactory(entity=self.mandate_entity2.entity) self.styles = getSampleStyleSheet() self.styles.add( ParagraphStyle( name='Tiny', fontSize=6, font='Helvetica', leading=8, leftIndent=0, rightIndent=0, firstLineIndent=0, alignment=TA_LEFT, spaceBefore=0, spaceAfter=0, splitLongWords=1, )) self.review1 = ReviewFactory(mandate=self.mandate, reviewer=self.reviewer) self.review2 = ReviewFactory(mandate=self.mandate, reviewer=self.reviewer2, status=review_status.IN_PROGRESS) self.review3 = ReviewFactory(mandate=self.mandate, reviewer=None) self.reviewer3 = ReviewerFactory()
def setUp(self): self.mandate = AssistantMandateFactory() self.review = ReviewFactory(mandate=self.mandate)
def setUpTestData(cls): cls.mandate = AssistantMandateFactory() cls.review = ReviewFactory(mandate=cls.mandate)