def setUp(self): self.learning_unit_year = LearningUnitYearFullFactory( learning_container_year = self.learning_container_year ) self.lecturing_component = LecturingLearningComponentYearFactory( learning_unit_year=self.learning_unit_year) self.practical_component = PracticalLearningComponentYearFactory( learning_unit_year=self.learning_unit_year) self.attribution = AttributionNewFactory( learning_container_year=self.learning_unit_year.learning_container_year ) self.charge_lecturing = AttributionChargeNewFactory( attribution=self.attribution, learning_component_year=self.lecturing_component ) self.charge_practical = AttributionChargeNewFactory( attribution=self.attribution, learning_component_year=self.practical_component ) self.client.force_login(self.person.user) self.url = reverse("update_attribution", args=[self.learning_unit_year.id, self.attribution.id]) self.patcher = patch.object(RulesRequiredMixin, "test_func", return_value=True) self.mocked_permission_function = self.patcher.start()
def setUpTestData(cls): cls.learning_unit_year = LearningUnitYearPartimFactory() cls.lecturing_component = LecturingLearningComponentYearFactory( learning_unit_year=cls.learning_unit_year) cls.practical_component = PracticalLearningComponentYearFactory( learning_unit_year=cls.learning_unit_year) cls.full_learning_unit_year = LearningUnitYearFullFactory( learning_container_year=cls.learning_unit_year. learning_container_year, academic_year=cls.learning_unit_year.academic_year) cls.lecturing_component_full = LecturingLearningComponentYearFactory( learning_unit_year=cls.full_learning_unit_year) cls.practical_component_full = PracticalLearningComponentYearFactory( learning_unit_year=cls.full_learning_unit_year) cls.person = PersonWithPermissionsFactory('can_access_learningunit')
def setUpTestData(cls): cls.learning_unit_year = LearningUnitYearFullFactory( learning_container_year__container_type=COURSE) cls.lecturing_component = LecturingLearningComponentYearFactory( learning_unit_year=cls.learning_unit_year) cls.practical_component = PracticalLearningComponentYearFactory( learning_unit_year=cls.learning_unit_year) cls.person = PersonWithPermissionsFactory('can_access_learningunit') cls.tutor = TutorFactory(person=cls.person) cls.url = reverse("add_attribution", args=[cls.learning_unit_year.id])
def setUpTestData(cls): cls.full_luy = LearningUnitYearFullFactory() cls.partim_luy_1 = LearningUnitYearPartimFactory( academic_year=cls.full_luy.academic_year, learning_container_year=cls.full_luy.learning_container_year) cls.partim_luy_2 = LearningUnitYearPartimFactory( academic_year=cls.full_luy.academic_year, learning_container_year=cls.full_luy.learning_container_year) cls.attribution_full = AttributionNewFactory( learning_container_year=cls.full_luy.learning_container_year) cls.full_lecturing_component = LecturingLearningComponentYearFactory( learning_unit_year=cls.full_luy) cls.full_practical_component = PracticalLearningComponentYearFactory( learning_unit_year=cls.full_luy) cls.partim_1_lecturing_component = \ LecturingLearningComponentYearFactory(learning_unit_year=cls.partim_luy_1) cls.partim_1_practical_component = \ PracticalLearningComponentYearFactory(learning_unit_year=cls.partim_luy_1) cls.partim_2_lecturing_component = \ LecturingLearningComponentYearFactory(learning_unit_year=cls.partim_luy_2) cls.partim_2_practical_component = \ PracticalLearningComponentYearFactory(learning_unit_year=cls.partim_luy_2) cls.charge_lecturing = AttributionChargeNewFactory( attribution=cls.attribution_full, learning_component_year=cls.full_lecturing_component, allocation_charge=20) cls.charge_practical = AttributionChargeNewFactory( attribution=cls.attribution_full, learning_component_year=cls.full_practical_component, allocation_charge=20) cls.attribution_partim_1 = cls.attribution_full cls.attribution_partim_1.id = None cls.attribution_partim_1.save() cls.attribution_partim_2 = cls.attribution_full cls.attribution_partim_2.id = None cls.attribution_partim_2.save()
def setUpTestData(cls): cls.education_group_year = EducationGroupYearFactory() cls.child_leaves = GroupElementYearChildLeafFactory.create_batch( 2, parent=cls.education_group_year, is_mandatory=True) for node, acronym in zip( cls.child_leaves, ["LCORS124" + str(i) for i in range(0, len(cls.child_leaves))]): node.child_leaf.acronym = acronym node.child_leaf.save() cls.luy_children = [child.child_leaf for child in cls.child_leaves] cls.workbook_contains = \ EducationGroupYearLearningUnitsContainedToExcel(cls.education_group_year, CustomXlsForm({}))._to_workbook() cls.sheet_contains = cls.workbook_contains.worksheets[0] generator_container = GenerateContainer( cls.education_group_year.academic_year, cls.education_group_year.academic_year) cls.luy = generator_container.generated_container_years[ 0].learning_unit_year_full cls.lecturing_component = LecturingLearningComponentYearFactory( learning_unit_year=cls.luy) cls.practical_component = PracticalLearningComponentYearFactory( learning_unit_year=cls.luy) cls.person_1 = PersonFactory(last_name='Dupont', first_name="Marcel", email="*****@*****.**") cls.person_2 = PersonFactory(last_name='Marseillais', first_name="Pol", email="*****@*****.**") cls.tutor_1 = TutorFactory(person=cls.person_1) cls.tutor_2 = TutorFactory(person=cls.person_2) cls.attribution_1 = AttributionNewFactory( tutor=cls.tutor_1, learning_container_year=cls.luy.learning_container_year) cls.charge_lecturing = AttributionChargeNewFactory( attribution=cls.attribution_1, learning_component_year=cls.lecturing_component) cls.charge_practical = AttributionChargeNewFactory( attribution=cls.attribution_1, learning_component_year=cls.practical_component) cls.attribution_2 = AttributionNewFactory( tutor=cls.tutor_2, learning_container_year=cls.luy.learning_container_year) cls.charge_lecturing = AttributionChargeNewFactory( attribution=cls.attribution_2, learning_component_year=cls.lecturing_component) cls.charge_practical = AttributionChargeNewFactory( attribution=cls.attribution_2, learning_component_year=cls.practical_component) cls.gey = GroupElementYearChildLeafFactory(child_leaf=cls.luy)
def test_warning_multiple_partims(self): """ In this test, we ensure that the warnings of partim_b doesn't show up while viewing partim_a identification information """ learning_unit_container_year = LearningContainerYearFactory( academic_year=self.generated_ac_years[0]) LearningUnitYearFactory( acronym="LCHIM1210", learning_container_year=learning_unit_container_year, subtype=learning_unit_year_subtypes.FULL, academic_year=self.generated_ac_years[0]) partim_a_with_warnings = LearningUnitYearFactory( acronym="LCHIM1210A", learning_container_year=learning_unit_container_year, subtype=learning_unit_year_subtypes.PARTIM, academic_year=self.generated_ac_years[0]) LecturingLearningComponentYearFactory( learning_unit_year=partim_a_with_warnings, hourly_volume_partial_q1=10, hourly_volume_partial_q2=10, hourly_volume_total_annual=10) partim_b_with_warnings = LearningUnitYearFactory( acronym="LCHIM1210B", learning_container_year=learning_unit_container_year, subtype=learning_unit_year_subtypes.PARTIM, academic_year=self.generated_ac_years[0]) LecturingLearningComponentYearFactory( learning_unit_year=partim_b_with_warnings, hourly_volume_partial_q1=10, hourly_volume_partial_q2=10, hourly_volume_total_annual=10) warning_messages = ''.join( str(e) for e in partim_a_with_warnings._check_learning_component_year_warnings()) self.assertIn(partim_a_with_warnings.acronym, warning_messages) self.assertNotIn(partim_b_with_warnings.acronym, warning_messages)
def setUpTestData(cls): cls.person = PersonWithPermissionsFactory('can_access_learningunit') cls.luy_without_attribution = LearningUnitYearFullFactory() cls.luy = LearningUnitYearFullFactory() cls.lecturing_component = LecturingLearningComponentYearFactory( learning_unit_year=cls.luy) cls.practical_component = PracticalLearningComponentYearFactory( learning_unit_year=cls.luy) cls.attribution = AttributionNewFactory( learning_container_year=cls.luy.learning_container_year) cls.charge_lecturing = AttributionChargeNewFactory( attribution=cls.attribution, learning_component_year=cls.lecturing_component) cls.charge_practical = AttributionChargeNewFactory( attribution=cls.attribution, learning_component_year=cls.practical_component)
def setUpTestData(cls): cls.person = PersonWithPermissionsFactory('can_access_learningunit') cls.learning_container_year = LearningContainerYearFactory( container_type=LearningContainerYearType.COURSE.name ) cls.learning_unit_year = LearningUnitYearFullFactory( learning_container_year=cls.learning_container_year ) cls.lecturing_component = LecturingLearningComponentYearFactory( learning_unit_year=cls.learning_unit_year) cls.practical_component = PracticalLearningComponentYearFactory( learning_unit_year=cls.learning_unit_year) cls.attribution = AttributionNewFactory( learning_container_year=cls.learning_unit_year.learning_container_year ) cls.charge_lecturing = AttributionChargeNewFactory( attribution=cls.attribution, learning_component_year=cls.lecturing_component ) cls.charge_practical = AttributionChargeNewFactory( attribution=cls.attribution, learning_component_year=cls.practical_component )