Beispiel #1
0
 def setUpTestData(cls):
     cls.person = PersonFactory()
     cls.person.user.user_permissions.add(
         Permission.objects.get(
             codename="can_access_externallearningunityear"))
     cls.url = reverse("learning_units_external")
     AcademicYearFactory.produce_in_future(quantity=2)
    def setUpTestData(cls):
        cls.user = UserFactory()
        entity_version = EntityVersionFactory(acronym='ADRI')
        PartnershipEntityManagerFactory(
            entity=entity_version.entity,
            person__user=cls.user,
            scopes=[PartnershipType.GENERAL.name]
        )

        cls.partner = PartnerFactory()
        cls.partner_entity = PartnerEntityFactory(partner=cls.partner)

        AcademicYearFactory.produce_in_future(quantity=3)

        cls.education_field = DomainIscedFactory()
        cls.education_level = PartnershipYearEducationLevelFactory()

        cls.url = resolve_url('partnerships:create',
                              type=PartnershipType.GENERAL)

        # Ucl
        root = EntityVersionFactory(parent=None).entity
        sector = EntityVersionFactory(entity_type=SECTOR, parent=root).entity
        cls.ucl_university = EntityVersionFactory(
            parent=sector,
            entity_type=FACULTY,
        ).entity
        cls.ucl_university_labo = EntityVersionFactory(
            parent=cls.ucl_university,
        ).entity
        UCLManagementEntityFactory(entity=cls.ucl_university)

        cls.university_offer = EducationGroupYearFactory(
            administration_entity=cls.ucl_university_labo,
        )

        cls.data = {
            'partnership_type': PartnershipType.GENERAL.name,
            'comment': '',
            'partner': cls.partner.pk,
            'partner_entities': [cls.partner_entity.entity_id],
            'supervisor': PersonFactory().pk,
            'ucl_entity': cls.ucl_university.pk,
            'university_offers': [cls.university_offer.pk],
            'start_date': date.today(),
            'end_date': date.today() + timedelta(days=365),
            'year-is_sms': True,
            'year-is_smp': False,
            'year-is_sta': True,
            'year-is_stt': False,
            'year-education_fields': [cls.education_field.pk],
            'year-education_levels': [cls.education_level.pk],
            'year-entities': [],
            'year-offers': [],
            'year-funding_type': FundingTypeFactory().pk,
            'missions': PartnershipMissionFactory().pk,
            'subtype': PartnershipSubtypeFactory().pk,
        }
Beispiel #3
0
    def setUpTestData(cls):
        cls.user = UserFactory()
        entity_version = EntityVersionFactory(acronym='ADRI')
        PartnershipEntityManagerFactory(
            entity=entity_version.entity,
            person__user=cls.user,
            scopes=[PartnershipType.COURSE.name]
        )

        cls.partner = PartnerFactory()
        cls.partner_entity = PartnerEntityFactory(partner=cls.partner)

        AcademicYearFactory.produce_in_future(quantity=3)

        cls.education_field = DomainIscedFactory()
        cls.education_level = PartnershipYearEducationLevelFactory()

        cls.url = reverse(
            'partnerships:create',
            kwargs={'type': PartnershipType.COURSE},
        )

        cls.start_academic_year = AcademicYearFactory(year=2150)
        cls.end_academic_year = AcademicYearFactory(year=2151)

        # Ucl
        root = EntityVersionFactory(parent=None).entity
        sector = EntityVersionFactory(entity_type=SECTOR, parent=root).entity
        cls.ucl_university = EntityVersionFactory(
            parent=sector,
            entity_type=FACULTY,
        ).entity
        cls.ucl_university_labo = EntityVersionFactory(
            parent=cls.ucl_university,
        ).entity
        UCLManagementEntityFactory(entity=cls.ucl_university)

        cls.university_offer = EducationGroupYearFactory(administration_entity=cls.ucl_university_labo)

        cls.data = {
            'partnership_type': PartnershipType.COURSE.name,
            'comment': '',
            'partner': cls.partner.pk,
            'partner_entities': [cls.partner_entity.entity_id],
            'supervisor': PersonFactory().pk,
            'ucl_entity': cls.ucl_university.pk,
            'university_offers': [cls.university_offer.pk],
            'year-education_fields': [cls.education_field.pk],
            'year-education_levels': [cls.education_level.pk],
            'year-entities': [],
            'year-offers': [],
            'year-start_academic_year': cls.start_academic_year.pk,
            'year-end_academic_year': cls.end_academic_year.pk,
            'year-funding_type': FundingTypeFactory().pk,
            'missions': PartnershipMissionFactory().pk,
            'subtype': PartnershipSubtypeFactory().pk,
        }
    def setUpTestData(cls):
        cls.user = UserFactory()
        entity_version = EntityVersionFactory(acronym='ADRI')
        PartnershipEntityManagerFactory(entity=entity_version.entity,
                                        person__user=cls.user,
                                        scopes=[PartnershipType.PROJECT.name])

        cls.partner = PartnerFactory()
        cls.partner_entity = PartnerEntityFactory(partner=cls.partner)

        AcademicYearFactory.produce_in_future(quantity=3)

        cls.education_field = DomainIscedFactory()
        cls.education_level = PartnershipYearEducationLevelFactory()

        cls.url = reverse(
            'partnerships:create',
            kwargs={'type': PartnershipType.PROJECT},
        )

        # Ucl
        root = EntityVersionFactory(parent=None).entity
        sector = EntityVersionFactory(entity_type=SECTOR, parent=root).entity
        cls.ucl_university = EntityVersionFactory(
            parent=sector,
            entity_type=FACULTY,
        ).entity
        cls.ucl_university_labo = EntityVersionFactory(
            parent=cls.ucl_university, ).entity
        UCLManagementEntityFactory(entity=cls.ucl_university)

        cls.university_offer = EducationGroupYearFactory(
            administration_entity=cls.ucl_university_labo)

        cls.data = {
            'partnership_type': PartnershipType.PROJECT.name,
            'comment': '',
            'partner': cls.partner.pk,
            'partner_entities': [cls.partner_entity.entity_id],
            'supervisor': PersonFactory().pk,
            'ucl_entity': cls.ucl_university.pk,
            'university_offers': [cls.university_offer.pk],
            'start_date': date.today(),
            'end_date': date.today() + timedelta(days=365),
            'year-education_fields': [cls.education_field.pk],
            'year-education_levels': [cls.education_level.pk],
            'missions': PartnershipMissionFactory().pk,
            'year-funding': 'fundingtype-%s' % FundingTypeFactory().pk,
            'project_title': "Project title 1",
            'id_number': "#132456",
            'ucl_status': "coordinator",
        }
        PartnershipMissionFactory()
    def setUpTestData(cls):
        cls.user_adri = UserFactory()
        entity_version = EntityVersionFactory(acronym='ADRI')
        PartnershipEntityManagerFactory(
            entity=entity_version.entity,
            person__user=cls.user_adri,
            scopes=[PartnershipType.GENERAL.name]
        )

        # Partnership creation
        cls.partnership = PartnershipFactory(
            partnership_type=PartnershipType.GENERAL.name,
        )

        # Misc
        cls.url = reverse('partnerships:agreements:create', kwargs={
            'partnership_pk': cls.partnership.pk,
        })
        cls.years = AcademicYearFactory.produce_in_future(quantity=3)

        cls.data = {
            'start_date': date.today(),
            'end_date': date.today() + timedelta(days=365),
            'status': AgreementStatus.WAITING.name,
            'comment': 'test',
            'media-name': 'test',
            'media-description': 'test',
            'media-file': ContentFile(b'hello world', 'something.pdf'),
            'media-visibility': MediaVisibility.PUBLIC.name,
        }
Beispiel #6
0
    def setUpTestData(cls):
        cls.person = PersonFactory()
        cls.user = cls.person.user
        cls.tutor = TutorFactory(person=cls.person)
        cls.current_ac_year = create_current_academic_year()
        ac_year_in_past = AcademicYearFactory.produce_in_past(
            cls.current_ac_year.year)
        cls.ac_year_in_future = AcademicYearFactory.produce_in_future(
            cls.current_ac_year.year)

        cls.academic_calendar = OpenAcademicCalendarFactory(
            academic_year=cls.current_ac_year,
            data_year=cls.current_ac_year,
            reference=academic_calendar_type.SUMMARY_COURSE_SUBMISSION)
        requirement_entity = EntityVersionFactory().entity
        # Create multiple attribution in different academic years
        for ac_year in ac_year_in_past + [cls.current_ac_year
                                          ] + cls.ac_year_in_future:
            learning_container_year = LearningContainerYearFactory(
                academic_year=ac_year, requirement_entity=requirement_entity)
            learning_unit_year = LearningUnitYearFactory(
                summary_locked=False,
                academic_year=ac_year,
                learning_container_year=learning_container_year)
            AttributionFactory(
                tutor=cls.tutor,
                summary_responsible=True,
                learning_unit_year=learning_unit_year,
            )
        cls.url = reverse(list_my_attributions_summary_editable)
 def setUpTestData(cls):
     cls.language_fr = LanguageFactory(code="FR")
     cls.language_en = LanguageFactory(code="EN")
     cls.user = UserFactory()
     flag, created = Flag.objects.get_or_create(name='learning_achievement_update')
     flag.users.add(cls.user)
     cls.person = PersonWithPermissionsFactory("can_access_learningunit", "can_create_learningunit", user=cls.user)
     cls.person_entity = PersonEntityFactory(person=cls.person)
     EntityVersionFactory(entity=cls.person_entity.entity)
     cls.academic_years = AcademicYearFactory.produce_in_future(quantity=5)
     cls.max_la_number = 2*len(cls.academic_years)
     cls.learning_unit = LearningUnitFactory(start_year=cls.academic_years[0], end_year=cls.academic_years[-1])
     cls.learning_container = LearningContainerFactory()
     cls.learning_unit_years = [LearningUnitYearFactory(
         academic_year=academic_year,
         subtype=learning_unit_year_subtypes.FULL,
         learning_container_year=LearningContainerYearFactory(
             academic_year=academic_year,
             learning_container=cls.learning_container,
             requirement_entity=cls.person_entity.entity
         ),
         learning_unit=cls.learning_unit,
         acronym="TEST0000"
     ) for academic_year in cls.academic_years]
     cls.learning_component_years = [LearningComponentYearFactory(
         learning_unit_year=luy,
     ) for luy in cls.learning_unit_years]
Beispiel #8
0
 def setUpTestData(cls):
     cls.current_academic_year, *cls.future_academic_years = AcademicYearFactory.produce_in_future(
         quantity=6)
     cls.learning_unit_year, *cls.future_learning_unit_years = [
         LearningUnitYearFactory(subtype=FULL, academic_year=acy)
         for acy in ([cls.current_academic_year] +
                     cls.future_academic_years)
     ]
     cls.person = _get_central_manager_person_with_permission()
    def setUpTestData(cls):
        cls.language_fr = LanguageFactory(code="FR")
        cls.language_en = LanguageFactory(code="EN")
        cls.user = UserFactory()
        cls.person = PersonWithPermissionsFactory("can_access_learningunit", "can_create_learningunit", user=cls.user)
        cls.a_superuser = SuperUserFactory()
        cls.superperson = PersonFactory(user=cls.a_superuser)

        cls.person_entity = PersonEntityFactory(person=cls.superperson)

        cls.academic_year = create_current_academic_year()
        AcademicYearFactory.produce_in_future(quantity=2)
        cls.luy = LearningUnitYearFactory(
            academic_year=cls.academic_year,
            subtype=learning_unit_year_subtypes.FULL,
            learning_container_year__requirement_entity=cls.person_entity.entity,
        )
        cls.future_luy = LearningUnitYearFactory(
            academic_year=cls.academic_year.next(),
            learning_unit=cls.luy.learning_unit,
        )
Beispiel #10
0
    def setUpTestData(cls):
        cls.current_academic_year, *cls.academic_years = AcademicYearFactory.produce_in_future(
            quantity=8)

        AcademicCalendarFactory(
            data_year=cls.current_academic_year,
            start_date=datetime.datetime(cls.current_academic_year.year - 2, 9,
                                         15),
            end_date=datetime.datetime(cls.current_academic_year.year + 1, 9,
                                       14),
            reference=LEARNING_UNIT_EDITION_FACULTY_MANAGERS)
        cls.a_superuser = SuperUserFactory()
        cls.person = PersonFactory(user=cls.a_superuser)
Beispiel #11
0
    def setUpTestData(cls):
        cls.academic_years = AcademicYearFactory.produce_in_future(quantity=6)
        cls.academic_calendars = [
            AcademicCalendarFactory(academic_year=cls.academic_years[i])
            for i in range(len(cls.academic_years))
        ]

        cls.academic_calendars[2].reference = academic_calendar_type.TESTING
        cls.academic_calendars[2].save()

        cls.person = PersonWithPermissionsFactory(
            "can_access_academic_calendar", user__superuser=True)
        cls.url = reverse('academic_calendars')
Beispiel #12
0
    def setUpTestData(cls):
        cls.master_type = EducationGroupTypeFactory(
            category=education_group_categories.TRAINING,
            name=education_group_types.TrainingType.MASTER_MA_120.name,
        )
        cls.finality_type = EducationGroupTypeFactory(
            category=education_group_categories.GROUP,
            name=education_group_types.GroupType.FINALITY_120_LIST_CHOICE.name,
            external_id="osis.education_group_type_finality120listchoice")
        cls.major_type = EducationGroupTypeFactory(
            category=education_group_categories.GROUP,
            name=education_group_types.GroupType.MAJOR_LIST_CHOICE.name,
            external_id="osis.education_group_type_majorlistchoice")

        cls.current_academic_year, cls.next_academic_year = AcademicYearFactory.produce_in_future(
            quantity=2)

        cls.auth_rel = AuthorizedRelationshipFactory(
            parent_type=cls.master_type,
            child_type=cls.finality_type,
            min_count_authorized=1,
        )
        cls.validation_rule_title = ValidationRuleFactory(
            field_reference=
            "base_educationgroupyear.title.osis.education_group_type_finality120listchoice",
            initial_value="Liste au choix de Finalités",
        )
        cls.validation_rule_partial_acronym = ValidationRuleFactory(
            field_reference=
            "base_educationgroupyear.partial_acronym.osis.education_group_type_finality120listchoice",
            initial_value="400G",
        )

        cls.validation_rule_title_major = ValidationRuleFactory(
            field_reference=
            "base_educationgroupyear.title.osis.education_group_type_majorlistchoice",
            initial_value="Majeure",
        )
        cls.validation_rule_partial_acronym_major = ValidationRuleFactory(
            field_reference=
            "base_educationgroupyear.partial_acronym.osis.education_group_type_majorlistchoice",
            initial_value="200K",
        )
Beispiel #13
0
 def setUpTestData(cls):
     cls.current_academic_year, *cls.future_academic_years = AcademicYearFactory.produce_in_future(
         quantity=6)
     learning_unit = LearningUnitFactory()
     cls.learning_unit_year, *cls.future_learning_unit_years = [
         LearningUnitYearFactory(subtype=FULL,
                                 academic_year=acy,
                                 learning_unit=learning_unit)
         for acy in ([cls.current_academic_year] +
                     cls.future_academic_years)
     ]
     cls.previous_luy = LearningUnitYearFactory(
         subtype=FULL,
         academic_year=AcademicYearFactory(
             year=cls.current_academic_year.year - 1),
         learning_unit=learning_unit)
     cls.url = reverse(
         'teaching_material_create',
         kwargs={'learning_unit_year_id': cls.learning_unit_year.id})
     cls.person = _get_central_manager_person_with_permission()
    def setUpTestData(cls):
        cls.user = UserFactory()
        cls.user_adri = UserFactory()
        entity_version = EntityVersionFactory(acronym='ADRI')
        PartnershipEntityManagerFactory(entity=entity_version.entity, person__user=cls.user_adri)

        cls.academic_year = AcademicYearFactory.produce_in_future(quantity=3)[-1]
        PartnershipConfiguration.objects.create(
            partnership_creation_update_min_year=cls.academic_year,
        )

        cls.url = resolve_url('partnerships:financings:list')
        cls.create_url = resolve_url('partnerships:financings:add', model='source')
        source = FundingSourceFactory(name="Bar")
        cls.edit_url = resolve_url(
            'partnerships:financings:edit', model=source, pk=source.pk
        )
        cls.delete_url = resolve_url(
            'partnerships:financings:delete', model=source, pk=source.pk
        )
Beispiel #15
0
    def setUpTestData(cls):
        cls.url = reverse('partnerships:autocomplete:partnership_year_offers')

        academic_year = AcademicYearFactory.produce_in_future(quantity=3)[-1]
        PartnershipConfiguration.objects.create(
            partnership_creation_update_min_year=academic_year,
        )

        # university_offer
        cls.university_offer = EducationGroupYearFactory(
            joint_diploma=True,
            academic_year=academic_year
        )

        # education_level
        cls.education_level = PartnershipYearEducationLevelFactory()
        cls.education_level.education_group_types.add(
            cls.university_offer.education_group_type
        )

        cls.user = PartnershipEntityManagerFactory().person.user
    def setUpTestData(cls):
        cls.language = LanguageFactory(code="EN")
        cls.person = PersonFactory()
        cls.person.user.user_permissions.add(
            Permission.objects.get(codename="can_edit_learningunit_pedagogy"))
        cls.current_ac = AcademicYearFactory(current=True)
        cls.past_ac_years = AcademicYearFactory.produce_in_past(
            cls.current_ac.year - 1, 5)
        cls.future_ac_years = AcademicYearFactory.produce_in_future(
            cls.current_ac.year + 1, 5)

        cls.current_luy = LearningUnitYearFactory(
            learning_container_year__academic_year=cls.current_ac,
            academic_year=cls.current_ac,
            acronym="LAGRO1000",
            subtype=FULL)
        cls.luys = {cls.current_ac.year: cls.current_luy}
        cls.luys.update(
            _duplicate_learningunityears(cls.current_luy,
                                         academic_years=cls.past_ac_years +
                                         cls.future_ac_years))
Beispiel #17
0
    def setUpTestData(cls):
        for i in range(50):
            CountryFactory()
        cls.selected_countries_1 = Country.objects.all()[:20]
        cls.selected_countries_2 = Country.objects.all()[20:30]
        cls.academic_year_1 = AcademicYearFactory.produce_in_future(
            quantity=3)[-1]
        cls.academic_year_2 = AcademicYearFactory()
        PartnershipConfiguration.objects.create(
            partnership_creation_update_min_year=cls.academic_year_1, )
        cls.financing_1 = FinancingFactory(academic_year=cls.academic_year_1)
        cls.financing_1.countries.set(cls.selected_countries_1)
        cls.financing_2 = FinancingFactory(academic_year=cls.academic_year_2)
        cls.financing_2.countries.set(cls.selected_countries_2)

        cls.user = UserFactory()
        cls.user_adri = UserFactory()
        entity_version = EntityVersionFactory(acronym='ADRI')
        PartnershipEntityManagerFactory(entity=entity_version.entity,
                                        person__user=cls.user_adri)

        cls.url = resolve_url('partnerships:financings:list',
                              year=cls.academic_year_1.year)
        cls.default_url = resolve_url('partnerships:financings:list')
    def setUpTestData(cls):

        class EducationGroupYearFactory(BaseEducationGroupYearFactory):
            management_entity = None
            administration_entity = None
            enrollment_campus = None

        cls.url = reverse('partnership_api_v1:configuration')

        AcademicYearFactory.produce_in_future(quantity=2)
        current_academic_year = PartnershipConfiguration.get_configuration().get_current_academic_year_for_api()

        # Partnerships
        cls.supervisor_partnership = PersonFactory()
        cls.supervisor_management_entity = PersonFactory()

        partnership = PartnershipFactory(
            supervisor=cls.supervisor_partnership,
            years=[]
        )
        year = PartnershipYearFactory(
            partnership=partnership,
            academic_year=current_academic_year,
        )
        year.offers.add(EducationGroupYearFactory())
        education_field = DomainIscedFactory(title_en='foo', title_fr='bar')
        year.education_fields.add(education_field)
        PartnershipAgreementFactory(
            partnership=partnership,
            start_academic_year=current_academic_year,
            end_academic_year__year=current_academic_year.year + 1,
        )

        root = EntityWithVersionFactory()
        parent = EntityVersionFactory(acronym="SSH", entity_type=SECTOR, parent=root)
        partnership = PartnershipFactory(
            partner__contact_address=True,
            years__academic_year=current_academic_year,
            ucl_entity=EntityVersionFactory(
                acronym="FIAL", entity_type=FACULTY, parent=parent.entity,
            ).entity,
        )
        PartnershipAgreementFactory(
            partnership=partnership,
            start_academic_year=current_academic_year,
            end_academic_year__year=current_academic_year.year + 1,
        )
        UCLManagementEntityFactory(
            entity=partnership.ucl_entity,
            academic_responsible=cls.supervisor_management_entity
        )
        FundingSource.objects.all().delete()
        FundingTypeFactory()

        # Some noises
        cls.noisy_partner = PartnerFactory()
        cls.noisy_partnership = PartnershipFactory()

        # Continents
        continent = Continent.objects.create(code='AA', name='aaaaa')
        CountryFactory(continent=continent)
        CountryFactory(continent=continent)
        CountryFactory()
    def setUpTestData(cls):
        cls.user = UserFactory()
        cls.user_adri = UserFactory()
        cls.user_gs = UserFactory()
        cls.user_gf = UserFactory()
        cls.user_other_gf = UserFactory()
        cls.user_2_types = UserFactory()

        root = EntityVersionFactory(parent=None).entity
        entity_version = EntityVersionFactory(acronym='ADRI', parent=root)
        PartnershipEntityManagerFactory(
            entity=entity_version.entity,
            person__user=cls.user_adri,
        )
        PartnershipEntityManagerFactory(entity=entity_version.entity,
                                        person__user=cls.user_2_types,
                                        scopes=[
                                            PartnershipType.MOBILITY.name,
                                            PartnershipType.GENERAL.name
                                        ])

        cls.partner = PartnerFactory()
        cls.partner_entity = PartnerEntityFactory(partner=cls.partner)
        cls.partner_entity_2 = PartnerEntityFactory(partner=cls.partner)

        cls.start_academic_year = AcademicYearFactory(year=2150)
        cls.end_academic_year = AcademicYearFactory(year=2151)
        AcademicYearFactory.produce_in_future(quantity=3)

        cls.education_field = DomainIscedFactory()
        cls.education_level = PartnershipYearEducationLevelFactory()

        cls.url = reverse('partnerships:create')
        cls.mobility_url = reverse(
            'partnerships:create',
            kwargs={'type': PartnershipType.MOBILITY},
        )

        # Ucl
        sector = EntityVersionFactory(
            parent=root,
            entity_type=SECTOR,
        ).entity
        cls.ucl_university = EntityVersionFactory(
            parent=sector,
            entity_type=FACULTY,
        ).entity
        cls.ucl_university_labo = EntityVersionFactory(
            parent=cls.ucl_university, ).entity
        UCLManagementEntityFactory(entity=cls.ucl_university)
        UCLManagementEntityFactory()

        cls.ucl_university_not_choice = EntityVersionFactory(
            entity_type=FACULTY, ).entity
        cls.ucl_university_labo_not_choice = EntityVersionFactory(
            parent=cls.ucl_university_not_choice, ).entity
        cls.university_offer = EducationGroupYearFactory(
            administration_entity=cls.ucl_university_labo)

        PartnershipEntityManagerFactory(person__user=cls.user_gs,
                                        entity=sector)
        PartnershipEntityManagerFactory(person__user=cls.user_gf,
                                        entity=cls.ucl_university)
        PartnershipEntityManagerFactory(person__user=cls.user_other_gf,
                                        entity=cls.ucl_university)
        PartnershipEntityManagerFactory(person__user=cls.user_2_types,
                                        entity=cls.ucl_university)

        cls.data = {
            'partnership_type': PartnershipType.MOBILITY.name,
            'comment': '',
            'partner': cls.partner.pk,
            'partner_entities': [cls.partner_entity.entity_id],
            'supervisor': '',
            'ucl_entity': cls.ucl_university.pk,
            'university_offers': [cls.university_offer.pk],
            'year-is_sms': True,
            'year-is_smp': False,
            'year-is_sta': True,
            'year-is_stt': False,
            'year-education_fields': [cls.education_field.pk],
            'year-education_levels': [cls.education_level.pk],
            'year-entities': [],
            'year-offers': [],
            'year-start_academic_year': cls.start_academic_year.pk,
            'year-end_academic_year': cls.end_academic_year.pk,
            'missions': [PartnershipMissionFactory().pk],
        }
Beispiel #20
0
    def setUpTestData(cls):
        cls.url = reverse('partnership_api_v1:partnerships')

        AcademicYearFactory.produce_in_future(quantity=3)
        config = PartnershipConfiguration.get_configuration()
        current_academic_year = config.get_current_academic_year_for_api()
        cls.current_academic_year = current_academic_year

        # Continents
        cls.continent = Continent.objects.create(code='AA', name='aaaaa')
        cls.country = CountryFactory(
            name="Albania",
            iso_code='AL',
            continent=cls.continent,
        )
        CountryFactory(continent=cls.continent)
        CountryFactory()

        # Partnerships
        root = EntityVersionFactory(parent=None, acronym="UCL").entity
        sector = EntityVersionFactory(parent=root, acronym="SSH").entity
        entity = EntityVersionFactory(parent=sector, acronym="FIAL").entity
        cls.supervisor_partnership = PersonFactory()
        cls.supervisor_management_entity = PersonFactory()
        cls.funding_type = FundingTypeFactory()
        cls.funding_program = cls.funding_type.program
        cls.funding_source = cls.funding_program.source
        cls.subtype = PartnershipSubtypeFactory()

        cls.partnership = PartnershipFactory(
            ucl_entity=entity,
            supervisor=cls.supervisor_partnership,
            years=[],
            partner__contact_address__country=cls.country,
            partner__contact_address__city="Tirana",
            subtype=cls.subtype,
        )
        cls.partner = cls.partnership.partner_entities.first(
        ).organization.partner
        year = PartnershipYearFactory(
            partnership=cls.partnership,
            academic_year=current_academic_year,
            is_smp=True,
            eligible=False,
            funding_source=cls.funding_source,
            funding_program=cls.funding_program,
            funding_type=cls.funding_type,
        )
        cls.education_field = DomainIscedFactory()
        year.education_fields.add(cls.education_field)
        PartnershipAgreementFactory(
            partnership=cls.partnership,
            start_academic_year=current_academic_year,
            end_academic_year__year=current_academic_year.year + 1,
            status=AgreementStatus.VALIDATED.name,
            media__is_visible_in_portal=False,
        )
        cls.management_entity = UCLManagementEntityFactory(
            entity=cls.partnership.ucl_entity, )

        partnership_without_funding = PartnershipFactory(
            ucl_entity=EntityVersionFactory(parent=sector,
                                            acronym="DRT").entity,
            years=[],
        )
        PartnershipYearFactory(
            partnership=partnership_without_funding,
            academic_year=current_academic_year,
        )
        PartnershipAgreementFactory(
            partnership=partnership_without_funding,
            start_academic_year=current_academic_year,
            end_academic_year__year=current_academic_year.year + 1,
            status=AgreementStatus.VALIDATED.name,
        )
        UCLManagementEntityFactory(
            entity=partnership_without_funding.ucl_entity,
            contact_in_person=None,
            contact_out_person=None,
        )

        cls.partnership_2 = PartnershipFactory(
            supervisor=None,
            years__academic_year=current_academic_year,
            partner__contact_address__country__name="Zambia",
            partner__contact_address__country__iso_code="ZM",
            partner__contact_address__city="Lusaka",
            partner__contact_address__location=Point(-15.4166, 28.2822),
        )
        cls.partner_2 = cls.partnership_2.partner_entities.first(
        ).organization.partner
        PartnershipAgreementFactory(
            partnership=cls.partnership_2,
            start_academic_year=current_academic_year,
            end_academic_year__year=current_academic_year.year + 1,
            status=AgreementStatus.VALIDATED.name,
        )
        cls.management_entity = UCLManagementEntityFactory(
            entity=cls.partnership_2.ucl_entity,
            academic_responsible=cls.supervisor_management_entity,
            contact_out_person=None,
            contact_in_person=None,
        )
        cls.financing = FinancingFactory(academic_year=current_academic_year)
        cls.financing.countries.add(cls.partner_2.contact_address.country)

        # Other types
        cls.partnership_project = PartnershipFactory(
            partnership_type=PartnershipType.PROJECT.name,
            start_date=date(current_academic_year.year, 1, 1),
            end_date=date(current_academic_year.year, 10, 1),
            partner__contact_address__country__iso_code="ZM",
            partner__contact_address__city="Ndola",
        )
        PartnershipYearFactory(
            partnership=cls.partnership_project,
            academic_year=current_academic_year,
            funding_source=FundingSourceFactory(),
        )

        # Multilateral
        cls.partnership_course = PartnershipFactory(
            partnership_type=PartnershipType.COURSE.name,
            start_date=date(current_academic_year.year, 1, 1),
            end_date=date(current_academic_year.year + 1, 10, 1),
        )
        entity = EntityWithVersionFactory(organization__type=ACADEMIC_PARTNER)
        cls.partnership_course.partner_entities.add(entity)
        PartnerFactory(organization=entity.organization)

        cls.partnership_general = PartnershipFactory(
            partnership_type=PartnershipType.GENERAL.name,
            start_date=date(current_academic_year.year - 1, 1, 1),
            end_date=date(current_academic_year.year + 3, 10, 1),
            partner__contact_address__country__iso_code="ZM",
            partner__contact_address__city="Kabwe",
            partner__contact_address__location=Point(-14.4415250, 28.4441831),
            years=[
                PartnershipYearFactory(academic_year=current_academic_year)
            ],
        )
        PartnershipAgreementFactory(
            partnership=cls.partnership_general,
            start_date=date(current_academic_year.year - 10, 10, 1),
            end_date=date(current_academic_year.year + 7, 10, 1),
            status=AgreementStatus.VALIDATED.name,
        )

        # Some noises - Agreement not validated or not in status validated
        PartnerFactory()
        cls.partnership_without_agreement = PartnershipFactory()
        cls.partnership_not_public = PartnershipFactory(is_public=False)

        cls.partnership_with_agreement_not_validated = PartnershipFactory(
            supervisor=None,
            years__academic_year=current_academic_year,
        )
        PartnershipAgreementFactory(
            partnership=cls.partnership_with_agreement_not_validated,
            start_academic_year=current_academic_year,
            end_academic_year__year=current_academic_year.year + 1,
            status=AgreementStatus.WAITING.name,
        )