Example #1
0
    def setUp(self):
        self.student = get_student()
        self.another_student = get_student()

        semester_data = get_semester_data()
        self.semester = Semester.objects.create(**semester_data)
        another_semester_data = get_semester_data()
        self.another_semester = Semester.objects.create(
            **another_semester_data)

        self.clazzes = []
        while len(self.clazzes) < 5:
            clazz_data = get_clazz_data()
            clazz = Clazz.objects.create(semester=self.semester, **clazz_data)
            self.clazzes.append(clazz)
        self.another_clazzes = []
        while len(self.another_clazzes) < 7:
            clazz_data = get_clazz_data()
            clazz = Clazz.objects.create(semester=self.another_semester,
                                         **clazz_data)
            self.another_clazzes.append(clazz)
        data = {
            'apply': get_application_information(),
            'evaluation': get_evaluation(),
            'state': WAIT_FOR_AUDIT,
            'student': self.student
        }
        for clazz in self.clazzes[:-2]:
            data['clazz'] = clazz
            ClazzStudent.objects.create(**data)
        data['student'] = self.another_student
        for clazz in self.clazzes[-2:]:
            data['clazz'] = clazz
            ClazzStudent.objects.create(**data)
Example #2
0
 def setUp(self):
     self.activities = []
     for i in range(0, 3):
         if i == -1:
             pass
         activity_data = get_activity_data()
         activity_data['state'] = activity_state.ENROLLING
         activity = Activity.objects.create(**activity_data)
         self.activities.append(activity)
     self.student = get_student()
     self.another_student = get_student()
     for activity in self.activities:
         ActivityStudent.objects.create(activity=activity,
                                        student=self.student)
         ActivityStudent.objects.create(activity=activity,
                                        student=self.another_student)
     # 添加一个额外的学生和活动
     activity_data = get_activity_data()
     activity = Activity.objects.create(**activity_data)
     ActivityStudent.objects.create(activity=activity,
                                    student=self.another_student)
Example #3
0
 def setUp(self):
     semester = get_semester()
     evaluation = get_evaluation()
     student_one = get_student()
     application = get_application_information()
     clazz_data = get_clazz_data()
     clazz = Clazz.objects.create(**clazz_data, semester_id=semester.id)
     student_two = get_student()
     ClazzStudent.objects.create(state=VALID,
                                 student_id=student_one.id,
                                 apply_id=application.id,
                                 clazz_id=clazz.id,
                                 evaluation_id=evaluation.id)
     semester = get_semester()
     clazz = Clazz.objects.create(**clazz_data, semester_id=semester.id)
     clazz_student = ClazzStudent.objects.create(state=VALID,
                                                 apply_id=application.id,
                                                 clazz_id=clazz.id,
                                                 evaluation_id=evaluation.id,
                                                 student_id=student_two.id)
     self.student = student_two
     self.semester = semester
     self.clazz_student = clazz_student
Example #4
0
    def test_student_list_by_letter(self):
        """
        按字母顺序获取校友信息

        :author: lishanZheng
        :date: 2020/01/08
        """
        student = get_student()
        letter = 'A'
        student.name = letter
        student.save()
        res = self.client.get('/student/student/letter',
                              content_type="application/x-www-form-urlencoded")
        result = res.json()
        results = result.get('data')
        self.assertEqual(results.get('results')[0].get('letter'), letter)
        self.assertEqual(results.get('results')[0].get('group')[0]['name'], letter)
        self.assertEqual(result['code'], result_util.SUCCESS)
 def setUp(self):
     student = get_student()
     self.student = student
 def setUp(self):
     student = get_student()
     self.student_id = student.id