示例#1
0
 def test_can_only_propose_modification_for_course_internship_and_dissertation(self):
     other_types = (OTHER_COLLECTIVE, OTHER_INDIVIDUAL, MASTER_THESIS, EXTERNAL)
     for luy_container_type in other_types:
         with self.subTest(luy_container_type=luy_container_type):
             self.luy.learning_container_year.container_type = luy_container_type
             self.luy.learning_container_year.save()
             self.assertFalse(is_eligible_to_create_modification_proposal(self.luy, self.person))
示例#2
0
 def test_all_requirements_are_met_to_propose_modification(self):
     for luy_container_type in FACULTY_UPDATABLE_CONTAINER_TYPES:
         with self.subTest(luy_container_type=luy_container_type):
             self.luy.learning_container_year.container_type = luy_container_type
             self.luy.learning_container_year.save()
             self.assertTrue(
                 is_eligible_to_create_modification_proposal(
                     self.luy, self.person))
示例#3
0
    def test_can_only_propose_modification_for_lu_which_is_not_in_proposition_on_different_year(self):
        past_luy_with_proposal = LearningUnitYearFakerFactory(
            learning_container_year__academic_year=self.past_academic_year,
            learning_unit=self.luy.learning_unit
        )
        ProposalLearningUnitFactory(learning_unit_year=past_luy_with_proposal)

        self.assertFalse(is_eligible_to_create_modification_proposal(self.luy, self.person))
示例#4
0
 def f_can_perform_modification_proposal(request, learning_unit_year_id):
     learn_unit_year = get_object_or_404(
         learning_unit_year.LearningUnitYear, pk=learning_unit_year_id)
     pers = get_object_or_404(Person, user=request.user)
     if not business_perms.is_eligible_to_create_modification_proposal(
             learn_unit_year, pers):
         raise PermissionDenied(
             "Learning unit year not eligible for proposal or user has not sufficient rights."
         )
     return view_func(request, learning_unit_year_id)
示例#5
0
 def test_when_existing_proposal_in_epc(self):
     luy = LearningUnitYearFactory(
         academic_year=self.academic_yr,
         learning_unit__existing_proposal_in_epc=True)
     self.assertFalse(perms.is_eligible_for_modification(luy, None))
     self.assertFalse(perms.is_eligible_for_modification_end_date(
         luy, None))
     self.assertFalse(perms.is_eligible_to_create_partim(luy, None))
     self.assertFalse(
         perms.is_eligible_to_create_modification_proposal(luy, None))
     self.assertFalse(
         perms.is_eligible_to_delete_learning_unit_year(luy, None))
示例#6
0
 def test_when_existing_proposal_in_epc(self):
     a_person = create_person_with_permission_and_group(
         CENTRAL_MANAGER_GROUP)
     luy = LearningUnitYearFactory(
         academic_year=self.academic_yr,
         learning_unit__existing_proposal_in_epc=True)
     self.assertFalse(perms.is_eligible_for_modification(luy, a_person))
     self.assertFalse(
         perms.is_eligible_for_modification_end_date(luy, a_person))
     self.assertFalse(perms.is_eligible_to_create_partim(luy, a_person))
     self.assertFalse(
         perms.is_eligible_to_create_modification_proposal(luy, a_person))
     self.assertFalse(
         perms.is_eligible_to_delete_learning_unit_year(luy, a_person))
示例#7
0
def get_learning_unit_identification_context(learning_unit_year_id, person):
    context = get_common_context_learning_unit_year(learning_unit_year_id,
                                                    person)

    learning_unit_year = context['learning_unit_year']
    proposal = proposal_learning_unit.find_by_learning_unit_year(
        learning_unit_year)

    context[
        'learning_container_year_partims'] = learning_unit_year.get_partims_related(
        )
    context['organization'] = get_organization_from_learning_unit_year(
        learning_unit_year)
    context['campus'] = get_campus_from_learning_unit_year(learning_unit_year)
    context['experimental_phase'] = True
    context['show_subtype'] = show_subtype(learning_unit_year)
    context.update(get_all_attributions(learning_unit_year))
    context['components'] = get_components_identification(learning_unit_year)
    context['proposal'] = proposal
    context[
        'proposal_folder_entity_version'] = mdl_base.entity_version.get_by_entity_and_date(
            proposal.folder.entity, None) if proposal else None
    context['differences'] = _get_difference_of_proposal(proposal)

    # perms learning unit
    context['can_propose'] = is_eligible_to_create_modification_proposal(
        learning_unit_year, person)
    context['can_edit_date'] = is_eligible_for_modification_end_date(
        learning_unit_year, person)
    context['can_edit'] = is_eligible_for_modification(learning_unit_year,
                                                       person)
    context['can_delete'] = can_delete_learning_unit_year(
        learning_unit_year, person)

    # perms proposal
    context['can_cancel_proposal'] = is_eligible_for_cancel_of_proposal(
        proposal, person)
    context['can_edit_learning_unit_proposal'] = is_eligible_to_edit_proposal(
        proposal, person)

    return context
示例#8
0
    def test_cannot_propose_modification_for_luy_for_which_person_is_not_linked_to_entity(
            self):
        self.person_entity.delete()

        self.assertFalse(
            is_eligible_to_create_modification_proposal(self.luy, self.person))
示例#9
0
    def test_can_only_propose_modification_for_luy_which_is_not_currently_in_proposition(
            self):
        ProposalLearningUnitFactory(learning_unit_year=self.luy)

        self.assertFalse(
            is_eligible_to_create_modification_proposal(self.luy, self.person))
示例#10
0
    def test_cannot_propose_modification_of_partim(self):
        self.luy.subtype = PARTIM
        self.luy.save()

        self.assertFalse(
            is_eligible_to_create_modification_proposal(self.luy, self.person))
示例#11
0
    def test_cannot_propose_modification_of_past_learning_unit(self):
        past_luy = LearningUnitYearFakerFactory(
            learning_container_year__academic_year=self.past_academic_year)

        self.assertFalse(
            is_eligible_to_create_modification_proposal(past_luy, self.person))
示例#12
0
    def test_person_is_central_manager(self, mock_is_central_manager):
        self.person_entity.delete()

        self.assertTrue(is_eligible_to_create_modification_proposal(self.luy, self.person))
        self.assertTrue(mock_is_central_manager.called)