feat: update personal stats and cms change reuqest method
This commit is contained in:
@@ -16,6 +16,10 @@ def rel_detail(pk):
|
||||
return f'/api/cms/teacher-student-relations/{pk}/'
|
||||
|
||||
|
||||
def rel_disable(pk):
|
||||
return f'/api/cms/teacher-student-relations/{pk}/disable/' # 停用:POST(原 DELETE /{id}/)
|
||||
|
||||
|
||||
def make_xlsx(headers, rows):
|
||||
wb = Workbook(); ws = wb.active
|
||||
ws.append(headers)
|
||||
@@ -69,8 +73,8 @@ class CmsRelationTest(CacheTestCase):
|
||||
|
||||
def test_soft_delete(self):
|
||||
r = TeacherStudentRelation.objects.create(teacher=self.doc, student=self.stu, status=1)
|
||||
resp = self.client.delete(rel_detail(r.id))
|
||||
self.assertEqual(resp.status_code, 204, resp.content)
|
||||
resp = self.client.post(rel_disable(r.id))
|
||||
self.assertEqual(resp.status_code, 200, resp.content)
|
||||
self.assertFalse(TeacherStudentRelation.objects.filter(id=r.id).exists())
|
||||
self.assertTrue(TeacherStudentRelation.all_objects.get(id=r.id).is_deleted)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user