Пример #1
0
 def setUp(self):
     self.entity_factory = EntityFactory()
     self.entity_version = EntityVersionFactory(
         entity_type=entity_type.INSTITUTE,
         end_date=None,
         entity=self.entity_factory)
     self.reviewer = ReviewerFactory(role=reviewer_role.RESEARCH,
                                     entity=self.entity_version.entity)
    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_factory = EntityFactory()
        self.entity_version = EntityVersionFactory(
            entity_type=entity_type.INSTITUTE,
            end_date=None,
            entity=self.entity_factory)
        self.entity_factory2 = EntityFactory()
        self.entity_version2 = EntityVersionFactory(
            entity_type=entity_type.SCHOOL,
            end_date=None,
            entity=self.entity_factory2)
        self.entity_version2 = EntityVersionFactory(
            entity_type=entity_type.SECTOR)
        self.mandate_entity = MandateEntityFactory(
            assistant_mandate=self.assistant_mandate,
            entity=self.entity_version.entity)
        self.reviewer = ReviewerFactory(role=reviewer_role.RESEARCH,
                                        entity=self.entity_version.entity)
        self.reviewer2 = ReviewerFactory(role=reviewer_role.VICE_RECTOR,
                                         entity=self.entity_version2.entity)
        self.entity_version3 = EntityVersionFactory(
            entity_type=entity_type.FACULTY)
        self.reviewer3 = ReviewerFactory(role=reviewer_role.SUPERVISION,
                                         entity=self.entity_version3.entity)

        self.delegate = PersonFactory()
        self.delegate2 = PersonFactory()
Пример #3
0
 def test_context_data_phd_supervisor_is_reviewer(self):
     self.reviewer = ReviewerFactory(role=reviewer_role.RESEARCH,
                                     entity=self.entity_version.entity,
                                     person=self.phd_supervisor)
     self.client.force_login(self.phd_supervisor.user)
     response = self.client.get('/assistants/phd_supervisor/assistants/')
     self.assertEqual(response.context['current_reviewer'], self.reviewer)
     self.assertTrue(response.context['can_delegate'])
    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)
Пример #5
0
 def setUpTestData(cls):
     today = datetime.date.today()
     cls.current_academic_year = AcademicYearFactory(start_date=today,
                                                     end_date=today.replace(year=today.year + 1),
                                                     year=today.year)
     cls.settings = SettingsFactory()
     cls.manager = ManagerFactory()
     cls.entity_version = EntityVersionFactory(entity_type=entity_type.INSTITUTE)
     cls.reviewer = ReviewerFactory(entity=cls.entity_version.entity)
     cls.assistant = AcademicAssistantFactory()
     cls.unauthorized_person = PersonFactory()
Пример #6
0
    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)
Пример #7
0
 def setUpTestData(cls):
     cls.entity1 = EntityFactory()
     cls.entity_version1 = EntityVersionFactory(
         entity=cls.entity1, entity_type=entity_type.SECTOR)
     cls.entity2 = EntityFactory()
     cls.entity_version2 = EntityVersionFactory(
         entity=cls.entity2, entity_type=entity_type.FACULTY)
     cls.entity3 = EntityFactory()
     cls.entity_version3 = EntityVersionFactory(
         entity=cls.entity3, entity_type=entity_type.FACULTY)
     cls.entity4 = EntityFactory()
     cls.entity_version4 = EntityVersionFactory(
         entity=cls.entity4,
         parent=cls.entity3,
         entity_type=entity_type.SCHOOL)
     cls.reviewer1 = ReviewerFactory(role=reviewer_role.VICE_RECTOR,
                                     entity=cls.entity1)
     cls.reviewer2 = ReviewerFactory(role=reviewer_role.SUPERVISION,
                                     entity=cls.entity2)
     cls.reviewer3 = ReviewerFactory(role=reviewer_role.SUPERVISION,
                                     entity=cls.entity3)
     cls.reviewer4 = ReviewerFactory(role=reviewer_role.SUPERVISION_DAF,
                                     entity=cls.entity3)
     cls.reviewer5 = ReviewerFactory(
         role=reviewer_role.SUPERVISION_DAF_ASSISTANT, entity=cls.entity4)
     cls.reviewer6 = ReviewerFactory(
         role=reviewer_role.VICE_RECTOR_ASSISTANT, entity=cls.entity1)
Пример #8
0
 def setUp(self):
     self.factory = RequestFactory()
     self.client = Client()
     today = datetime.date.today()
     self.current_academic_year = AcademicYearFactory(start_date=today,
                                                      end_date=today.replace(year=today.year + 1),
                                                      year=today.year)
     self.settings = SettingsFactory()
     self.manager = ManagerFactory()
     self.entity_version = EntityVersionFactory(entity_type=entity_type.INSTITUTE)
     self.reviewer = ReviewerFactory(entity=self.entity_version.entity)
     self.assistant = AcademicAssistantFactory()
     self.unauthorized_person = PersonFactory()
Пример #9
0
 def setUpTestData(cls):
     cls.mandate = AssistantMandateFactory()
     cls.entity_factory = EntityFactory()
     cls.entity_version = EntityVersionFactory(entity_type=entity_type.INSTITUTE,
                                               end_date=None,
                                               entity=cls.entity_factory)
     cls.entity_factory2 = EntityFactory()
     cls.entity_version2 = EntityVersionFactory(entity_type=entity_type.SECTOR,
                                                end_date=None,
                                                entity=cls.entity_factory2)
     cls.reviewer = ReviewerFactory(role=reviewer_role.RESEARCH,
                                    entity=cls.entity_version.entity)
     cls.delegate = PersonFactory()
Пример #10
0
 def setUpTestData(cls):
     cls.academic_assistant = AcademicAssistantFactory()
     cls.manager = ManagerFactory()
     cls.current_academic_year = AcademicYearFactory()
     cls.assistant_mandate = AssistantMandateFactory(assistant=cls.academic_assistant)
     cls.user = User.objects.create_user(
         username='******', email='*****@*****.**', password='******'
     )
     cls.user.save()
     cls.phd_supervisor = Person.objects.create(user=cls.user, first_name='phd', last_name='supervisor')
     cls.phd_supervisor.save()
     cls.academic_assistant.supervisor = cls.phd_supervisor
     cls.academic_assistant.save()
     cls.settings = SettingsFactory()
     cls.reviewer = ReviewerFactory(role=reviewer_role.SUPERVISION)
Пример #11
0
    def test_when_reviewers(self):
        reviewers = ReviewerFactory.create_batch(5)
        for reviewer in reviewers:
            EntityVersionFactory(entity=reviewer.entity)

        response = self.client.get(self.url)

        self.assertEqual(response.status_code, HttpResponse.status_code)
        self.assertTemplateUsed(response, "reviewers_list.html")

        context = response.context
        self.assertCountEqual(
            [form['id'].value() for form in context['reviewers_formset']],
            [reviewer.id for reviewer in reviewers]
        )
Пример #12
0
 def setUp(self):
     self.mandate = AssistantMandateFactory()
     self.entity_factory = EntityFactory()
     self.entity_version = EntityVersionFactory(
         entity_type=entity_type.INSTITUTE,
         end_date=None,
         entity=self.entity_factory)
     self.entity_factory2 = EntityFactory()
     self.entity_version2 = EntityVersionFactory(
         entity_type=entity_type.SECTOR,
         end_date=None,
         entity=self.entity_factory2)
     self.reviewer = ReviewerFactory(role=reviewer_role.RESEARCH,
                                     entity=self.entity_version.entity)
     self.delegate = PersonFactory()
Пример #13
0
 def test_context_data(self):
     self.reviewer = ReviewerFactory(role=reviewer_role.RESEARCH,
                                     entity=self.entity_version.entity,
                                     person=self.phd_supervisor)
     self.client.force_login(self.phd_supervisor.user)
     response = self.client.get('/assistants/reviewer/')
     self.assertEqual(response.context['reviewer'],
                      find_by_person(self.phd_supervisor))
     self.assertTrue(response.context['can_delegate'])
     mandates_id = find_by_entity(self.reviewer.entity).values_list(
         'assistant_mandate_id', flat=True)
     self.assertQuerysetEqual(
         response.context['object_list'],
         find_by_academic_year(
             self.current_academic_year).filter(id__in=mandates_id),
         transform=lambda x: x)
Пример #14
0
    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.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()