{"id":"daae094e-5eea-47bc-a919-f59a30c7f385", "recipient":"12fc3f23-17c6-442c-9554-505e87d2791f", "sender":"12fc3f23-17c6-442c-9554-505e87d2791f/task-1184", "priority":"MESSAGE_PRIORITY_HIGH", "timestamp":"2026-11-19T06:24:45.293763840Z", "renderDetails":{"messageTitle":"Run admin platform test finished"}, "content":"Task id \"12fc3f23-17c6-442c-9554-505e87d2791f/task-1184\" finished with result:\nCommand exited with code 1.\n\nCommand output:\n============================= test session starts ==============================\r\nplatform linux -- Python 3.12.3, pytest-9.2.0, pluggy-1.7.0 -- /root/telegram-saas/.venv/bin/python3\r\ncachedir: .pytest_cache\r\nrootdir: /root/telegram-saas\r\nconfigfile: pyproject.toml\r\nplugins: anyio-4.16.0, asyncio-1.5.0\r\nasyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function\r\ncollecting ... \rcollected 1 item                                                               \r\n\r\ntests/integration/test_admin_platform_api.py::test_admin_platform_endpoints_and_superuser_guard FAILED [100%]\r\n\r\n=================================== FAILURES ===================================\r\n______________ test_admin_platform_endpoints_and_superuser_guard _______________\r\n\r\nasync_client = <httpx.AsyncClient object at 0x75f8b562ac00>\r\ndb_session = <sqlalchemy.ext.asyncio.session.AsyncSession object at 0x75f8b571d880>\r\n\r\n    @pytest.mark.asyncio\r\n    async def test_admin_platform_endpoints_and_superuser_guard(\r\n        async_client: AsyncClient,\r\n        db_session: AsyncSession,\r\n    ):\r\n        # 1. Create a regular user (non-superuser)\r\n        reg_email = f\"user_{uuid.uuid4().hex[:6]}@example.com\"\r\n        reg_resp = await async_client.post(\r\n            \"/api/v1/auth/register\",\r\n            json={\"email\": reg_email, \"password\": \"PasswordUser123!\", \"full_name\": \"Standard User\"},\r\n        )\r\n        user_token = reg_resp.json()[\"data\"][\"access_token\"]\r\n    \r\n        # 2. Attempt to access superadmin endpoints as regular user -> 403 Forbidden\r\n        forbidden_resp = await async_client.get(\r\n            \"/api/v1/admin/stats\",\r\n            headers={\"Authorization\": f\"Bearer {user_token}\"},\r\n        )\r\n        assert forbidden_resp.status_code == 403\r\n        assert \"Superadmin privileges required\" in forbidden_resp.json()[\"detail\"]\r\n    \r\n        # 3. Create a genuine superuser in DB\r\n        super_email = f\"superuser_{uuid.uuid4().hex[:6]}@example.com\"\r\n>       super_user = User(\r\n            email=super_email,\r\n            hashed_password=hash_password(\"SuperAdmin2026!\"),\r\n            full_name=\"Platform Superadmin\",\r\n            is_superuser=True,\r\n            is_active=True,\r\n        )\r\n\r\ntests/integration/test_admin_platform_api.py:32: \r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\n<sqlalchemy generated __init__ for class modules.identity.models.User>:4: in __init__\r\n    return new_state._initialize_instance(self, **kwargs)\r\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n.venv/lib/python3.12/site-packages/sqlalchemy/orm/state.py:597: in _initialize_instance\r\n    with util.safe_reraise():\r\n.venv/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py:166: in __exit__\r\n    raise exc_value.with_traceback(exc_tb)\r\n.venv/lib/python3.12/site-packages/sqlalchemy/orm/state.py:595: in _initialize_instance\r\n    manager.original_init(*mixed[1:], **kwargs)\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \r\n\r\nself = <modules.identity.models.User object at 0x75f8b562bda0>\r\nkwargs = {'email': 'superuser_8fc425@example.com', 'hashed_password': '$argon2id$v=19$m=65536,t=3,p=4$quTT3r3WJozOG7MwmSd9Ww$uEAscOHzakdTVOwmSa7Ts5gCTIiryVQ2Tuc9b7UdGkY', 'full_name': 'Platform Superadmin', 'is_superuser': True, ...}\r\n\r\n    def _declarative_constructor(self: Any, **kwargs: Any) -> None:\r\n        \"\"\"A simple constructor that allows initialization from kwargs.\r\n    \r\n        Sets attributes on the constructed instance using the names and\r\n        values in ``kwargs``.\r\n    \r\n        Only keys that are present as\r\n        attributes of the instance's class are allowed. These could be,\r\n        for example, any mapped columns or relationships.\r\n        \"\"\"\r\n        cls_ = type(self)\r\n        for k in kwargs:\r\n            if not hasattr(cls_, k):\r\n>               raise TypeError(\r\n                    \"%r is an invalid keyword argument for %s\" % (k, cls_.__name__)\r\n                )\r\nE               TypeError: 'hashed_password' is an invalid keyword argument for User\r\n\r\n.venv/lib/python3.12/site-packages/sqlalchemy/orm/decl_base.py:2361: TypeError\r\n----------------------------- Captured stdout call -----------------------------\r\n2026-11-19 06:24:42 [info     ] dispatching_domain_event       event_id=1864905b-e09c-44a9-8df4-dd031220f2df event_type=TenantCreatedEvent handlers_count=1\r\n2026-11-19 06:24:42 [info     ] domain_event_recorded          event_id=1864905b-e09c-44a9-8df4-dd031220f2df event_type=TenantCreatedEvent tenant_id=5adce0e6-02e0-4e27-9f33-8621bafc4940 user_id=None\r\n2026-11-19 06:24:42 [info     ] dispatching_domain_event       event_id=1d3ea772-fa6d-448c-9ca2-f54b1ec36464 event_type=UserRegisteredEvent handlers_count=1\r\n2026-11-19 06:24:42 [info     ] domain_event_recorded          event_id=1d3ea772-fa6d-448c-9ca2-f54b1ec36464 event_type=UserRegisteredEvent tenant_id=None user_id=41230386-e0a8-480d-a359-3bd89a4887dd\r\n=========================== short test summary info ============================\r\nFAILED tests/integration/test_admin_platform_api.py::test_admin_platform_endpoints_and_superuser_guard\r\n============================== 1 failed in 3.07s ===============================\r\n\nLog: file:///root/.gemini/antigravity-cli/brain/12fc3f23-17c6-442c-9554-505e87d2791f/.system_generated/tasks/task-1184.log", "sourceMetadata":{"tool":{"conversationId":"12fc3f23-17c6-442c-9554-505e87d2791f", "stepIndex":1184, "toolCall":{"id":"call_2689105169842404151", "name":"run_command", "argumentsJson":"{\"CommandLine\":\"/root/telegram-saas/.venv/bin/pytest tests/integration/test_admin_platform_api.py -v\",\"WaitMsBeforeAsync\":10000,\"toolSummary\":\"Run admin platform test\"}", "thinkingSignature":"EtQBCtEBAWkUfROaeTRGkHw0CAwKEI2bVh/dzNBatWo4NgtJCfyQa6mYyegfagpTL4zGDfGslm91GZkg2oBYK/DOOjUUDww0jWfTct+UgUeJTkjLxInle3iaiI1PZIaCtFhqSah+zkjPsI47kHxmawwc+s1lPuQvVd3cmrKaCjAo9fZOdnCWP7iaDiMIPhZ93DFfOSa/P+R6bCkIp4nmxJ1ICKnhv4tQROB41DhW8sL9Mv+T8impz4hJq4lyuWmYeHTqAUa+gtUieCUlIr9rBk5EzNJMmqw="}}}}