def test_can_modify_by_proposal_n_year_plus_one(self): faculty_person = FacultyManagerFactory() lcy = LearningContainerYearFactory( academic_year=self.next_academic_yr, container_type=learning_container_year_types.COURSE) learning_unit_yr = LearningUnitYearFactory( academic_year=self.next_academic_yr, subtype=learning_unit_year_subtypes.FULL, learning_unit=LearningUnitFactory(), learning_container_year=lcy) self.assertTrue( can_modify_by_proposal(learning_unit_yr, faculty_person, True)) central_person = CentralManagerFactory() self.assertTrue( can_modify_by_proposal(learning_unit_yr, central_person, True))
def test_can_modify_by_proposal_previous_n_year(self): faculty_person = FacultyManagerFactory() lcy = LearningContainerYearFactory( academic_year=self.previous_academic_year, container_type=learning_container_year_types.COURSE) learning_unit_yr = LearningUnitYearFactory( academic_year=self.previous_academic_year, subtype=learning_unit_year_subtypes.FULL, learning_unit=LearningUnitFactory(), learning_container_year=lcy) self._modify_permission_assert(faculty_person, learning_unit_yr) central_person = CentralManagerFactory() self.assertFalse( can_modify_by_proposal(learning_unit_yr, central_person, False))
def _modify_permission_assert(self, a_person, luy): self.assertFalse(can_modify_by_proposal(luy, a_person, False)) with self.assertRaises(PermissionDenied) as perm_ex: can_modify_by_proposal(luy, a_person, True) self.assertEqual('{}'.format(perm_ex.exception), MSG_NOT_ELIGIBLE_TO_PUT_IN_PROPOSAL_ON_THIS_YEAR)