コード例 #1
0
    def setUp(self):
        self.client = APIClient()
        self.client.force_authenticate(sample_user())

        self.classroom1 = sample_classroom()
        self.classroom2 = sample_classroom()
        self.classroom3 = sample_classroom()

        self.teacher1 = sample_teacher(
            fullname="Teacher 1",
            academic_level='Gr'
        )
        self.teacher2 = sample_teacher(
            fullname="Teacher 2",
            academic_level='Ms'
        )
        self.teacher3 = sample_teacher(
            fullname="Teacher 3",
            academic_level='Dr'
        )
        self.teacher4 = sample_teacher(
            fullname="Teacher 4",
            academic_level='Dr',
        )
        self.teacher5 = sample_teacher(
            fullname="Teacher 5",
            academic_level='Ms',
            active=False
        )

        self.teacher1.classes.add(self.classroom1)
        self.teacher2.classes.add(self.classroom2)
        self.teacher3.classes.add(self.classroom3)
        self.teacher5.classes.add(self.classroom1)
コード例 #2
0
    def setUp(self):
        self.client = APIClient()
        self.client.force_authenticate(sample_user())

        self.classroom1 = sample_classroom(name="Class1")
        self.teacher = sample_teacher(fullname="The Teacher")
        self.teacher.classes.add(self.classroom1)
コード例 #3
0
    def test_teacher_partial_update_illegal_operation_negative(self):
        """Test an illegal teacher partial update operation is not performed"""
        teacher = sample_teacher(fullname="First Teacher")
        payload = {'id_doc': teacher.id_doc}
        res = self.client.patch(self.teacher_url, payload)

        self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
        self.assertEqual(Teacher.objects.get(id=self.teacher.id), self.teacher)
コード例 #4
0
    def test_teacher_create_illegal_operation_negative(self):
        """Test an illegal create teacher operation is not performed"""
        teacher = sample_teacher(fullname="First Teacher")
        payload = sample_teacher_payload(
            fullname="Doppelganger",
            id_doc=teacher.id_doc
        )
        res = self.client.post(TEACHER_LIST_URL, payload)

        self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
        self.assertFalse(Teacher.objects.filter(**payload).exists())
コード例 #5
0
    def setUp(self):
        self.client = APIClient()
        self.client.force_authenticate(sample_user())

        self.teacher = sample_teacher(fullname="Original Teacher",
                                      sex='O',
                                      birthdate='1990-02-27',
                                      email='*****@*****.**',
                                      academic_level='Dr',
                                      bank_agency=21421,
                                      bank_account=11117,
                                      monthly_payment=12412)
        self.teacher_url = teacher_detail_url(self.teacher.id)
コード例 #6
0
    def setUp(self):
        self.client = APIClient()
        self.client.force_authenticate(sample_user())

        sample_teacher()
        sample_teacher()
        sample_teacher(active=False)

        self.serializer = TeacherListSerializer(
            Teacher.get_active(),
            many=True
        )
コード例 #7
0
    def setUp(self):
        self.client = APIClient()
        self.client.force_authenticate(sample_user())

        self.teacher = sample_teacher(fullname="Original Teacher")
        self.teacher_url = teacher_detail_url(self.teacher.id)
コード例 #8
0
 def setUp(self):
     self.client = APIClient()
     self.teacher = sample_teacher(fullname="Original Teacher")
     self.teacher_url = teacher_detail_url(self.teacher.id)
コード例 #9
0
 def setUp(self):
     self.client = APIClient()
     self.teacher = sample_teacher()