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)
 def setUp(self):
     semester_data = get_semester_data()
     semester = Semester.objects.create(**semester_data)
     self.clazz_data = get_clazz_data()
     self.clazz = Clazz.objects.create(semester=semester, **self.clazz_data)
     self.activity_data = get_activity_data()
     self.activity = Activity.objects.create(**self.activity_data)
Beispiel #3
0
 def setUp(self):
     self.semester_data = get_semester_data()
     self.semester = Semester.objects.create(**self.semester_data)
     self.clazz_data = obtain_clazz_data()
     self.clazz = Clazz.objects.create(semester=self.semester,
                                       **self.clazz_data)
     self.another_semester = Semester.objects.create(**self.semester_data)
Beispiel #4
0
def get_clazz():
    """
    生成一个课程

    :author: lishanZheng
    :date: 2020/01/03
    """
    semester_data = get_semester_data()
    semester = Semester(**semester_data)
    semester.save()
    clazz_data = get_clazz_data()
    clazz = Clazz(**clazz_data, semester=semester)
    clazz.save()
    return clazz
Beispiel #5
0
    def test_add_semester(self):
        """
        添加学期

        :author: lishanZheng
        :date: 2020/01/02
        """
        semester_data = get_semester_data()
        result = self.client.post('/semester/semester', data=semester_data)
        result = result.json()
        self.assertEqual(result.get('code'), result_util.SUCCESS)
        semester_get = result.get('data')
        self.assertIsNotNone(semester_get)
        self.assertEqual(semester_get.get('introduction'),
                         semester_data.get('introduction'))
        self.assertEqual(semester_get.get('subject'),
                         semester_data.get('subject'))
 def setUp(self):
     self.activity_clazzes = []
     semester_data = get_semester_data()
     semester = Semester.objects.create(**semester_data)
     self.activity_data = get_activity_data()
     self.activity = Activity.objects.create(**self.activity_data)
     self.clazzes = []
     self.clazzes_data = []
     for i in range(0, 8):
         clazz_data = obtain_clazz_data()
         clazz = Clazz.objects.create(semester=semester, **clazz_data)
         self.clazzes.append(clazz)
         self.clazzes_data.append(clazz_data)
         if i < 5:
             activity_clazz = ActivityClazz.objects.create(
                 activity=self.activity, clazz=self.clazzes[i])
             self.activity_clazzes.append(activity_clazz)
 def setUp(self):
     self.semester_data = get_semester_data()
     self.semester = Semester.objects.create(**self.semester_data)
     self.clazz_data = get_clazz_data()
     self.clazz_data['semester_id'] = self.semester.id
 def setUp(self):
     self.semester_data = get_semester_data()
     semester_one = Semester.objects.create(**self.semester_data)
     self.semester = semester_one
Beispiel #9
0
 def setUp(self):
     self.semesters_data.append(get_semester_data())
     self.semesters_data.append(get_semester_data())
     for semester_data in self.semesters_data:
         semester = Semester(**semester_data)
         semester.save()