Пример #1
0
    def test_not_allowed_perms(self):
        teacher = create_teacher()
        f_mng = FacultyManagement(combine_faculty(FacultyTypes.tech))
        f_mng.set_manager(teacher)

        self.assertRaises(NotAllowedException, f_mng.hire, StaffType.teachers,
                          create_teacher(), 'teacher')
Пример #2
0
    def test_dismiss_skipped_students(self):
        faculty = combine_faculty(FacultyTypes.tech)
        f_mng = FacultyManagement(faculty)
        manager = f_mng.management_obj.staff()[StaffType.management].list()[0]
        f_mng.set_manager(manager)
        group = faculty.groups[0]

        student = group.list()[0]
        student1 = group.list()[1]

        semester = faculty.semesters[0]

        topics = list(semester.topics)[:len(semester.topics) / 3]
        semester.enroll(student, topics)
        semester.enroll(student1, topics)

        enroll_count = 20
        pass_count = enroll_count * 60 / 100
        for topic in topics:
            teacher = topic.teacher
            for count in range(enroll_count):
                date = faker.date()
                teacher.schedule_topic(group, date, topic)
                if count < pass_count:
                    group.set_attending(date, topic, [student], [student1])
                else:
                    group.set_attending(date, topic, [student, student1])

        to_fire_students = f_mng.students_to_fire(group)

        self.assertNotIn(student, to_fire_students)
        self.assertIn(student1, to_fire_students)
Пример #3
0
    def test_group_add(self):
        f = combine_faculty(FacultyTypes.hum)
        student = Student(f, f.groups[0])
        group1 = Group('1')

        group1.add(student)
        self.assertTrue(group1.list())
        self.assertIn(student, group1.list())
Пример #4
0
    def test_tech_fac_enrollments(self):
        faculty = combine_faculty(FacultyTypes.tech)
        s = Semester(1, 1, faculty)
        for topics in TOPICS:
            for topic in topics.values():
                s.add_topic(Topic(topic, create_teacher()))

        self.assertTrue(
            s.enroll(create_student(faculty, faculty.groups[0]),
                     list(s.topics)[:len(s.topics) / 2]))
Пример #5
0
    def test_allowed_perms(self):
        f_mng = FacultyManagement(combine_faculty(FacultyTypes.tech))

        manager = f_mng.management_obj.staff()[StaffType.management].list()[0]
        f_mng.set_manager(manager)

        teacher = create_teacher()
        f_mng.hire(StaffType.teachers, teacher, 'teacher')

        self.assertIn(teacher, f_mng.staff()[StaffType.teachers].list())
Пример #6
0
    def test_enrollments_non_existing(self):
        faculty = combine_faculty(FacultyTypes.hum)
        s = Semester(1, 1, faculty)
        for topics in TOPICS:
            for topic in topics.values():
                s.add_topic(Topic(topic, create_teacher()))

        non_existing_topic = ''
        self.assertRaises(SemesterException, s.enroll,
                          create_student(faculty, faculty.groups[0]),
                          [non_existing_topic])
Пример #7
0
    def test_multiple_enrollments(self):
        faculty = combine_faculty(FacultyTypes.tech)
        s = Semester(1, 1, faculty)
        for topics in TOPICS:
            for topic in topics.values():
                s.add_topic(Topic(topic, create_teacher()))

        enrolments = 10
        for current in range(enrolments):
            s.enroll(create_student(faculty, faculty.groups[0]),
                     list(s.topics)[:len(s.topics) / 2])

        self.assertEqual(len(s.enrollments), enrolments)
Пример #8
0
    def test_dismiss_student(self):
        faculty = combine_faculty(FacultyTypes.tech)
        f_mng = FacultyManagement(faculty)
        manager = f_mng.management_obj.staff()[StaffType.management].list()[0]
        f_mng.set_manager(manager)

        group = faculty.groups[0]
        student = group.list()[0]

        self.assertIn(student, group.list())

        f_mng.dismiss_student(student)

        self.assertNotIn(student, group.list())
Пример #9
0
    def test_employment(self):
        f1 = combine_faculty(FacultyTypes.hum)
        Adam = Student(f1, f1.groups[0], name='Adam')
        Cain = Student(f1, f1.groups[0], name='Cain')
        self.assertTrue(Cain.experiences)

        Adam.add_employment(PeopleOccupation.employee, 'Translator')
        self.assertTrue(Adam.experiences)

        # left work and university
        Cain.unemployed()
        self.assertEqual(Cain.occupations, {PeopleOccupation.unemployed})
        for exp in Cain.experiences:
            self.assertTrue(exp.quit_date)
Пример #10
0
    def test_change_topic_teacher(self):
        faculty = combine_faculty(FacultyTypes.tech)
        f_mng = FacultyManagement(faculty)
        manager = f_mng.management_obj.staff()[StaffType.management].list()[0]
        f_mng.set_manager(manager)

        topic_dict = TOPICS[0]
        kn_area = topic_dict.keys()[0]
        teacher1 = create_teacher(knowledge_area=kn_area)
        teacher2 = create_teacher(knowledge_area=kn_area)

        topic = Topic(topic_dict[kn_area][0], teacher1)

        f_mng.change_topic_teacher(topic, teacher2)
        self.assertEqual(topic.teacher, teacher2)
Пример #11
0
 def setUp(self):
     super(ScheduleTest, self).setUp()
     self.faculty = combine_faculty(FacultyTypes.hum)