feat: update personal stats and cms change reuqest method
This commit is contained in:
@@ -14,6 +14,10 @@ def u_detail(pk):
|
||||
return f'/api/cms/users/{pk}/'
|
||||
|
||||
|
||||
def u_disable(pk):
|
||||
return f'/api/cms/users/{pk}/disable/' # 停用:POST(原 DELETE /{id}/)
|
||||
|
||||
|
||||
class HospitalAdminUserScopeTest(CacheTestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
@@ -68,11 +72,11 @@ class HospitalAdminUserScopeTest(CacheTestCase):
|
||||
def test_cannot_touch_other_institution_user(self):
|
||||
# 他院学生不在 queryset → 404
|
||||
self.assertEqual(self.client.get(u_detail(self.other_stu.id)).status_code, 404)
|
||||
self.assertEqual(self.client.delete(u_detail(self.other_stu.id)).status_code, 404)
|
||||
self.assertEqual(self.client.post(u_disable(self.other_stu.id)).status_code, 404)
|
||||
|
||||
def test_soft_delete_own_student(self):
|
||||
resp = self.client.delete(u_detail(self.stu.id))
|
||||
self.assertEqual(resp.status_code, 204, resp.content)
|
||||
resp = self.client.post(u_disable(self.stu.id))
|
||||
self.assertEqual(resp.status_code, 200, resp.content)
|
||||
self.assertFalse(User.objects.filter(id=self.stu.id).exists())
|
||||
|
||||
def test_reset_password_own(self):
|
||||
|
||||
Reference in New Issue
Block a user