def _get_post_data_with_different_entities_container_year(self, container_type):
     container_year = LearningContainerYearFactory.build(academic_year=self.current_academic_year,
                                                         container_type=container_type)
     learning_unit_year = LearningUnitYearFactory.build(academic_year=self.current_academic_year,
                                                        learning_container_year=container_year,
                                                        subtype=learning_unit_year_subtypes.FULL)
     post_data = get_valid_form_data(self.current_academic_year, person=self.person,
                                     learning_unit_year=learning_unit_year)
     post_data['allocation_entity-entity'] = EntityVersionFactory().id
     return post_data
Ejemplo n.º 2
0
    def test_get_components_with_classes(self):
        l_container = LearningContainerFactory()
        l_container_year = LearningContainerYearFactory.build(
            academic_year=self.current_academic_year,
            title="LC-98998",
            learning_container=l_container)
        l_container_year.save()
        l_component_year = LearningComponentYearFactory(
            learning_container_year=l_container_year)
        LearningClassYearFactory(learning_component_year=l_component_year)
        LearningClassYearFactory(learning_component_year=l_component_year)
        learning_unit_year = LearningUnitYearFactory(
            academic_year=self.current_academic_year,
            learning_container_year=l_container_year)

        components = learning_unit_view.get_same_container_year_components(
            learning_unit_year, True)
        self.assertEqual(len(components), 1)
        self.assertEqual(len(components[0]['learning_component_year'].classes),
                         2)