Exemplo n.º 1
0
    def setUp(self):
        self.current_academic_year = AcademicYear(year=(now.year),
                                     start_date=datetime.date(now.year, now.month, 15),
                                     end_date=datetime.date(now.year + 1, now.month, 28))
        self.current_academic_year.save()

        self.current_academic_year_different = AcademicYear(year=(now.year)-1,
                                     start_date=datetime.date(now.year-1, now.month, 15),
                                     end_date=datetime.date(now.year + 2, now.month, 28))
        self.current_academic_year_different.save()
Exemplo n.º 2
0
class LearningComponentYearTest(TestCase):

    current_academic_year = None

    def setUp(self):
        self.current_academic_year = AcademicYear(
            year=(now.year),
            start_date=datetime.date(now.year, now.month, 15),
            end_date=datetime.date(now.year + 1, now.month, 28))
        self.current_academic_year.save()

        self.current_academic_year_different = AcademicYear(
            year=(now.year) - 1,
            start_date=datetime.date(now.year - 1, now.month, 15),
            end_date=datetime.date(now.year + 2, now.month, 28))
        self.current_academic_year_different.save()

    def test_creation_learning_unit_component_class_with_different_year(self):

        learning_container = LearningContainer()

        learning_container_year = LearningContainerYear(
            title="Biology",
            acronym="LBIO1212",
            academic_year=self.current_academic_year,
            learning_container=learning_container)
        #Composant annualisé est associé à son composant et à son conteneur annualisé
        learning_component_year = LearningComponentYear(
            learning_container_year=learning_container_year,
            title="Cours magistral",
            acronym="/C",
            comment="TEST")
        #Classe annualisée est associée à son composant et à son conteneur annualisé
        learning_class_year = LearningClassYear(
            learning_component_year=learning_component_year, acronym="/C1")

        #UE associée à un conteneur d'une année différente du composant
        learning_unit_year = LearningUnitYear(
            title="Biology",
            acronym="LBIO1212",
            academic_year=self.current_academic_year_different,
            learning_container_year=learning_container_year)
        #Association du conteneur et de son composant dont les années académiques diffèrent l'une de l'autre
        learning_unit_component = LearningUnitComponent(
            learning_component_year=learning_component_year,
            learning_unit_year=learning_unit_year)

        self.assertEqual(learning_unit_component.learning_component_year,
                         learning_class_year.learning_component_year)