示例#1
0
 def setUp(self):
     today = datetime.date.today()
     self.faculty_user = factory_user.UserFactory()
     self.faculty_user.groups.add(
         Group.objects.get(name=FACULTY_MANAGER_GROUP))
     self.faculty_person = factory_person.PersonFactory(
         user=self.faculty_user)
     self.faculty_user.user_permissions.add(
         Permission.objects.get(codename='can_propose_learningunit'))
     self.faculty_user.user_permissions.add(
         Permission.objects.get(codename='can_create_learningunit'))
     self.super_user = factory_user.SuperUserFactory()
     self.person = factory_person.PersonFactory(user=self.super_user)
     self.academic_year = AcademicYearFactory.build(
         start_date=today.replace(year=today.year + 1),
         end_date=today.replace(year=today.year + 2),
         year=today.year + 1)
     super(AcademicYear, self.academic_year).save()
     self.language = LanguageFactory(code='FR')
     self.organization = organization_factory.OrganizationFactory(
         type=organization_type.MAIN)
     self.campus = campus_factory.CampusFactory(
         organization=self.organization, is_administration=True)
     self.entity = EntityFactory(organization=self.organization)
     self.entity_version = EntityVersionFactory(
         entity=self.entity,
         entity_type=entity_type.SCHOOL,
         start_date=today - datetime.timedelta(days=1),
         end_date=today.replace(year=today.year + 1))
     PersonEntityFactory(person=self.faculty_person, entity=self.entity)
示例#2
0
    def setUp(self):
        today = datetime.date.today()
        self.faculty_user = factory_user.UserFactory()
        self.faculty_user.groups.add(
            Group.objects.get(name=FACULTY_MANAGER_GROUP))
        self.faculty_person = factory_person.PersonFactory(
            user=self.faculty_user)
        self.faculty_user.user_permissions.add(
            Permission.objects.get(codename='can_propose_learningunit'))
        self.faculty_user.user_permissions.add(
            Permission.objects.get(codename='can_create_learningunit'))
        self.super_user = factory_user.SuperUserFactory()
        self.person = factory_person.PersonFactory(user=self.super_user)
        self.academic_years = GenerateAcademicYear(get_current_year(),
                                                   get_current_year() +
                                                   7).academic_years
        self.current_academic_year = self.academic_years[0]
        self.next_academic_year = self.academic_years[1]

        self.language = LanguageFactory(code='FR')
        self.organization = organization_factory.OrganizationFactory(
            type=organization_type.MAIN)
        self.campus = campus_factory.CampusFactory(
            organization=self.organization, is_administration=True)
        self.entity = EntityFactory(organization=self.organization)
        self.entity_version = EntityVersionFactory(
            entity=self.entity,
            entity_type=entity_type.FACULTY,
            start_date=today.replace(year=1900),
            end_date=None)

        PersonEntityFactory(person=self.faculty_person, entity=self.entity)
        PersonEntityFactory(person=self.person, entity=self.entity)
示例#3
0
    def setUpTestData(cls):
        today = datetime.date.today()
        FacultyManagerGroupFactory()
        cls.faculty_user = factory_user.UserFactory()
        cls.faculty_person = FacultyManagerFactory('can_propose_learningunit',
                                                   'can_create_learningunit',
                                                   user=cls.faculty_user)
        cls.super_user = factory_user.SuperUserFactory()
        cls.person = factory_person.CentralManagerFactory(user=cls.super_user)
        start_year = AcademicYearFactory(year=get_current_year())
        end_year = AcademicYearFactory(year=get_current_year() + 7)
        cls.academic_years = GenerateAcademicYear(start_year,
                                                  end_year).academic_years
        cls.current_academic_year = cls.academic_years[0]
        cls.next_academic_year = cls.academic_years[1]
        generate_creation_or_end_date_proposal_calendars(cls.academic_years)

        cls.language = LanguageFactory(code='FR')
        cls.organization = organization_factory.OrganizationFactory(
            type=organization_type.MAIN)
        cls.campus = campus_factory.CampusFactory(
            organization=cls.organization, is_administration=True)
        cls.entity = EntityFactory(organization=cls.organization)
        cls.entity_version = EntityVersionFactory(
            entity=cls.entity,
            entity_type=entity_type.FACULTY,
            start_date=today.replace(year=1900),
            end_date=None)

        PersonEntityFactory(person=cls.faculty_person, entity=cls.entity)
        PersonEntityFactory(person=cls.person, entity=cls.entity)