Beispiel #1
0
    def test_find_gte_learning_units_year(self):
        learning_unit = LearningUnitFactory()
        dict_learning_unit_year = create_learning_units_year(2000, 2017, learning_unit)

        selected_learning_unit_year = dict_learning_unit_year[2007]

        result = list(selected_learning_unit_year.find_gte_learning_units_year().values_list('academic_year__year',
                                                                                             flat=True))
        self.assertListEqual(result, list(range(2007,2018)))
Beispiel #2
0
    def test_find_gte_learning_units_year_case_no_future(self):
        learning_unit = LearningUnitFactory()
        dict_learning_unit_year = create_learning_units_year(2000, 2017, learning_unit)

        selected_learning_unit_year = dict_learning_unit_year[2017]

        result = list(selected_learning_unit_year.find_gte_learning_units_year().values_list('academic_year__year',
                                                                                             flat=True))
        self.assertEqual(result, [2017])
Beispiel #3
0
    def test_next_acronym_with_acronym(self):
        learning_unit = LearningUnitFactory()
        dict_learning_unit_year = create_learning_units_year(
            2013, 2014, learning_unit)

        l_unit = dict_learning_unit_year.get(2014)
        new_acronym = "{}9".format(l_unit.acronym)
        l_unit.acronym = new_acronym
        l_unit.save()
        other_l_unit = dict_learning_unit_year.get(2013)

        self.assertEqual(get_next_acronym(other_l_unit), new_acronym)
    def test_previous_acronym_with_acronym(self):
        learning_unit = LearningUnitFactory()
        dict_learning_unit_year = create_learning_units_year(
            2013, 2013, learning_unit)

        l_unit = dict_learning_unit_year.get(2013)
        initial_acronym = l_unit.acronym
        new_acronym = "{}9".format(l_unit.acronym)
        l_unit.acronym = new_acronym
        l_unit.save()

        ProposalLearningUnitFactory(
            learning_unit_year=l_unit,
            initial_data={'learning_unit_year': {
                'acronym': initial_acronym
            }})

        self.assertEqual(get_previous_acronym(l_unit), initial_acronym)
    def test_previous_acronym(self):
        learning_unit = LearningUnitFactory()
        dict_learning_unit_year = create_learning_units_year(
            2013, 2016, learning_unit)

        lu_yr_1 = dict_learning_unit_year.get(2013)
        lu_yr_1.acronym = "LBIR1212"
        lu_yr_1.save()

        lu_yr_2 = dict_learning_unit_year.get(2014)
        lu_yr_2.acronym = "LBIR1213"
        lu_yr_2.save()

        lu_yr_3 = dict_learning_unit_year.get(2015)
        lu_yr_3.acronym = "LBIR1214"
        lu_yr_3.save()

        self.assertEqual(get_previous_acronym(lu_yr_3), 'LBIR1213')
        self.assertEqual(get_previous_acronym(lu_yr_2), 'LBIR1212')
        self.assertIsNone(get_previous_acronym(lu_yr_1))