Esempio n. 1
0
 def setUpTestData(cls):
     cls.user = UserFactory()
     CentralManagerGroupFactory()
     cls.person = PersonFactory(user=cls.user)
     cls.user.user_permissions.add(
         Permission.objects.get(codename="can_access_education_group"))
     cls.academic_year = AcademicYearFactory(current=True)
Esempio n. 2
0
 def setUpTestData(cls):
     cls.an_user = user.UserFactory(username="******")
     cls.user_for_person = user.UserFactory(username="******")
     cls.person_without_user = PersonWithoutUserFactory()
     CentralManagerGroupFactory()
     FacultyManagerGroupFactory()
     ProgramManagerGroupFactory()
Esempio n. 3
0
    def test_when_person_is_central_manager(self):
        CentralManagerGroupFactory()
        central_manager = create_person_in_group(CENTRAL_MANAGER_GROUP)

        expected_state = proposal_state.ProposalState.CENTRAL.name
        actual_state = compute_proposal_state(central_manager)
        self.assertEqual(expected_state, actual_state)
 def test_disable_fields_full_with_faculty_manager_and_central_manager(self):
     self.person.user.groups.add(FacultyManagerGroupFactory())
     self.person.user.groups.add(CentralManagerGroupFactory())
     form = FullForm(self.person, self.learning_unit_year.academic_year,
                     learning_unit_instance=self.learning_unit_year.learning_unit)
     disabled_fields = {key for key, value in form.fields.items() if value.disabled}
     self.assertEqual(disabled_fields, FULL_READ_ONLY_FIELDS.union({'internship_subtype'}))
 def test_disable_fields_acronym_with_central_manager_and_other_collective(self):
     self.person.user.groups.add(CentralManagerGroupFactory())
     self.learning_unit_year.learning_container_year.container_type = LearningContainerYearType.OTHER_COLLECTIVE.name
     self.learning_unit_year.learning_container_year.save()
     form = FullForm(self.person, self.learning_unit_year.academic_year,
                     learning_unit_instance=self.learning_unit_year.learning_unit)
     disabled_fields = {key for key, value in form.fields.items() if value.disabled}
     self.assertTrue("acronym" not in disabled_fields)
Esempio n. 6
0
 def setUp(self):
     self.an_user = user.UserFactory(username="******")
     self.user_for_person = user.UserFactory(username="******")
     self.person_with_user = PersonFactory(user=self.user_for_person, language="fr-be", first_name="John",
                                           last_name="Doe")
     self.person_without_user = PersonWithoutUserFactory()
     CentralManagerGroupFactory()
     FacultyManagerGroupFactory()
     ProgramManagerGroupFactory()
    def test_academic_years_restriction_for_central_manager(self):
        self.person.user.groups.add(CentralManagerGroupFactory())
        form = FullForm(self.person, self.learning_unit_year.academic_year,
                        start_year=self.learning_unit_year.academic_year.year,
                        postposal=True)
        actual_choices = [choice[0] for choice in form.fields["academic_year"].choices if choice[0] != '']
        expected_choices = [acy.id for acy in self.acs[3:10]]

        self.assertCountEqual(actual_choices, expected_choices)
Esempio n. 8
0
    def setUp(self):
        self.person = PersonFactory()
        an_organization = OrganizationFactory(type=organization_type.MAIN)
        current_academic_year = create_current_academic_year()

        today = datetime.date.today()
        an_entity = EntityFactory(organization=an_organization)
        self.entity_version = EntityVersionFactory(
            entity=an_entity,
            entity_type=entity_type.FACULTY,
            start_date=today.replace(year=1900),
            end_date=None)
        self.an_entity_school = EntityFactory(organization=an_organization)
        self.entity_version_school = EntityVersionFactory(
            entity=self.an_entity_school,
            entity_type=entity_type.SCHOOL,
            start_date=today.replace(year=1900),
            end_date=None)

        learning_container_year = LearningContainerYearFactory(
            academic_year=current_academic_year,
            container_type=learning_container_year_types.COURSE,
            requirement_entity=self.entity_version.entity,
        )
        self.learning_unit_year = LearningUnitYearFakerFactory(
            credits=Decimal(5),
            subtype=learning_unit_year_subtypes.FULL,
            academic_year=current_academic_year,
            learning_container_year=learning_container_year,
            campus=CampusFactory(organization=an_organization,
                                 is_administration=True),
            periodicity=learning_unit_year_periodicity.ANNUAL,
            internship_subtype=None)
        self.person_entity = PersonEntityFactory(person=self.person,
                                                 entity=an_entity)
        self.language = LanguageFactory(code="EN")
        self.campus = CampusFactory(
            name="OSIS Campus",
            organization=OrganizationFactory(type=organization_type.MAIN),
            is_administration=True)

        self.form_data = {
            "academic_year": self.learning_unit_year.academic_year.id,
            "acronym_0": "L",
            "acronym_1": "OSIS1245",
            "common_title": "New common title",
            "common_title_english": "New common title english",
            "specific_title": "New title",
            "specific_title_english": "New title english",
            "container_type":
            self.learning_unit_year.learning_container_year.container_type,
            "internship_subtype": "",
            "credits": self.learning_unit_year.credits,
            "periodicity": learning_unit_year_periodicity.BIENNIAL_ODD,
            "status": False,
            "language": self.language.pk,
            "quadrimester": quadrimesters.Q1,
            "campus": self.campus.id,
            "entity": self.entity_version.id,
            "folder_id": "1",
            "state": proposal_state.ProposalState.CENTRAL.name,
            'requirement_entity': self.entity_version.id,
            'allocation_entity': self.entity_version.id,
            'additional_entity_1': self.entity_version.id,
            'additional_entity_2': self.entity_version.id,

            # Learning component year data model form
            'component-TOTAL_FORMS': '2',
            'component-INITIAL_FORMS': '0',
            'component-MAX_NUM_FORMS': '2',
            'component-0-hourly_volume_total_annual': Decimal(20),
            'component-0-hourly_volume_partial_q1': Decimal(10),
            'component-0-hourly_volume_partial_q2': Decimal(10),
            'component-1-hourly_volume_total_annual': Decimal(20),
            'component-1-hourly_volume_partial_q1': Decimal(10),
            'component-1-hourly_volume_partial_q2': Decimal(10),
            'component-0-planned_classes': 1,
            'component-1-planned_classes': 1,
        }
        FacultyManagerGroupFactory()
        CentralManagerGroupFactory()
Esempio n. 9
0
 def setUpTestData(cls):
     cls.user = UserFactory()
     CentralManagerGroupFactory()
     cls.person = PersonWithPermissionsFactory('can_access_education_group',
                                               user=cls.user)
     cls.academic_year = AcademicYearFactory(current=True)