def test_li_delete_all_lu_everything_ok(self): result = li_delete_all_lu(self.context, self.url_edit, '', "#modalDeleteLuy") expected = self._get_result_data_expected_delete( "link_delete_lus", load_modal=True, data_target="#modalDeleteLuy", url=self.url_edit) self.assertEqual(result, expected)
def test_li_delete_all_lu_everything_ok(self): result = li_delete_all_lu(self.context, self.url_edit, '', "#modalDeleteLuy") expected = { 'class_li': 'disabled', 'load_modal': False, 'url': '#', 'id_li': 'link_delete_lus', 'title': "Vous ne pouvez pas supprimer une unité d'enseignement existant avant 2018", 'text': '', 'data_target': '' } self.assertEqual(result, expected)
def test_li_delete_all_lu_everything_ok(self): result = li_delete_all_lu(self.context, self.url_edit_non_editable, '', "#modalDeleteLuy") expected = { 'class_li': 'disabled', 'load_modal': False, 'url': '#', 'id_li': 'link_delete_lus', 'title': _("You cannot delete a learning unit which is existing before %(limit_year)s" ) % { "limit_year": settings.YEAR_LIMIT_LUE_MODIFICATION }, 'text': '', 'data_target': '' } self.assertEqual(result, expected)
def test_li_delete_all_lu_cannot_delete_learning_unit_year_according_type( self): self.context['user'] = FacultyManagerFactory().user lcy_master = LearningContainerYearFactory( academic_year=self.academic_year, container_type=learning_container_year_types.COURSE) learning_unit_yr = LearningUnitYearFactory( academic_year=self.academic_year, subtype=learning_unit_year_subtypes.FULL, learning_unit=LearningUnitFactory(), learning_container_year=lcy_master) self.context['learning_unit_year'] = learning_unit_yr result = li_delete_all_lu(self.context, self.url_edit, '', "#modalDeleteLuy") expected = self._get_result_data_expected_delete( "link_delete_lus", MSG_CAN_DELETE_ACCORDING_TO_TYPE) self.assertEqual(result, expected)
def test_li_edit_lu_year_is_editable_but_existing_proposal_in_epc(self): self.learning_unit.existing_proposal_in_epc = True self.learning_unit.save() self.context["learning_unit_year"] = self.learning_unit_year result = li_edit_lu(self.context, self.url_edit, "") self.assertEqual( result, self._get_result_data_expected(ID_LINK_EDIT_LU, MSG_EXISTING_PROPOSAL_IN_EPC)) result = li_edit_date_lu(self.context, self.url_edit, "") self.assertEqual( result, self._get_result_data_expected(ID_LINK_EDIT_DATE_LU, MSG_EXISTING_PROPOSAL_IN_EPC)) result = li_delete_all_lu(self.context, self.url_edit, '', "#modalDeleteLuy") expected = self._get_result_data_expected_delete( "link_delete_lus", MSG_EXISTING_PROPOSAL_IN_EPC) self.assertEqual(result, expected) self.proposal.learning_unit_year = self.learning_unit_year self.proposal.save() self.context["proposal"] = self.proposal result = li_suppression_proposal(self.context, self.url_edit, "") self.assertEqual( result, self._get_result_data_expected_for_proposal_suppression( "link_proposal_suppression", MSG_EXISTING_PROPOSAL_IN_EPC, DISABLED)) result = li_modification_proposal(self.context, self.url_edit, "") self.assertEqual( result, self._get_result_data_expected( "link_proposal_modification", MSG_EXISTING_PROPOSAL_IN_EPC, ))
def test_li_delete_all_lu_cannot_delete_learning_unit_year_according_type( self): a_person = create_person_with_permission_and_group( FACULTY_MANAGER_GROUP, 'can_delete_learningunit') self.context['user'] = a_person.user lcy_master = LearningContainerYearFactory( academic_year=self.current_academic_year, container_type=learning_container_year_types.COURSE) learning_unit_yr = LearningUnitYearFactory( academic_year=self.current_academic_year, subtype=learning_unit_year_subtypes.FULL, learning_unit=LearningUnitFactory(), learning_container_year=lcy_master) self.context['learning_unit_year'] = learning_unit_yr result = li_delete_all_lu(self.context, self.url_edit, '', "#modalDeleteLuy") expected = self._get_result_data_expected_delete( "link_delete_lus", MSG_CAN_DELETE_ACCORDING_TO_TYPE) self.assertEqual(result, expected)