def setUpTestData(cls): cls.an_user = user.UserFactory(username="******") cls.user_for_person = user.UserFactory(username="******") cls.person_without_user = PersonWithoutUserFactory() CentralManagerGroupFactory() FacultyManagerGroupFactory() ProgramManagerGroupFactory()
def setUp(self): self.an_user = user.UserFactory(username="******") self.user_for_person = user.UserFactory(username="******") self.person_with_user = PersonFactory(user=self.user_for_person, language="fr-be", first_name="John", last_name="Doe") self.person_without_user = PersonWithoutUserFactory()
def setUp(self): self.an_user = user.UserFactory(username="******") self.user_for_person = user.UserFactory(username="******") self.person_with_user = PersonFactory(user=self.user_for_person, language="fr-be", first_name="John", last_name="Doe") self.person_without_user = PersonWithoutUserFactory() CentralManagerGroupFactory() FacultyManagerGroupFactory() ProgramManagerGroupFactory()
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): self.user = user.UserFactory() self.user.save() self.person = create_person_with_user(self.user) self.structure = structure.StructureFactory() self.structure_children = structure.StructureFactory( part_of=self.structure) self.entity_manager = entity_manager.EntityManagerFactory( person=self.person, structure=self.structure) self.tutor = tutor.TutorFactory(person=self.person) self.academic_year = academic_year.AcademicYearFactory( year=datetime.date.today().year, start_date=datetime.date.today()) self.learning_unit_year = learning_unit_year.LearningUnitYearFactory( structure=self.structure, acronym="LBIR1210", academic_year=self.academic_year) self.learning_unit_year_children = learning_unit_year.LearningUnitYearFactory( structure=self.structure_children, acronym="LBIR1211", academic_year=self.academic_year) self.learning_unit_year_without_attribution = learning_unit_year.LearningUnitYearFactory( structure=self.structure, acronym="LBIR1212", academic_year=self.academic_year) self.attribution = create_attribution( tutor=self.tutor, learning_unit_year=self.learning_unit_year, score_responsible=True, summary_responsible=True) self.attribution_children = create_attribution( tutor=self.tutor, learning_unit_year=self.learning_unit_year_children, score_responsible=False)
def setUp(self): self.a_user = user.UserFactory(username="******") self.a_person = PersonFactory(user=self.a_user, language="fr-be", first_name="John", last_name="Doe") self.address = PersonAddressFactory(person=self.a_person)
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 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)
def test_change_language(self): usr = user.UserFactory() usr.save() create_person_with_user(usr) person.change_language(usr, "en") a_person = person.find_by_user(usr) self.assertEquals(a_person.language, "en")
def setUp(self): group, created = Group.objects.get_or_create(name='entity_managers') content_type = ContentType.objects.get_for_model(EntityManager) perm, created = Permission.objects.get_or_create( codename='is_entity_manager', content_type=content_type) group.permissions.add(perm) self.user = user.UserFactory() self.user.save() self.person = create_person_with_user(self.user) self.tutor = TutorFactory(person=self.person) self.academic_year = AcademicYearFactory( year=datetime.date.today().year, start_date=datetime.date.today()) # Old structure model [To remove] self.structure = structure.StructureFactory() self.structure_children = structure.StructureFactory( part_of=self.structure) # New structure model entities_hierarchy = create_entities_hierarchy() self.root_entity = entities_hierarchy.get('root_entity') self.child_one_entity = entities_hierarchy.get('child_one_entity') self.child_two_entity = entities_hierarchy.get('child_two_entity') self.entity_manager = EntityManagerFactory(person=self.person, structure=self.structure, entity=self.root_entity) # Create two learning_unit_year with context (Container + EntityContainerYear) self.learning_unit_year = create_learning_unit_with_context( academic_year=self.academic_year, structure=self.structure, entity=self.child_one_entity, acronym="LBIR1210") self.learning_unit_year_children = create_learning_unit_with_context( academic_year=self.academic_year, structure=self.structure_children, entity=self.child_two_entity, acronym="LBIR1211") self.attribution = test_attribution.create_attribution( tutor=self.tutor, learning_unit_year=self.learning_unit_year, score_responsible=True) self.attribution_children = test_attribution.create_attribution( tutor=self.tutor, learning_unit_year=self.learning_unit_year_children, score_responsible=True)
def setUp(self): self.user = user.UserFactory() self.user.save() self.person = create_person_with_user(self.user) self.tutor = TutorFactory(person=self.person) self.academic_year = AcademicYearFactory( year=datetime.date.today().year, start_date=datetime.date.today()) # Old structure model [To remove] self.structure = structure.StructureFactory() self.structure_children = structure.StructureFactory( part_of=self.structure) # New structure model self.create_new_entity() self.entity_manager = EntityManagerFactory(person=self.person, structure=self.structure, entity=self.root_entity) self.create_learning_units()
def setUp(self): self.user = user.UserFactory() self.user.save() self.person = create_person_with_user(self.user) self.tutor = TutorFactory(person=self.person) self.academic_year = AcademicYearFactory(year=datetime.date.today().year, start_date=datetime.date.today()) # Old structure model [To remove] self.structure = structure.StructureFactory() self.structure_children = structure.StructureFactory(part_of=self.structure) # New structure model entities_hierarchy = create_entities_hierarchy() self.root_entity = entities_hierarchy.get('root_entity') self.child_one_entity = entities_hierarchy.get('child_one_entity') self.child_two_entity = entities_hierarchy.get('child_two_entity') self.entity_manager = EntityManagerFactory( person=self.person, structure=self.structure, entity=self.root_entity) # Create two learning_unit_year with context (Container + EntityContainerYear) self.learning_unit_year = create_learning_unit_with_context( academic_year=self.academic_year, structure=self.structure, entity=self.child_one_entity, acronym="LBIR1210") self.learning_unit_year_children = create_learning_unit_with_context( academic_year=self.academic_year, structure=self.structure_children, entity=self.child_two_entity, acronym="LBIR1211") self.attribution = test_attribution.create_attribution( tutor=self.tutor, learning_unit_year=self.learning_unit_year, score_responsible=True) self.attribution_children = test_attribution.create_attribution( tutor=self.tutor, learning_unit_year=self.learning_unit_year_children, score_responsible=True)
def test_change_to_invalid_language(self): usr = user.UserFactory() usr.save() a_person = create_person_with_user(usr) person.change_language(usr, 'ru') self.assertNotEquals(a_person.language, "ru")
def test_get_user_interface_language_with_person_without_language(self): user_1 = user.UserFactory() PersonFactory(user=user_1, language=None) self.assertEqual(get_user_interface_language(user_1), "fr-be")
def setUpTestData(cls): cls.a_user = user.UserFactory(username="******") cls.a_person = PersonFactory(user=cls.a_user, language="fr-be", first_name="John", last_name="Doe") cls.address = PersonAddressFactory(person=cls.a_person)