repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
onyx
backend/tests/integration/tests/craft/test_upload_api.py
.py
"""File upload tests (HTTP half).""" from __future__ import annotations from uuid import UUID from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.http_client import client from tests.integration.common_utils.managers.build_session import BuildSessionManager from te...
169
5,490
onyx
backend/tests/integration/tests/craft/user_library_http.py
.py
"""Shared HTTP helpers for the user-library endpoints.""" from __future__ import annotations import io import zipfile from collections.abc import Iterable import httpx from onyx.server.features.build.user_library.api import LibraryEntryResponse from tests.integration.common_utils.constants import API_SERVER_URL fro...
86
2,455
onyx
backend/tests/integration/tests/craft/test_user_library_api.py
.py
"""User library tests.""" from __future__ import annotations from uuid import uuid4 from onyx.server.features.build.user_library.api import ( DeleteFileResponse, LibraryEntryResponse, UploadResponse, ) from tests.integration.common_utils.test_models import DATestUser from tests.integration.tests.craft.us...
113
4,195
onyx
backend/tests/integration/tests/craft/test_scheduled_tasks_api.py
.py
"""Scheduled tasks tests (HTTP contract).""" from __future__ import annotations import time from collections.abc import Generator from typing import Any from uuid import UUID, uuid4 import httpx import pytest from sqlalchemy import select from onyx.db.engine.sql_engine import SqlEngine, get_session_with_current_ten...
380
11,891
onyx
backend/tests/integration/tests/craft/test_sessions_api.py
.py
"""Session lifecycle tests against a real provisioned sandbox.""" from __future__ import annotations from uuid import UUID, uuid4 from onyx.configs.constants import OnyxRedisLocks from onyx.db.enums import SharingScope from onyx.redis.redis_pool import get_redis_client from onyx.server.features.build.timeouts import...
342
11,151
onyx
backend/tests/integration/tests/craft/test_webapp_proxy.py
.py
"""Webapp proxy tests (security + UX).""" from __future__ import annotations from uuid import UUID import httpx from onyx.db.enums import SharingScope from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.http_client import client from tests.integration.common_utils...
118
3,632
onyx
backend/tests/integration/tests/craft/conftest.py
.py
"""Fixtures for craft integration tests.""" from __future__ import annotations import contextlib from collections.abc import Generator from typing import NamedTuple from uuid import UUID, uuid4 import httpx import pytest from onyx.db.engine.sql_engine import SqlEngine, get_session_with_tenant from onyx.server.featu...
132
4,798
onyx
backend/tests/integration/tests/craft/docker_e2e/test_serve_streaming_docker.py
.py
"""Docker-backend opencode-serve streaming end-to-end tests.""" from __future__ import annotations import json import os import time from collections.abc import Generator from concurrent.futures import ThreadPoolExecutor from dataclasses import dataclass, field from typing import Any, NamedTuple from uuid import UUID...
372
13,440
onyx
backend/tests/integration/tests/craft/docker_e2e/test_approval_gate_docker.py
.py
"""Docker-backend end-to-end approval-gate decision tests.""" from __future__ import annotations import json import subprocess from typing import NamedTuple from uuid import UUID, uuid4 import pytest from httpx import Response from onyx.db.engine.sql_engine import get_session_with_tenant from onyx.db.enums import A...
242
8,578
onyx
backend/tests/integration/tests/craft/docker_e2e/test_workspace_setup_docker.py
.py
"""Docker-backend workspace setup end-to-end tests. Runs against the full Craft docker-compose stack and provisions a real sandbox through the live api_server. This file pins Docker-specific session setup behavior that unit and in-process integration tests cannot observe: ownership inside the container, user-writable ...
226
8,125
onyx
backend/tests/integration/tests/craft/docker_e2e/test_snapshot_roundtrip_docker.py
.py
""" Docker-backend snapshot + restore round-trip against the full Craft compose stack. Seeds markers in the session outputs and opencode's data home, forces the idle-cleanup beat to reap the sandbox (snapshot both kinds + tear down), then restores via the API and asserts both survived a real re-provision -- covering t...
158
5,936
onyx
backend/tests/integration/tests/craft/docker_e2e/test_webapp_preview_docker.py
.py
"""Webapp preview against a real Next dev server on the docker backend. Docker counterpart of ``k8s/test_webapp_preview.py``: drives the shared ``start-webapp.sh`` the way the agent's `webapp` tool does, then pins that the resulting dev server serves the basePath route through the proxy. A docker-only divergence from ...
66
2,205
onyx
backend/tests/integration/tests/craft/docker_e2e/test_sandbox_network_posture_docker.py
.py
"""Docker-backend sandbox network/security-posture tests. Zero-capabilities at UID 1000, proxy-MITM of HTTPS, credential injection on the wire, iptables egress lockdown, unidentified-sandbox rejection, and workspace ownership — exercised against one module-scoped RUNNING sandbox. """ from __future__ import annotation...
308
9,133
onyx
backend/tests/integration/tests/craft/docker_e2e/conftest.py
.py
"""Docker-e2e fixtures layered on the craft base conftest.""" from __future__ import annotations import subprocess import time from typing import NamedTuple, Protocol from uuid import UUID import pytest from onyx.db.engine.sql_engine import get_session_with_tenant from onyx.db.enums import EndpointPolicy, ExternalA...
214
6,599
onyx
backend/tests/integration/tests/craft/k8s/test_kubernetes_sandbox_file_ops.py
.py
"""Sandbox file-ops tests in the Craft k8s integration lane.""" from __future__ import annotations from collections.abc import Callable from uuid import UUID import httpx import pytest from kubernetes import client from onyx.server.features.build.configs import ( SANDBOX_BACKEND, SANDBOX_NAMESPACE, Sand...
323
10,561
onyx
backend/tests/integration/tests/craft/k8s/k8s_db_fixtures.py
.py
"""K8s-only Craft database fixtures.""" from __future__ import annotations from collections.abc import Generator import pytest from sqlalchemy.orm import Session from onyx.db.engine.sql_engine import SqlEngine, get_session_with_current_tenant from shared_configs.configs import POSTGRES_DEFAULT_SCHEMA_STANDARD_VALUE...
52
1,561
onyx
backend/tests/integration/tests/craft/k8s/test_skill_push.py
.py
"""Skill API push tests in the Craft k8s integration lane.""" from __future__ import annotations import io import zipfile from collections.abc import Callable, Generator from pathlib import Path from uuid import UUID, uuid4 import httpx import pytest from sqlalchemy.orm import Session from onyx.configs.constants im...
883
30,199
onyx
backend/tests/integration/tests/craft/k8s/test_browser.py
.py
"""Browser-use test in the Craft k8s integration lane. The agent's `browser` command has to work inside the locked-down sandbox pod, which is the intersection of four things that have each broken before: Chromium launching with --no-sandbox under the pod's dropped caps/seccomp, reaching the public internet through the...
50
1,754
onyx
backend/tests/integration/tests/craft/k8s/k8s_fixtures.py
.py
"""Shared Kubernetes fixtures and helpers for Craft integration tests.""" from __future__ import annotations import json import os import shlex import time from collections.abc import Callable, Generator, Sequence from contextlib import contextmanager, suppress from dataclasses import dataclass, field from pathlib im...
1,004
34,363
onyx
backend/tests/integration/tests/craft/k8s/test_user_library_sync.py
.py
"""User-library API sync tests in the Craft k8s integration lane.""" from __future__ import annotations from collections.abc import Callable from uuid import uuid4 import pytest from onyx.server.features.build.configs import SANDBOX_BACKEND, SandboxBackend from onyx.server.features.build.user_library.api import ( ...
122
4,026
onyx
backend/tests/integration/tests/craft/k8s/test_session_provisioning_api.py
.py
"""Session provisioning API tests in the Craft k8s integration lane.""" from __future__ import annotations from contextlib import suppress from uuid import UUID, uuid4 import pytest from kubernetes import client from onyx.db.enums import SandboxStatus from onyx.server.features.build.configs import ( SANDBOX_BAC...
65
2,343
onyx
backend/tests/integration/tests/craft/k8s/test_kubernetes_sandbox.py
.py
"""K8s push contract + sandbox lifecycle against a live cluster.""" from __future__ import annotations from uuid import uuid4 import pytest from kubernetes import client from kubernetes.client.rest import ApiException from onyx.server.features.build.configs import ( SANDBOX_BACKEND, SANDBOX_NAMESPACE, S...
311
10,076
onyx
backend/tests/integration/tests/craft/k8s/test_messages_api_k8s.py
.py
"""Interactive message API tests in the Craft k8s integration lane.""" from __future__ import annotations import os import time from contextlib import suppress from typing import cast from uuid import UUID, uuid4 import pytest from kubernetes import client from onyx.configs.constants import MessageType from onyx.se...
133
4,933
onyx
backend/tests/integration/tests/craft/k8s/test_approval_gate.py
.py
"""Approval-gate flow against the real proxy/Redis/SIGTERM-drain paths.""" from __future__ import annotations import json import time from collections.abc import Generator from typing import NamedTuple from uuid import UUID, uuid4 import httpx import pytest from kubernetes import client from sqlalchemy.orm import Se...
844
27,811
onyx
backend/tests/integration/tests/craft/k8s/test_bun_node_modules_dedup.py
.py
"""Guards bun-cache + hardlink dedup invariants for sandbox sessions.""" from __future__ import annotations import os import time from collections.abc import Generator from contextlib import suppress from typing import NamedTuple from uuid import UUID, uuid4 import pytest from kubernetes import client from onyx.ser...
339
11,254
onyx
backend/tests/integration/tests/craft/k8s/test_webapp_preview.py
.py
"""Webapp preview behavior against a real Next dev server. Pins the Next-side contracts the preview fixes depend on, which unit tests cannot see: the dev-resource origin gate and basePath serving. """ from __future__ import annotations import pytest from kubernetes import client from onyx.server.features.build.conf...
115
3,745
onyx
backend/tests/integration/tests/craft/k8s/test_snapshot_restore.py
.py
"""Kubernetes sidecar snapshot/restore contract + API restore orchestration.""" from __future__ import annotations import io import shutil import tarfile from collections.abc import Callable from pathlib import Path from uuid import UUID, uuid4 import httpx import pytest from kubernetes import client from sqlalchemy...
478
16,485
onyx
backend/tests/integration/tests/craft/k8s/conftest.py
.py
"""Fixtures for the Craft Kubernetes integration suite.""" from __future__ import annotations import contextlib import os from collections.abc import Generator from uuid import uuid4 import httpx import pytest from onyx.db.engine.sql_engine import get_session_with_tenant from onyx.server.features.build.configs impo...
127
4,190
onyx
backend/tests/integration/tests/external_apps/test_external_apps.py
.py
from typing import Any import httpx import pytest from onyx.db.enums import ExternalAppType from onyx.server.features.build.external_apps.models import ( ExternalAppAdminResponse, ExternalAppUserResponse, ) from onyx.utils.encryption import mask_credential_dict from tests.integration.common_utils.managers.ext...
534
20,634
onyx
backend/tests/integration/tests/external_apps/test_external_app_action_policies.py
.py
"""Integration coverage for the admin action-policy lifecycle on built-in external apps, exercised end-to-end through the ``/admin/apps`` API via ``ExternalAppManager`` (real deployment, real auth, no direct DB access). Contract under test (observed through the admin response's ``actions`` view): - a created built-in...
192
7,249
onyx
backend/tests/integration/tests/image_indexing/test_indexing_images.py
.py
import os from datetime import datetime, timezone import pytest from onyx.connectors.models import InputType from onyx.db.engine.sql_engine import get_session_with_current_tenant from onyx.db.enums import AccessType from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.managers.c...
225
7,734
onyx
backend/tests/integration/tests/search/test_search_api.py
.py
"""Integration tests for the Search API (POST /api/search).""" from __future__ import annotations import os import httpx import pytest from onyx.db.enums import AccessType, Permission from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.http_client import client fr...
220
7,936
onyx
backend/tests/integration/tests/search_settings/test_search_settings.py
.py
import httpx from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.http_client import client from tests.integration.common_utils.test_models import DATestLLMProvider, DATestUser SEARCH_SETTINGS_URL = f"{API_SERVER_URL}/search-settings" def _get_current_search_settin...
274
9,160
onyx
backend/tests/integration/tests/auth/test_saml_user_conversion.py
.py
import os import pytest from onyx.auth.schemas import UserRole from onyx.db.enums import AccountType from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.http_client import client from tests.integration.common_utils.managers.user import UserManager from tests.integra...
334
12,485
onyx
backend/tests/integration/tests/permissions/test_persona_permissions.py
.py
""" This file tests the permissions for creating and editing personas for different user roles: - Basic users can create personas and edit their own - Curators can edit personas that belong exclusively to groups they curate - Admins can edit all personas """ import os import httpx import pytest from tests.integratio...
188
6,676
onyx
backend/tests/integration/tests/permissions/test_pat_scope_assignment.py
.py
"""Integration tests for assigning scopes when minting a PAT via the user API.""" from onyx.db.enums import Permission from tests.integration.common_utils.managers.pat import PATManager from tests.integration.common_utils.test_models import DATestUser # The scopes a user may assign today (admin scopes are intentional...
68
2,720
onyx
backend/tests/integration/tests/permissions/test_doc_set_permissions.py
.py
import os import httpx import pytest from onyx.db.enums import AccessType from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.managers.cc_pair import CCPairManager from tests.integration.common_utils.managers.document_set import DocumentSetManager from tests.integration.common_...
198
6,887
onyx
backend/tests/integration/tests/permissions/test_auth_permission_propagation.py
.py
"""Integration tests for permission propagation across auth-triggered group changes. These tests verify that effective permissions (via /me/permissions) actually propagate when users are added/removed from default groups through role changes. Custom permission grant tests will be added once the permission grant API is...
83
3,218
onyx
backend/tests/integration/tests/permissions/test_user_file_permissions.py
.py
""" This file tests user file permissions in different scenarios: 1. Public assistant with user files - files should be accessible to all users 2. Direct file access - user files should NOT be accessible by users who don't own them 3. Image-generation tool outputs - files persisted on `ToolCall.generated_images` mus...
656
25,590
onyx
backend/tests/integration/tests/permissions/test_credential_permissions.py
.py
""" This file takes the happy path to adding a curator to a user group and then tests the permissions of the curator manipulating credentials. """ import os import httpx import pytest from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.managers.credential import CredentialMana...
118
3,921
onyx
backend/tests/integration/tests/permissions/test_admin_access.py
.py
"""Integration tests for FULL_ADMIN_PANEL_ACCESS permission gate. Verifies that endpoints protected by ``require_permission(Permission.FULL_ADMIN_PANEL_ACCESS)`` allow admin users but reject basic users, limited service accounts, bot users, external-permission users, and anonymous (unauthenticated) client. Each endpo...
149
4,757
onyx
backend/tests/integration/tests/permissions/test_basic_access.py
.py
"""Integration tests for BASIC_ACCESS permission gate. Verifies that endpoints protected by ``require_permission(Permission.BASIC_ACCESS)`` allow admin and basic users but reject limited service accounts, bot users, external-permission users, and anonymous (unauthenticated) client. Each endpoint is tested with all si...
152
4,825
onyx
backend/tests/integration/tests/permissions/test_connector_permissions.py
.py
""" This file takes the happy path to adding a curator to a user group and then tests the permissions of the curator manipulating connectors. """ import os import httpx import pytest from onyx.db.enums import AccessType from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.manag...
134
4,804
onyx
backend/tests/integration/tests/permissions/test_whole_curator_flow.py
.py
""" This test tests the happy path for curator permissions """ import os import pytest from onyx.db.enums import AccessType from onyx.db.models import UserRole from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.managers.cc_pair import CCPairManager from tests.integration.comm...
185
6,465
onyx
backend/tests/integration/tests/permissions/test_user_role_permissions.py
.py
""" This file tests the ability of different user types to set the role of other users. """ import os import httpx import pytest from onyx.db.models import UserRole from tests.integration.common_utils.managers.user import DATestUser, UserManager from tests.integration.common_utils.managers.user_group import UserGrou...
100
3,616
onyx
backend/tests/integration/tests/permissions/test_pat_scopes.py
.py
"""Integration tests for PAT scope enforcement through the real auth plumbing.""" import pytest from onyx.db.enums import Permission from tests.integration.common_utils.http_client import request_status from tests.integration.common_utils.managers.pat import PATManager from tests.integration.common_utils.test_models ...
62
2,055
onyx
backend/tests/integration/tests/permissions/test_connector_read_access.py
.py
"""Integration tests for the curator-or-admin gate on connector read endpoints. ``GET /manage/connector`` (list) and ``GET /manage/connector/{id}`` (by-id) return full ``ConnectorSnapshot``s including ``connector_specific_config`` and ``credential_ids``. They must be restricted to curator/admin users (pentest M8 / ENG...
137
4,428
onyx
backend/tests/integration/tests/permissions/test_chat_scopes.py
.py
"""Integration tests for READ_CHAT / WRITE_CHAT scope enforcement on chat routes.""" import pytest from onyx.db.enums import Permission from tests.integration.common_utils.http_client import request_status from tests.integration.common_utils.managers.pat import PATManager from tests.integration.common_utils.test_mode...
86
3,308
onyx
backend/tests/integration/tests/permissions/test_file_connector_permissions.py
.py
import io import json import os import httpx import pytest from onyx.db.enums import AccessType from onyx.db.models import UserRole from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.http_client import client ...
235
8,130
onyx
backend/tests/integration/tests/permissions/test_cc_pair_permissions.py
.py
""" This file takes the happy path to adding a curator to a user group and then tests the permissions of the curator manipulating connector-credential pairs. """ import os import httpx import pytest from onyx.db.enums import AccessType from onyx.server.documents.models import DocumentSource from tests.integration.co...
188
6,657
onyx
backend/tests/integration/tests/permissions/test_owner_pii_redaction.py
.py
"""Integration tests for owner-email / internal-URL redaction (ENG-4251). Persona and MCP-server snapshots returned by the basic-access surfaces leaked PII (the owner's email) and internal infrastructure detail (the MCP `server_url`) to any authenticated user. These tests verify that: * the owner email is blanked for...
106
4,016
onyx
backend/tests/integration/tests/permissions/conftest.py
.py
"""Shared fixtures for permission integration tests. Creates six user types that cover the full access spectrum: - admin_user: STANDARD account, ADMIN role - basic_user: STANDARD account, BASIC role - limited_service_account: SERVICE_ACCOUNT, LIMITED role (no group) - bot_user: ...
105
3,703
onyx
backend/tests/integration/tests/ingestion/test_ingestion_api.py
.py
from onyx.configs.constants import DocumentSource from onyx.connectors.models import InputType from onyx.db.engine.sql_engine import get_session_with_current_tenant from onyx.db.models import Document from tests.integration.common_utils.managers.api_key import APIKeyManager from tests.integration.common_utils.managers....
62
2,369
onyx
backend/tests/integration/tests/web_search/test_web_search_api.py
.py
import os import pytest from shared_configs.enums import WebContentProviderType, WebSearchProviderType from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.http_client import client from tests.integration.common_utils.test_models import DATestUser class TestOnyxWeb...
334
13,532
onyx
backend/tests/integration/tests/usergroup/test_usergroup_syncing.py
.py
import os import pytest from onyx.server.documents.models import DocumentSource from tests.integration.common_utils.constants import NUM_DOCS from tests.integration.common_utils.managers.api_key import APIKeyManager from tests.integration.common_utils.managers.cc_pair import CCPairManager from tests.integration.commo...
116
3,439
onyx
backend/tests/integration/tests/usergroup/test_add_users_to_group.py
.py
import os from uuid import uuid4 import pytest from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.http_client import client from tests.integration.common_utils.managers.user import UserManager from tests.integration.common_utils.managers.user_group import UserGroup...
67
2,271
onyx
backend/tests/integration/tests/usergroup/test_new_group_gets_basic_permission.py
.py
import os import pytest from tests.integration.common_utils.managers.user import UserManager from tests.integration.common_utils.managers.user_group import UserGroupManager from tests.integration.common_utils.test_models import DATestUser @pytest.mark.skipif( os.environ.get("ENABLE_PAID_ENTERPRISE_EDITION_FEATU...
31
971
onyx
backend/tests/integration/tests/usergroup/test_curator_group_scope.py
.py
""" Regression tests for a curator group-scope privilege-escalation bug. A user with the CURATOR role could modify *any* user group (not just the ones they curate) via: PATCH /manage/admin/user-group/{user_group_id} POST /manage/admin/user-group/{user_group_id}/add-users Both routes guard with ``current_cur...
201
8,046
onyx
backend/tests/integration/tests/usergroup/test_user_group_deletion.py
.py
""" This tests the deletion of a user group with the following foreign key constraints: - connector_credential_pair - user - credential - llm_provider - document_set - token_rate_limit (Not Implemented) - persona """ import os import pytest from onyx.server.documents.models import DocumentSource from tests.integrati...
135
4,113
onyx
backend/tests/integration/tests/usergroup/test_group_membership_updates_user_permissions.py
.py
import os import pytest from onyx.db.engine.sql_engine import get_session_with_current_tenant from onyx.db.enums import Permission from onyx.db.models import PermissionGrant from onyx.db.models import UserGroup as UserGroupModel from onyx.db.permissions import ( recompute_permissions_for_group__no_commit, rec...
117
4,411
onyx
backend/tests/integration/tests/usergroup/test_group_permission_toggle.py
.py
import os import pytest from tests.integration.common_utils.managers.user import UserManager from tests.integration.common_utils.managers.user_group import UserGroupManager from tests.integration.common_utils.test_models import DATestUser ENTERPRISE_SKIP = pytest.mark.skipif( os.environ.get("ENABLE_PAID_ENTERPRI...
157
5,509
onyx
backend/tests/integration/tests/pruning/test_pruning.py
.py
import http.server import os import shutil import tempfile import threading from collections.abc import Generator from contextlib import contextmanager from datetime import datetime, timezone from time import sleep from typing import Any import uvicorn from fastapi import FastAPI from fastapi.staticfiles import Static...
198
7,153
onyx
backend/tests/integration/tests/mcp/test_mcp_client_no_auth_flow.py
.py
import os import socket import subprocess import sys import time from collections.abc import Generator from pathlib import Path import pytest from onyx.db.enums import ( MCPAuthenticationPerformer, MCPAuthenticationType, MCPTransport, ) from tests.integration.common_utils.constants import API_SERVER_URL f...
159
5,337
onyx
backend/tests/integration/tests/mcp/test_mcp_server_auth.py
.py
"""Integration tests for MCP Server auth delegated to API /me.""" from tests.integration.common_utils.constants import MCP_SERVER_URL from tests.integration.common_utils.http_client import client from tests.integration.common_utils.managers.pat import PATManager from tests.integration.common_utils.test_models import D...
63
2,331
onyx
backend/tests/integration/tests/mcp/test_mcp_server_search.py
.py
"""Integration tests covering MCP document search flows.""" from __future__ import annotations import asyncio import json import os from collections.abc import Awaitable, Callable from typing import Any import pytest from mcp import ClientSession from mcp.client.streamable_http import streamablehttp_client from mcp....
302
11,469
onyx
backend/tests/integration/tests/mcp/test_craft_mcp_servers.py
.py
"""Integration tests for the craft-enabled MCP server listing. Verifies the `available_in_craft` admin toggle and that the user-facing craft listing reflects chat-side credential state (one credential store for both surfaces). """ import os import socket import subprocess import sys import time from collections.abc i...
193
6,612
onyx
backend/tests/integration/tests/kg/test_kg_api.py
.py
import json from datetime import datetime from http import HTTPStatus import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.models import InputType from onyx.db.connector import create_connector from onyx.db.engine.sql_engine import get_session_with_current_tenant from onyx.db.kg_config...
294
9,287
onyx
backend/tests/integration/tests/cli/test_cli_commands.py
.py
""" Integration tests for the onyx-cli binary against a real Onyx backend. These tests require a pre-built CLI binary passed via the ONYX_CLI_BINARY env var. In CI, the workflow builds the binary and mounts it into the test container. The tests are skipped when ONYX_CLI_BINARY is not set. LLM responses are mocked for...
550
17,758
onyx
backend/tests/integration/tests/cli/conftest.py
.py
"""Spawn a real uvicorn HTTP listener for the CLI test suite. Every other integration suite drives the api_server in-process via FastAPI ``TestClient``. The Go CLI binary is a separate subprocess and can only reach the server over the network, so this conftest brings up a real uvicorn on the loopback address alongside...
80
2,597
onyx
backend/tests/integration/tests/skills/test_skills_admin.py
.py
from __future__ import annotations import io import zipfile from uuid import UUID, uuid4 import httpx import pytest from sqlalchemy import select from onyx.auth.schemas import UserRole from onyx.configs.constants import FileOrigin from onyx.db.engine.sql_engine import get_session_with_current_tenant from onyx.db.enu...
332
11,444
onyx
backend/tests/integration/tests/skills/test_skills_personal.py
.py
"""Personal (user-level) skill API tests (HTTP boundary). Covers the user-facing ``POST /skills/custom``, ``PUT /skills/custom/{id}/bundle``, and ``DELETE /skills/custom/{id}`` endpoints: ownership/visibility rules, reserved names, duplicate names, promotion to org-wide, and admin disable as a reversible mute. """ fr...
386
13,447
onyx
backend/tests/integration/tests/skills/test_skills_user.py
.py
"""User skill API tests (HTTP boundary). These tests live at the user-facing HTTP boundary for ``/skills`` and ``/skills/{id}``. They verify visibility rules (public, private, group shares, disabled), the id lookup contract, and the admin-only delete guard. Admin-route mutation auth is covered exhaustively in ``test_...
146
5,164
onyx
backend/tests/integration/tests/skills/test_skills_management.py
.py
from __future__ import annotations from uuid import UUID, uuid4 import httpx import pytest from onyx.db.enums import SkillAccessLevel, SkillSharePermission from onyx.server.features.skill.models import ( SkillPatchRequest, SkillResponse, SkillUserShareRequest, ) from tests.integration.common_utils.consta...
427
14,290
onyx
backend/tests/integration/tests/skills/conftest.py
.py
"""Fixtures and helpers for skills integration tests.""" from __future__ import annotations import pytest from tests.integration.common_utils.constants import ADMIN_USER_NAME from tests.integration.common_utils.managers.llm_provider import LLMProviderManager from tests.integration.common_utils.managers.user import U...
18
605
onyx
backend/tests/integration/tests/pat/test_pat_api.py
.py
""" Integration tests for Personal Access Token (PAT) API. Test Suite: 1. test_pat_lifecycle_happy_path - Complete PAT lifecycle (create, auth, revoke) 2. test_pat_user_isolation_and_authentication - User authentication and multi-user isolation 3. test_pat_expiration_flow - Expiration logic (end-of-day UTC, never-expi...
501
17,766
onyx
backend/tests/integration/tests/personas/test_persona_pagination.py
.py
from onyx.server.features.persona.constants import ( ADMIN_AGENTS_RESOURCE, AGENTS_RESOURCE, ) from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.http_client import client from tests.integration.common_utils.managers.persona import PersonaManager from tests.i...
316
10,865
onyx
backend/tests/integration/tests/personas/test_persona_label_updates.py
.py
from uuid import uuid4 from onyx.server.features.persona.models import PersonaUpsertRequest from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.http_client import client from tests.integration.common_utils.managers.persona import ( PersonaLabelManager, Person...
62
2,142
onyx
backend/tests/integration/tests/personas/test_persona_knowledge_sources.py
.py
""" Integration tests verifying the knowledge_sources field on MinimalPersonaSnapshot. The GET /persona endpoint returns MinimalPersonaSnapshot, which includes a knowledge_sources list derived from the persona's document sets, hierarchy nodes, attached documents, and user files. These tests verify that the field is p...
82
3,244
onyx
backend/tests/integration/tests/personas/test_persona_categories.py
.py
from uuid import uuid4 import httpx import pytest from tests.integration.common_utils.managers.persona import PersonaLabelManager from tests.integration.common_utils.managers.user import UserManager from tests.integration.common_utils.test_models import DATestPersonaLabel, DATestUser def test_persona_label_manageme...
84
2,899
onyx
backend/tests/integration/tests/personas/test_unified_assistant.py
.py
"""Integration tests for the unified assistant.""" from tests.integration.common_utils.managers.persona import PersonaManager from tests.integration.common_utils.test_models import DATestUser def test_unified_assistant( reset: None, # noqa: ARG001 admin_user: DATestUser, ) -> None: """Combined test veri...
52
1,838
onyx
backend/tests/integration/tests/personas/test_persona_creation.py
.py
from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.http_client import client from tests.integration.common_utils.managers.persona import PersonaManager from tests.integration.common_utils.test_models import DATestUser def _list_minimal_personas(user: DATestUser) ->...
70
2,835
onyx
backend/tests/integration/tests/personas/test_persona_avatar.py
.py
""" Tests for the persona avatar endpoint (`GET /persona/{persona_id}/avatar`). Covers: 1. Round-trip upload + fetch for the persona owner. 2. Cross-user access honoring the persona's own ACL (public readable by everyone, private gated to owner/allowed members). 3. 404 responses for personas without a configured av...
179
5,869
onyx
backend/tests/integration/tests/personas/test_persona_file_context.py
.py
""" Integration tests for the unified persona file context flow. End-to-end tests that verify: 1. Files can be uploaded and attached to a persona via API. 2. The persona correctly reports its attached files. 3. A chat session with a file-bearing persona processes without error. 4. Precedence: custom persona files take...
312
11,567
onyx
backend/tests/integration/tests/chat/test_chat_session_persona_access.py
.py
"""Integration tests for persona access enforcement on chat session creation. Covers the `/chat/create-chat-session` endpoint and the implicit session-creation path inside `/chat/send-chat-message` when `chat_session_info` is provided. """ import json import os import pytest from tests.integration.common_utils.cons...
182
6,308
onyx
backend/tests/integration/tests/chat/test_chat_deletion.py
.py
import pytest from tests.integration.common_utils.managers.chat import ChatSessionManager from tests.integration.common_utils.managers.llm_provider import LLMProviderManager from tests.integration.common_utils.reset import reset_all from tests.integration.common_utils.test_models import DATestLLMProvider, DATestUser ...
342
12,699
onyx
backend/tests/integration/tests/chat/test_chat_session_access.py
.py
from uuid import uuid4 import httpx import pytest from onyx.auth.schemas import UserRole from tests.integration.common_utils.constants import API_SERVER_URL, GENERAL_HEADERS from tests.integration.common_utils.http_client import client from tests.integration.common_utils.managers.chat import ChatSessionManager from t...
214
7,651
onyx
backend/tests/integration/tests/chat/test_chat_document_set_access.py
.py
"""Integration tests for document set access enforcement in search filters. Covers the bypass where a user could override a persona's configured document sets by supplying `internal_search_filters.document_set` on a chat message. The SearchTool is only invoked when the LLM decides to call it, so these tests force the...
235
8,322
onyx
backend/tests/integration/tests/chat_retention/test_chat_retention.py
.py
import os import time import uuid from datetime import datetime, timedelta, timezone from uuid import UUID import httpx import pytest from pytest import MonkeyPatch from sqlalchemy import update from sqlalchemy.orm import Session import ee.onyx.background.celery.tasks.ttl_management.tasks as ttl_tasks from onyx.confi...
308
10,841
onyx
backend/tests/integration/tests/api_key/test_api_key.py
.py
from uuid import UUID from onyx.auth.schemas import UserRole from onyx.db.enums import AccountType from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.http_client import client from tests.integration.common_utils.managers.api_key import APIKeyManager from tests.integ...
272
9,919
onyx
backend/tests/integration/tests/indexing/test_polling.py
.py
import uuid from datetime import datetime, timedelta, timezone import httpx from onyx.configs.app_configs import POLL_CONNECTOR_OFFSET from onyx.configs.constants import DocumentSource from onyx.connectors.mock_connector.connector import MockConnectorCheckpoint from onyx.connectors.models import InputType from onyx.d...
151
6,117
onyx
backend/tests/integration/tests/indexing/test_initial_permission_sync.py
.py
import os import uuid from datetime import datetime, timezone import httpx import pytest from sqlalchemy import select from onyx.configs.constants import DocumentSource from onyx.connectors.mock_connector.connector import ( EXTERNAL_USER_EMAILS, EXTERNAL_USER_GROUP_IDS, MockConnectorCheckpoint, ) from ony...
241
8,419
onyx
backend/tests/integration/tests/indexing/test_repeated_error_state.py
.py
import time import uuid import httpx from onyx.background.celery.tasks.docprocessing.utils import ( NUM_REPEAT_ERRORS_BEFORE_REPEATED_ERROR_STATE, ) from onyx.configs.constants import DocumentSource from onyx.connectors.mock_connector.connector import MockConnectorCheckpoint from onyx.connectors.models import Inp...
219
8,351
onyx
backend/tests/integration/tests/indexing/test_checkpointing.py
.py
import uuid from datetime import datetime, timedelta, timezone import httpx from onyx.configs.constants import DocumentSource from onyx.connectors.mock_connector.connector import MockConnectorCheckpoint from onyx.connectors.models import ConnectorFailure, EntityFailure, InputType from onyx.db.engine.sql_engine import...
529
19,823
onyx
backend/tests/integration/tests/indexing/conftest.py
.py
import httpx import pytest from tests.integration.common_utils.constants import ( MOCK_CONNECTOR_SERVER_HOST, MOCK_CONNECTOR_SERVER_PORT, ) @pytest.fixture def mock_server_client() -> httpx.Client: print( f"Initializing mock server client with host: {MOCK_CONNECTOR_SERVER_HOST} and port: {MOCK_CO...
19
486
onyx
backend/tests/integration/tests/indexing/file_connector/test_file_connector_zip_metadata.py
.py
import json import os from datetime import datetime, timezone import pytest from onyx.connectors.models import InputType from onyx.db.document import get_documents_for_cc_pair from onyx.db.engine.sql_engine import get_session_with_current_tenant from onyx.db.enums import AccessType from onyx.server.documents.models i...
118
4,325
onyx
backend/tests/integration/tests/discord_bot/test_discord_bot_api.py
.py
"""Integration tests for Discord bot API endpoints. These tests hit actual API endpoints via HTTP client. """ import httpx import pytest from onyx.db.discord_bot import ( get_discord_service_api_key, get_or_create_discord_service_api_key, ) from onyx.db.engine.sql_engine import get_session_with_current_tenan...
412
14,831
onyx
backend/tests/integration/tests/discord_bot/test_discord_bot_db.py
.py
"""Integration tests for Discord bot database operations. These tests verify CRUD operations for Discord bot models. """ from collections.abc import Generator import pytest from sqlalchemy import select from sqlalchemy.orm import Session from onyx.auth.permissions import get_effective_permissions from onyx.db.disco...
697
23,176
onyx
backend/tests/integration/tests/log_export/test_log_export.py
.py
import json import os import time from io import BytesIO from uuid import uuid4 from zipfile import ZipFile import pytest from tests.integration.common_utils.constants import API_SERVER_URL from tests.integration.common_utils.http_client import client from tests.integration.common_utils.test_models import DATestUser ...
95
3,610
onyx
backend/tests/integration/tests/projects/test_projects.py
.py
from typing import List import httpx import pytest from onyx.db.engine.sql_engine import get_session_with_current_tenant from onyx.db.models import UserFile from onyx.server.features.projects.models import UserProjectSnapshot from tests.integration.common_utils.managers.project import ProjectManager from tests.integr...
243
8,245
onyx
backend/tests/integration/tests/image_generation/test_image_generation_tool_visibility.py
.py
"""Integration tests to check broader image generation config flow endpoints.""" import pytest from onyx.tools.tool_implementations.images.image_generation_tool import ( ImageGenerationTool, ) from tests.integration.common_utils.managers.image_generation import ( ImageGenerationConfigManager, ) from tests.int...
75
2,891