async def test_controller_level_permissions(self):
        """Test controller-level permissions (AllowAny & IsAdminUser)"""
        # Create admin and normal users
        admin_user = Mock(is_authenticated=True, is_staff=True)
        normal_user = Mock(is_authenticated=True, is_staff=False)
        anon_user = AnonymousUser()

        # Use TestAsyncClient directly with the controller class
        client = TestAsyncClient(AsyncController)

        # Anonymous user should be rejected by IsAdminUser
        response = await client.get("/index/", user=anon_user)
        assert response.status_code == 403

        # Normal authenticated user should be rejected by IsAdminUser
        response = await client.get("/index/", user=normal_user)
        assert response.status_code == 403

        # Admin user should be allowed
        response = await client.get("/index/", user=admin_user)
        assert response.status_code == 200
        assert response.json() == {"success": True}
Test controller-level permissions (AllowAny & IsAdminUser)
tests/test_async_permissions.py