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)
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)
def test_event_perm_modification_transformation_proposal_regular_user( self): person = person_factory.PersonFactory() event_perm = event_perms.generate_event_perm_learning_unit_edition( person) self.assertFalse(event_perm.is_open())
def test_event_perm_creation_end_date_proposal_regular_user(self): person = person_factory.PersonFactory() event_perm = event_perms.generate_event_perm_creation_end_date_proposal( person) self.assertFalse(event_perm.is_open())