def test_admin_user_post(self):
        request = self.factory.post("/")
        request.user = self.admin_user
        permission_check = IsOwnerOrStaffOrAdminOrReadOnly()
        permission = permission_check.has_object_permission(
            request, None, self.menu)

        self.assertTrue(permission)
    def test_user_post_not_his_data(self):
        request = self.factory.post("/")
        request.user = self.user
        permission_check = IsOwnerOrStaffOrAdminOrReadOnly()
        permission = permission_check.has_object_permission(
            request, None, self.menu_staff)

        self.assertFalse(permission)
    def test_not_logged_user_delete(self):
        request = self.factory.delete("/")
        request.user = self.not_logged_user
        permission_check = IsOwnerOrStaffOrAdminOrReadOnly()

        permission = permission_check.has_object_permission(
            request, None, self.menu)

        self.assertFalse(permission)
    def test_user_delete_his_data(self):
        request = self.factory.delete("/")
        request.user = self.user
        permission_check = IsOwnerOrStaffOrAdminOrReadOnly(
        ).has_object_permission(request, None, self.menu)

        permission = permission_check

        self.assertTrue(permission)