def setUpTestData(cls): academic_year = AcademicYearFactory(current=True) cls.education_group_parent = EducationGroupYearFactory( acronym="Parent", academic_year=academic_year) cls.education_group_child_1 = EducationGroupYearFactory( acronym="Child_1", academic_year=academic_year) cls.education_group_child_2 = EducationGroupYearFactory( acronym="Child_2", academic_year=academic_year) GroupElementYearFactory(parent=cls.education_group_parent, child_branch=cls.education_group_child_1) GroupElementYearFactory(parent=cls.education_group_parent, child_branch=cls.education_group_child_2) cls.education_group_language_parent = \ EducationGroupLanguageFactory(education_group_year=cls.education_group_parent) cls.education_group_language_child_1 = \ EducationGroupLanguageFactory(education_group_year=cls.education_group_child_1) cls.user = PersonWithPermissionsFactory( "can_access_education_group").user cls.url = reverse("education_group_read", args=[ cls.education_group_parent.id, cls.education_group_child_1.id ])
def setUpTestData(cls): today = datetime.date.today() academic_year = AcademicYearFactory( start_date=today, end_date=today.replace(year=today.year + 1), year=today.year) cls.education_group_parent = EducationGroupYearFactory( acronym="Parent", academic_year=academic_year) cls.education_group_child_1 = EducationGroupYearFactory( acronym="Child_1", academic_year=academic_year) cls.education_group_child_2 = EducationGroupYearFactory( acronym="Child_2", academic_year=academic_year) GroupElementYearFactory(parent=cls.education_group_parent, child_branch=cls.education_group_child_1) GroupElementYearFactory(parent=cls.education_group_parent, child_branch=cls.education_group_child_2) cls.education_group_language_parent = \ EducationGroupLanguageFactory(education_group_year=cls.education_group_parent) cls.education_group_language_child_1 = \ EducationGroupLanguageFactory(education_group_year=cls.education_group_child_1) cls.user = UserFactory() cls.user.user_permissions.add( Permission.objects.get(codename="can_access_education_group")) cls.url = reverse("education_group_read", args=[cls.education_group_child_1.id])
def setUp(self): academic_year = AcademicYearFactory() self.education_group_year = EducationGroupYearFactory(academic_year=academic_year) self.language = LanguageFactory() self.education_group_language_1 = EducationGroupLanguageFactory(education_group_year=self.education_group_year, language=self.language) self.education_group_language_2 = EducationGroupLanguageFactory(education_group_year=self.education_group_year, language=self.language)
def setUpTestData(cls): academic_year = AcademicYearFactory() cls.education_group_year = EducationGroupYearFactory( academic_year=academic_year) cls.language = LanguageFactory() cls.education_group_language_1 = EducationGroupLanguageFactory( education_group_year=cls.education_group_year, language=cls.language) cls.education_group_language_2 = EducationGroupLanguageFactory( education_group_year=cls.education_group_year, language=cls.language)
class EducationGroupLanguageTest(TestCase): def setUp(self): academic_year = AcademicYearFactory() self.education_group_year = EducationGroupYearFactory(academic_year=academic_year) self.language = LanguageFactory() self.education_group_language_1 = EducationGroupLanguageFactory(education_group_year=self.education_group_year, language=self.language) self.education_group_language_2 = EducationGroupLanguageFactory(education_group_year=self.education_group_year, language=self.language) def test_return_str_format(self): self.assertEqual( self.education_group_language_1.__str__(), "{} - {}".format( self.education_group_language_1.education_group_year, self.education_group_language_1.language ) )
def setUp(self): # Create small entities self.entity = EntityFactory(organization__type=organization_type.MAIN) self.entity_version = EntityVersionFactory( entity=self.entity, entity_type=entity_type.SECTOR) self.education_group_year = EducationGroupYearFactory( management_entity=self.entity, administration_entity=self.entity, academic_year=self.current_academic_year) # Create a group language EducationGroupLanguageFactory( education_group_year=self.education_group_year) # Create two secondary domains EducationGroupYearDomainFactory( education_group_year=self.education_group_year) EducationGroupYearDomainFactory( education_group_year=self.education_group_year)
class EducationGroupLanguageTest(TestCase): def setUp(self): academic_year = AcademicYearFactory() self.education_group_year = EducationGroupYearFactory( academic_year=academic_year) self.language = LanguageFactory() self.education_group_language_1 = EducationGroupLanguageFactory( education_group_year=self.education_group_year, language=self.language) self.education_group_language_2 = EducationGroupLanguageFactory( education_group_year=self.education_group_year, language=self.language) def test_return_str_format(self): self.assertEqual(self.education_group_language_1.__str__(), str(self.education_group_language_1.id)) def test_find_by_education_group_year(self): education_group_year = find_by_education_group_year( self.education_group_year.id) self.assertEqual(education_group_year.count(), 2)