From 3020b14c7262c686e7dbabe3cd1d024d9e4d117a Mon Sep 17 00:00:00 2001 From: Derek Date: Sat, 21 Nov 2026 22:08:53 +1100 Subject: [PATCH] fix(tests): bind the views test admin to the deployment's own org Both view tests got 403 because the admin lacked the group that grants query:execute. The test bound the admin to `default` without setting the deployment's own org. Accounts outside the deployment's own org hold only their org's admin or viewer group (orgs/role_groups.py:61-66, applied at api/deps.py:575-577). The setup uses name_your_org to set `default` as the deployment's own org before binding the admin, as the other API tests do. --- tests/integration/test_query/test_views_api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/integration/test_query/test_views_api.py b/tests/integration/test_query/test_views_api.py index 05ec27a62..604a1a6b1 100644 --- a/tests/integration/test_query/test_views_api.py +++ b/tests/integration/test_query/test_views_api.py @@ -37,6 +37,7 @@ SecretsSettings, ) from tests.support.accounts import admin_on_its_own_password, session_token +from tests.support.orgs import name_your_org pytestmark = [pytest.mark.integration, pytest.mark.own_clickhouse] @@ -114,6 +115,9 @@ def stack(ch_params, ch_client, tmp_path, monkeypatch): try: with TestClient(app, raise_server_exceptions=False) as client: admin_on_its_own_password(app) + # An account of any org but yours holds only its org's admin or viewer group, + # so the admin must be bound to your org to keep the groups that grant the view. + name_your_org(app=app, name="default", display_name="Default") app.state.account_store.update("admin", org="default") token = session_token(app, settings, {"sub": "admin"}) yield SimpleNamespace(