def test_user_post_not_his_data(self): request = self.factory.post("/") request.user = self.user permission_check = IsOwnerOrStaffOrAdmin() permission = permission_check.has_object_permission( request, None, self.dish_staff) self.assertFalse(permission)
def test_staff_user_post(self): request = self.factory.post("/") request.user = self.staff_user permission_check = IsOwnerOrStaffOrAdmin() permission = permission_check.has_object_permission( request, None, self.dish_meat) self.assertTrue(permission)
def test_not_logged_user_delete(self): request = self.factory.delete("/") request.user = self.not_logged_user permission_check = IsOwnerOrStaffOrAdmin() permission = permission_check.has_object_permission( request, None, self.dish_meat) self.assertFalse(permission)
def test_user_delete_his_data(self): request = self.factory.delete("/") request.user = self.user permission_check = IsOwnerOrStaffOrAdmin().has_object_permission( request, None, self.dish_meat) permission = permission_check self.assertTrue(permission)