def test_search_learning_units_by_city(self): form_data = { "city": NAMEN, } form = ExternalLearningUnitYearForm(form_data) self.assertTrue(form.is_valid()) self.assertCountEqual(form.get_activity_learning_units(), [self.external_lu_1.learning_unit_year])
def test_search_learning_units_on_acronym(self): form_data = { "acronym": self.external_lu_1.learning_unit_year.acronym, } form = ExternalLearningUnitYearForm(form_data) self.assertTrue(form.is_valid()) self.assertCountEqual(form.get_activity_learning_units(), [self.external_lu_1.learning_unit_year])
def test_search_learning_units_by_campus(self): form_data = { "campus": self.be_campus_1.id, } form = ExternalLearningUnitYearForm(form_data) self.assertTrue(form.is_valid()) self.assertCountEqual(form.get_activity_learning_units(), [self.external_lu_BE_1])
def test_search_learning_units_by_country(self): form_data = { "country": self.external_lu_1.learning_unit_year.campus.organization.country.id, } form = ExternalLearningUnitYearForm(form_data) self.assertTrue(form.is_valid()) self.assertCountEqual(form.get_activity_learning_units(), [ self.external_lu_1.learning_unit_year, self.external_lu_2.learning_unit_year])
def test_assert_ignore_external_learning_units_of_type_mobility(self): original_count = LearningUnitYear.objects.filter(externallearningunityear__co_graduation=True, externallearningunityear__mobility=False).count() ExternalLearningUnitYearFactory( learning_unit_year__academic_year=self.academic_year, mobility=True, co_graduation=False, learning_unit_year__acronym="XTEST1234", ) form_data = { "academic_year": self.academic_year.id, } form = ExternalLearningUnitYearForm(form_data) self.assertTrue(form.is_valid()) self.assertEqual(form.get_activity_learning_units().count(), original_count)