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/unit/sandbox_proxy/test_informer.py
.py
from unittest.mock import MagicMock, patch import pytest from kubernetes import client from onyx.sandbox_proxy.identity_k8s import K8sInformerLookup, _identity_from_pod def _make_pod( *, name: str = "sandbox-aaaa1111", pod_ip: str | None = "10.0.0.1", sandbox_id: str | None = "11111111-1111-1111-111...
157
5,268
onyx
backend/tests/unit/sandbox_proxy/test_identity.py
.py
from collections.abc import Iterator from contextlib import contextmanager from typing import Any from uuid import UUID, uuid4 import pytest from onyx.sandbox_proxy import identity as identity_mod from onyx.sandbox_proxy.identity import ( IdentityResolver, ResolvedSandbox, SandboxIdentity, ) from tests.un...
142
5,070
onyx
backend/tests/unit/sandbox_proxy/test_server.py
.py
"""Unit tests for sandbox-proxy process configuration.""" import pytest from onyx.sandbox_proxy import server def test_mitm_options_use_custom_upstream_ca_when_configured( monkeypatch: pytest.MonkeyPatch, ) -> None: monkeypatch.setattr( server, "SANDBOX_PROXY_SSL_VERIFY_UPSTREAM_TRUSTED_CA",...
35
941
onyx
backend/tests/unit/sandbox_proxy/test_request_evaluator.py
.py
"""Unit tests for the proxy's URL → ExternalApp resolution. ``resolve_app_for_url`` binds a request to a connected app before deferring to ``external_apps.matching.recognize_actions``. Transient (un-flushed) ``ExternalApp`` objects suffice — it only reads ``upstream_url_patterns``, never the DB. CUSTOM apps author glo...
62
2,269
onyx
backend/tests/unit/sandbox_proxy/test_errors.py
.py
"""Contract tests for the sandbox-facing 403 builder. Pins the response shape every code must satisfy without asserting the exact prose (which is free to be reworded). The completeness check guarantees a new code can't ship without a message. """ import json import pytest from onyx.sandbox_proxy.errors import Sandb...
37
1,083
onyx
backend/tests/unit/sandbox_proxy/test_identity_docker.py
.py
import threading import time from typing import cast from unittest.mock import MagicMock import pytest from docker import DockerClient from onyx.sandbox_proxy.identity_docker import ( DockerEventsLookup, _identity_from_container, ) _DEFAULT_NETWORK = "onyx_craft_sandbox" def _make_container( *, nam...
436
16,057
onyx
backend/tests/unit/sandbox_proxy/test_external_app_resolver.py
.py
"""Unit tests for `ExternalAppResolver`. The resolver is a thin wrapper around `resolve_injection_headers`; coverage focuses on the claim rule and the contract violations the dispatcher relies on. The renderer's per-header fail-open behaviour is pinned against a real DB in `tests/external_dependency_unit/craft/test_cr...
133
4,863
onyx
backend/tests/unit/sandbox_proxy/test_credential_injection.py
.py
"""Unit tests for `CredentialInjectionDispatcher`. The dispatcher is the single seam between the gate and any concrete `CredentialResolver`; per-resolver behaviour is tested separately. """ from __future__ import annotations from unittest.mock import MagicMock from onyx.external_apps.matching.engine import AllMatch...
167
6,011
onyx
backend/tests/unit/sandbox_proxy/test_mcp_jsonrpc.py
.py
"""Unit tests for the MCP JSON-RPC request classifier. Pins the fail-closed contract: only recognized protocol plumbing and well-formed `tools/call` bodies are classifiable; everything else on a matched MCP host is UNCLASSIFIABLE so the gate denies rather than forwarding with injected creds. """ from __future__ impor...
131
4,426
onyx
backend/tests/unit/sandbox_proxy/test_response_streaming.py
.py
"""End-to-end proxy test for response streaming. Drives a chunked upstream response through a *real* mitmproxy instance with the `GateAddon` wired in, and asserts the client receives a byte *before* the upstream has finished generating — i.e. the body is relayed incrementally, not buffered whole. This is the only asse...
288
10,151
onyx
backend/tests/unit/sandbox_proxy/test_gate.py
.py
"""Unit tests for the GateAddon mitmproxy addon. External dependencies (`_IdentityResolver`, `RequestEvaluator`, `CacheFactory`) are stubbed via small Protocol implementations; `get_session_with_tenant` is patched per test. The race arbiter (`_claim_expired_or_read_winner`) is covered against a real Postgres row in `...
1,762
62,935
onyx
backend/tests/unit/sandbox_proxy/test_healthz.py
.py
import http.client import threading from collections.abc import Iterator from http.server import HTTPServer import pytest from onyx.sandbox_proxy.identity import SandboxIPLookup from onyx.sandbox_proxy.server import _build_healthz_handler, _Readiness class _FakeLookup(SandboxIPLookup): def __init__(self, synced...
124
3,316
onyx
backend/tests/unit/sandbox_proxy/test_backend_dispatch.py
.py
from unittest.mock import MagicMock, patch import pytest from onyx.sandbox_proxy import backend as backend_mod from onyx.server.features.build.configs import SandboxBackend # Each test patches only the single constructor the dispatch branch is expected # to hit. The unpatched branch's concrete class would require li...
66
2,365
onyx
backend/tests/unit/sandbox_proxy/test_ca_docker.py
.py
from pathlib import Path import pytest from onyx.sandbox_proxy.ca import CAStoreConflictError from onyx.sandbox_proxy.ca_docker import FileCAStore _CERT = b"-----BEGIN CERTIFICATE-----\nfake-cert\n-----END CERTIFICATE-----\n" _KEY = b"-----BEGIN PRIVATE KEY-----\nfake-key\n-----END PRIVATE KEY-----\n" def _store(t...
76
2,475
onyx
backend/tests/unit/sandbox_proxy/test_ca_bootstrap.py
.py
import datetime as dt import threading from pathlib import Path import pytest from cryptography import x509 from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.x509.oid import NameOID from onyx.sandbox_proxy.ca import CABootstrap...
189
6,744
onyx
backend/tests/unit/sandbox_proxy/test_ca_k8s.py
.py
import base64 from unittest.mock import MagicMock import pytest from kubernetes import client from kubernetes.client.rest import ApiException from onyx.sandbox_proxy.ca import CAStoreConflictError from onyx.sandbox_proxy.ca_k8s import K8sSecretCAStore def _api_exception(status: int) -> ApiException: e = ApiExce...
176
6,395
onyx
backend/tests/unit/sandbox_proxy/test_onyx_pat_resolver.py
.py
"""Unit tests for `OnyxPatResolver`. Coverage: the host claim rule (incl. inert when `ONYX_SERVER_URL` is unset), header rendering on both auth headers, and the fail-closed cases the dispatcher maps to a 403. The encrypt/store/read round-trip against a real DB is pinned in `tests/external_dependency_unit/sandbox_proxy...
153
5,174
onyx
backend/tests/unit/sandbox_proxy/test_approval_cache.py
.py
from uuid import uuid4 import pytest from onyx.cache.interface import CacheBackend, CacheLock from onyx.db.enums import ApprovalDecision, GatedAppKind from onyx.sandbox_proxy.approval_cache import ( _wake_key, cache_session_grant_actions, cached_session_grants_cover, wait_for_wake, ) class _MemoryCa...
120
3,429
onyx
backend/tests/unit/sandbox_proxy/conftest.py
.py
"""Shared stubs and factories for sandbox_proxy unit tests. - `StaticLookup` — `SandboxIPLookup` stub keyed by source IP. - `make_resolved_sandbox` / `make_flow` / `make_matched_actions` — value + mitmproxy-flow factories. - `StubResolver` — identity resolver stub (sandbox + session) for the gate. - `RecordingCreden...
230
7,271
onyx
backend/tests/utils/pytest_secrets.py
.py
"""Pytest plugin for declaring and batch-fetching test secrets. Exposes a ``secrets`` marker and a session-scoped ``test_secrets`` fixture that resolves the union of ``TestSecret`` values declared across the collected tests in a single AWS call. To opt a test suite in, re-export the hooks and fixture from that suite'...
74
2,594
onyx
backend/tests/utils/aws_secrets.py
.py
""" Secrets utilities for fetching test secrets. Secrets are resolved in order: 1. Environment variables (already set in the process) 2. .env file at the repo root (loaded via dotenv) 3. AWS Secrets Manager (batch fetch for any remaining keys) The AWS environment (prefix) is derived from the enum type pas...
179
6,317
onyx
backend/tests/utils/secret_names.py
.py
""" Secret name enums for test secrets. Each AWS Secrets Manager environment gets its own enum class. The environment is derived from the enum type when fetching, so the type checker ensures you can't mix secrets from different environments in a single batch call. Usage: from tests.utils.aws_secrets import get_se...
113
4,614
onyx
backend/tests/regression/search_quality/utils.py
.py
import json import re from pathlib import Path from textwrap import indent from typing import Any, TextIO, cast from ragas import ( # ty: ignore[unresolved-import] EvaluationDataset, SingleTurnSample, evaluate, ) from ragas.dataset_schema import EvaluationResult # ty: ignore[unresolved-import] from ragas...
215
7,266
onyx
backend/tests/regression/search_quality/run_search_eval.py
.py
import csv import json import os import sys import time from collections import defaultdict from concurrent.futures import ThreadPoolExecutor, as_completed from datetime import datetime from pathlib import Path from threading import Event, Lock, Semaphore from typing import cast import matplotlib.pyplot as plt import ...
738
27,844
onyx
backend/tests/regression/answer_quality/file_uploader.py
.py
import csv import os import tempfile import time import zipfile from pathlib import Path from types import SimpleNamespace import yaml from tests.regression.answer_quality.api_utils import ( check_indexing_status, create_cc_pair, create_connector, create_credential, run_cc_once, upload_file, )...
111
3,831
onyx
backend/tests/regression/answer_quality/cli_utils.py
.py
import json import os import socket import subprocess import sys import time from datetime import datetime from threading import Thread from typing import IO import yaml from onyx.utils.retry_wrapper import retry_builder def _run_command(command: str, stream_output: bool = False) -> tuple[str, str]: process = s...
325
10,968
onyx
backend/tests/regression/answer_quality/launch_eval_env.py
.py
import os from types import SimpleNamespace import yaml from tests.regression.answer_quality.cli_utils import ( manage_data_directories, set_env_variables, start_docker_compose, switch_to_commit, ) def load_config(config_filename: str) -> SimpleNamespace: current_dir = os.path.dirname(os.path.ab...
50
1,365
onyx
backend/tests/regression/answer_quality/api_utils.py
.py
import requests from onyx.configs.constants import DocumentSource from onyx.connectors.models import InputType from onyx.db.enums import IndexingStatus from onyx.server.documents.models import ConnectorBase from onyx.utils.retry_wrapper import retry_builder from tests.regression.answer_quality.cli_utils import get_api...
167
6,033
onyx
backend/tests/common/paths.py
.py
"""Filesystem anchors for tests that read files outside their own package.""" from __future__ import annotations from pathlib import Path def find_ancestor_containing(marker: str) -> Path: """Nearest ancestor directory of the tests tree containing ``marker``. Marker-based upward search instead of hardcoded...
19
627
onyx
backend/tests/common/craft/skill_table_isolation.py
.py
"""Skill/external-app table snapshot helpers for Craft tests.""" from __future__ import annotations from typing import Any from sqlalchemy import select from sqlalchemy.orm import Session, class_mapper from onyx.db.models import ( ExternalApp, ExternalAppUserCredential, GatedActionPolicy, GatedApp, ...
81
2,389
onyx
backend/tests/common/craft/users.py
.py
"""Shared user-seeding helpers for craft integration suites.""" from __future__ import annotations import httpx from onyx.auth.schemas import UserRole from tests.integration.common_utils.constants import GENERAL_HEADERS from tests.integration.common_utils.managers.user import ( DEFAULT_PASSWORD, UserManager,...
59
1,919
onyx
backend/tests/common/craft/payloads.py
.py
"""Pure Craft test payload builders.""" from __future__ import annotations from typing import Any from onyx.db.enums import EndpointPolicy from onyx.external_apps.matching.engine import MatchedAction from onyx.server.features.build.sandbox.models import CraftLLMProviderConfig def default_llm_config( provider: ...
51
1,406
onyx
backend/tests/common/craft/stubs.py
.py
"""Test-double sandbox manager for craft tests. This module exposes ``StubSandboxManager`` — a controllable, in-memory implementation of ``SandboxManager``. It is intentionally **strict**: any abstract method on the ABC that is invoked without explicit configuration on the stub raises ``NotImplementedError`` with a me...
757
30,492
onyx
backend/tests/daily/conftest.py
.py
import os # Daily tests run without a live backend; EE code paths that depend on # Redis/Vespa/etc are not available, so disable enforcement before any # module-level imports below pull in EE versioned implementations. os.environ["LICENSE_ENFORCEMENT_ENABLED"] = "false" from collections.abc import ( AsyncGenerato...
85
3,050
onyx
backend/tests/daily/targeted_reindex/test_drive_targeted_reindex_integration.py
.py
"""Integration coverage for targeted-reindex against real Google Drive. Exercises the task body, connector instantiation, `Resolver.reindex` invocation against the real Drive API, indexing pipeline run, OpenSearch write, and resolution tracking on `IndexAttemptError` — using the same Drive service account that the exi...
235
8,531
onyx
backend/tests/daily/targeted_reindex/helpers.py
.py
"""Helpers for daily targeted-reindex integration tests. Each helper writes the minimum DB state needed to drive the targeted- reindex flow against a real Drive cc_pair: a connector + credential + cc_pair tied to the Drive service account, a parent IndexAttempt to hang errors off of, and an IndexAttemptError pointing ...
190
6,569
onyx
backend/tests/daily/targeted_reindex/conftest.py
.py
"""Daily-suite conftest for targeted-reindex integration tests. These tests need: - Real Postgres (cc_pair, IndexAttempt, IndexAttemptError, TargetedReindexJob rows) - Real OpenSearch (verify documents actually land in the index) - Real Drive credentials (via the shared `test_secrets` fixture) The parent `tests/daily...
49
1,883
onyx
backend/tests/daily/connectors/utils.py
.py
from collections.abc import Iterator from typing import IO, TypeVar from pydantic import BaseModel from onyx.connectors.connector_runner import CheckpointOutputWrapper from onyx.connectors.interfaces import ( BaseConnector, CheckpointedConnector, CheckpointedConnectorWithPermSync, SecondsSinceUnixEpoc...
185
6,934
onyx
backend/tests/daily/connectors/conftest.py
.py
from collections.abc import Generator from unittest.mock import MagicMock, patch import pytest @pytest.fixture def mock_get_unstructured_api_key() -> Generator[MagicMock, None, None]: with patch( "onyx.file_processing.extract_file_text.get_unstructured_api_key", return_value=None, ) as mock: ...
14
339
onyx
backend/tests/daily/connectors/google_drive/test_gdrive_shortcuts_daily.py
.py
from collections.abc import Callable from unittest.mock import MagicMock, patch import pytest from onyx.connectors.google_drive.connector import GoogleDriveConnector from onyx.connectors.models import Document, TextSection from tests.daily.connectors.google_drive.consts_and_utils import ( ADMIN_EMAIL, RESOURC...
91
3,132
onyx
backend/tests/daily/connectors/google_drive/test_sections.py
.py
from collections.abc import Callable from unittest.mock import MagicMock, patch import pytest from onyx.connectors.google_drive.connector import GoogleDriveConnector from tests.daily.connectors.google_drive.consts_and_utils import ( ADMIN_EMAIL, SECTIONS_FOLDER_URL, load_connector_outputs, ) from tests.ut...
83
3,151
onyx
backend/tests/daily/connectors/google_drive/test_admin_oauth.py
.py
from collections.abc import Callable from unittest.mock import MagicMock, patch import pytest from onyx.connectors.google_drive.connector import GoogleDriveConnector from tests.daily.connectors.google_drive.consts_and_utils import ( ADMIN_EMAIL, ADMIN_FILE_IDS, ADMIN_FOLDER_3_FILE_IDS, ADMIN_MY_DRIVE_...
400
12,978
onyx
backend/tests/daily/connectors/google_drive/test_drive_perm_sync.py
.py
import copy import json import os from collections import defaultdict from collections.abc import Callable from unittest.mock import MagicMock, patch import pytest from ee.onyx.external_permissions.google_drive.doc_sync import gdrive_doc_sync from ee.onyx.external_permissions.google_drive.group_sync import gdrive_gro...
297
11,362
onyx
backend/tests/daily/connectors/google_drive/test_resolver.py
.py
"""Tests for GoogleDriveConnector.reindex against real Google Drive.""" import json import os from collections.abc import Callable from unittest.mock import patch import pytest from onyx.connectors.google_drive.connector import GoogleDriveConnector from onyx.connectors.models import ( ConnectorFailure, Docum...
251
9,243
onyx
backend/tests/daily/connectors/google_drive/test_map_test_ids.py
.py
#!/usr/bin/env python import json import os import pytest from onyx.connectors.google_drive.connector import GoogleDriveConnector from tests.daily.connectors.google_drive.conftest import build_credentials from tests.daily.connectors.google_drive.consts_and_utils import ( ADMIN_EMAIL, ADMIN_FILE_IDS, FOLD...
139
4,905
onyx
backend/tests/daily/connectors/google_drive/consts_and_utils.py
.py
import time from collections.abc import Sequence from dataclasses import dataclass, field, replace from urllib.parse import urlparse from onyx.connectors.google_drive.connector import GoogleDriveConnector from onyx.connectors.models import Document, HierarchyNode, TextSection from onyx.db.enums import HierarchyNodeTyp...
822
30,110
onyx
backend/tests/daily/connectors/google_drive/test_service_acct.py
.py
from collections.abc import Callable from unittest.mock import MagicMock, patch from urllib.parse import urlparse import pytest from onyx.connectors.google_drive.connector import GoogleDriveConnector from onyx.connectors.google_utils.google_utils import execute_paginated_retrieval from tests.daily.connectors.google_d...
715
24,501
onyx
backend/tests/daily/connectors/google_drive/test_link_visibility_filter.py
.py
from collections.abc import Iterable from typing import Any from unittest.mock import patch from onyx.connectors.google_drive.connector import GoogleDriveConnector from onyx.connectors.google_drive.file_retrieval import has_link_only_permission from onyx.connectors.google_drive.models import DriveRetrievalStage, Retri...
136
4,428
onyx
backend/tests/daily/connectors/google_drive/test_user_1_oauth.py
.py
from collections.abc import Callable from unittest.mock import MagicMock, patch import pytest from onyx.connectors.google_drive.connector import GoogleDriveConnector from onyx.connectors.models import Document from tests.daily.connectors.google_drive.consts_and_utils import ( ADMIN_FOLDER_3_FILE_IDS, DONWLOAD...
271
9,011
onyx
backend/tests/daily/connectors/google_drive/conftest.py
.py
import json import resource from collections.abc import Callable from typing import Any import pytest from onyx.connectors.google_drive.connector import GoogleDriveConnector from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_AUTHENTICATION_METHOD, DB_CREDENTIALS_DICT_SERVICE_ACCOUNT_KE...
153
5,278
onyx
backend/tests/daily/connectors/gitlab/test_gitlab_basic.py
.py
import itertools import os import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.gitlab.connector import GitlabConnector from onyx.connectors.models import HierarchyNode from tests.utils.secret_names import TestSecret pytestmark = pytest.mark.secrets(TestSecret.GITLAB_ACCESS_TOKEN) @...
141
5,870
onyx
backend/tests/daily/connectors/slab/test_slab_connector.py
.py
import json import time from pathlib import Path import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.models import Document, HierarchyNode from onyx.connectors.slab.connector import SlabConnector from tests.utils.secret_names import TestSecret pytestmark = pytest.mark.secrets(TestSec...
98
3,248
onyx
backend/tests/daily/connectors/airtable/test_airtable_basic.py
.py
import os from typing import cast from unittest.mock import MagicMock import pytest from pydantic import BaseModel from onyx.configs.constants import DocumentSource from onyx.connectors.airtable.airtable_connector import AirtableConnector from onyx.connectors.models import Document, HierarchyNode, ImageSection, TextS...
534
18,983
onyx
backend/tests/daily/connectors/outline/test_outline_connector.py
.py
import os import time from typing import Any import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.exceptions import ConnectorValidationError, CredentialExpiredError from onyx.connectors.models import ( ConnectorMissingCredentialError, Document, HierarchyNode, ) from onyx.co...
210
7,905
onyx
backend/tests/daily/connectors/gong/test_gong.py
.py
import time from unittest.mock import MagicMock, patch import pytest from onyx.connectors.gong.connector import GongConnector from onyx.connectors.models import Document from tests.utils.secret_names import TestSecret pytestmark = pytest.mark.secrets( TestSecret.GONG_ACCESS_KEY, TestSecret.GONG_ACCESS_KEY_SE...
57
1,499
onyx
backend/tests/daily/connectors/gmail/test_gmail_connector.py
.py
from collections.abc import Callable from typing import Any, cast from unittest.mock import MagicMock, patch import pytest from onyx.connectors.gmail.connector import GmailConnector from onyx.connectors.models import Document, HierarchyNode, SlimDocument from tests.unit.onyx.connectors.utils import load_everything_fr...
136
4,938
onyx
backend/tests/daily/connectors/gmail/conftest.py
.py
import json from collections.abc import Callable from typing import Any import pytest from onyx.connectors.gmail.connector import GmailConnector from onyx.connectors.google_utils.shared_constants import ( DB_CREDENTIALS_AUTHENTICATION_METHOD, DB_CREDENTIALS_DICT_SERVICE_ACCOUNT_KEY, DB_CREDENTIALS_DICT_TO...
78
2,652
onyx
backend/tests/daily/connectors/teams/models.py
.py
from pydantic import BaseModel from onyx.access.models import ExternalAccess from onyx.connectors.models import Document class TeamsThread(BaseModel): thread: str external_access: ExternalAccess @classmethod def from_doc(cls, document: Document) -> "TeamsThread": assert document.external_acc...
21
552
onyx
backend/tests/daily/connectors/teams/test_teams_connector.py
.py
import time import pytest from onyx.access.models import ExternalAccess from onyx.connectors.models import HierarchyNode from onyx.connectors.teams.connector import TeamsConnector from tests.daily.connectors.teams.models import TeamsThread from tests.daily.connectors.utils import load_all_from_connector from tests.ut...
199
6,575
onyx
backend/tests/daily/connectors/highspot/test_highspot_connector.py
.py
import json import os import time from datetime import datetime from pathlib import Path from unittest.mock import MagicMock, patch import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.highspot.connector import HighspotConnector from onyx.connectors.models import Document, HierarchyNod...
193
6,721
onyx
backend/tests/daily/connectors/fireflies/test_fireflies_connector.py
.py
import json import time from pathlib import Path from typing import Any import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.fireflies.connector import FirefliesConnector from onyx.connectors.models import Document, HierarchyNode from tests.utils.secret_names import TestSecret pytestm...
69
2,496
onyx
backend/tests/daily/connectors/confluence/test_confluence_html_parser.py
.py
import os import time from unittest.mock import patch import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.confluence.connector import ConfluenceConnector from onyx.connectors.credentials_provider import OnyxStaticCredentialsProvider from onyx.connectors.models import Document from ony...
84
2,782
onyx
backend/tests/daily/connectors/confluence/models.py
.py
from pydantic import BaseModel from ee.onyx.db.external_perm import ExternalUserGroup class ExternalUserGroupSet(BaseModel): """A version of ExternalUserGroup that uses a set for user_emails to avoid order-dependent comparisons.""" id: str user_emails: set[str] gives_anyone_access: bool @classm...
23
705
onyx
backend/tests/daily/connectors/confluence/test_confluence_resolver.py
.py
"""Tests for ConfluenceConnector.reindex against a real Confluence space.""" import os import re import time from unittest.mock import MagicMock, patch import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.confluence.connector import ConfluenceConnector from onyx.connectors.credentials...
210
6,921
onyx
backend/tests/daily/connectors/confluence/test_confluence_basic.py
.py
import os import time from typing import Any from unittest.mock import MagicMock, patch import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.confluence.connector import ConfluenceConnector from onyx.connectors.confluence.utils import AttachmentProcessingResult from onyx.connectors.cred...
272
10,052
onyx
backend/tests/daily/connectors/confluence/test_confluence_permissions_basic.py
.py
import os import time from unittest.mock import MagicMock, patch import pytest from ee.onyx.external_permissions.confluence.doc_sync import confluence_doc_sync from onyx.access.models import DocExternalAccess from onyx.configs.constants import DocumentSource from onyx.connectors.confluence.connector import Confluence...
259
9,984
onyx
backend/tests/daily/connectors/confluence/test_confluence_user_email_overrides.py
.py
import types from unittest.mock import patch from onyx.connectors.confluence.onyx_confluence import ConfluenceUser, OnyxConfluence from onyx.connectors.interfaces import CredentialsProviderInterface class MockCredentialsProvider(CredentialsProviderInterface): def get_tenant_id(self) -> str: return "test_...
125
4,255
onyx
backend/tests/daily/connectors/discord/test_discord_connector.py
.py
import time import pytest from onyx.connectors.discord.connector import DiscordConnector from onyx.connectors.models import Document, DocumentSource, HierarchyNode from tests.utils.secret_names import TestSecret pytestmark = pytest.mark.secrets(TestSecret.DISCORD_CONNECTOR_BOT_TOKEN) @pytest.fixture def discord_co...
46
1,451
onyx
backend/tests/daily/connectors/canvas/test_canvas_perm_sync_daily.py
.py
import time from typing import cast from unittest.mock import MagicMock import pytest from ee.onyx.connectors.perm_sync_valid import validate_canvas_perm_sync from ee.onyx.external_permissions.canvas.access import ( CanvasCoursePermissionContext, build_course_permission_context, ) from ee.onyx.external_permis...
434
13,925
onyx
backend/tests/daily/connectors/sharepoint/test_sharepoint_connector.py
.py
import os import time from dataclasses import dataclass from datetime import datetime, timezone from unittest.mock import MagicMock, patch import pytest from ee.onyx.external_permissions.sharepoint.permission_utils import ( GET_SHAREPOINT_LIST_ITEM_ID_LABEL, ) from onyx.access.models import ExternalAccess from on...
942
34,259
onyx
backend/tests/daily/connectors/jira/test_jira_basic.py
.py
import time from unittest.mock import patch import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.jira.connector import JiraConnector from onyx.connectors.models import Document from tests.daily.connectors.utils import load_all_from_connector from tests.utils.secret_names import TestSec...
212
6,429
onyx
backend/tests/daily/connectors/box/test_box_basic.py
.py
"""Daily tests against a real Box enterprise. The expected corpus (folder tree, collaborations, shared links, group) is defined in README.md next to this file — set the test enterprise up exactly as described there before running. """ from datetime import timezone from time import time from typing import cast from un...
322
13,046
onyx
backend/tests/daily/connectors/gitbook/test_gitbook_connector.py
.py
import time import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.gitbook.connector import GitbookConnector from onyx.connectors.models import HierarchyNode from tests.utils.secret_names import TestSecret pytestmark = pytest.mark.secrets( TestSecret.GITBOOK_SPACE_ID, TestSecret...
114
3,531
onyx
backend/tests/daily/connectors/hubspot/test_hubspot_connector.py
.py
from datetime import datetime, timezone from typing import Any from unittest.mock import MagicMock, patch import pytest from onyx.connectors.hubspot.connector import AVAILABLE_OBJECT_TYPES, HubSpotConnector from onyx.connectors.models import ( ConnectorMissingCredentialError, Document, HierarchyNode, ) fr...
603
24,759
onyx
backend/tests/daily/connectors/slack/test_slack_perm_sync.py
.py
import time from datetime import datetime, timezone import pytest from onyx.connectors.models import HierarchyNode, SlimDocument from onyx.connectors.slack.connector import SlackConnector from tests.daily.connectors.utils import load_all_from_connector from tests.utils.secret_names import TestSecret PUBLIC_CHANNEL_N...
182
6,229
onyx
backend/tests/daily/connectors/slack/test_slack_connector.py
.py
import time import pytest from onyx.connectors.slack.connector import SlackConnector from onyx.db.enums import HierarchyNodeType from tests.daily.connectors.utils import ( load_all_from_connector, to_sections, to_text_sections, ) from tests.utils.secret_names import TestSecret pytestmark = pytest.mark.se...
129
3,934
onyx
backend/tests/daily/connectors/slack/conftest.py
.py
from collections.abc import Generator import pytest from pytest import FixtureRequest from onyx.connectors.credentials_provider import OnyxStaticCredentialsProvider from onyx.connectors.slack.connector import SlackConnector from shared_configs.contextvars import get_current_tenant_id from tests.utils.secret_names imp...
38
1,194
onyx
backend/tests/daily/connectors/salesforce/test_salesforce_connector.py
.py
import json import os from datetime import datetime, timezone from pathlib import Path from typing import Any, cast import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.models import Document, HierarchyNode from onyx.connectors.salesforce.connector import SalesforceConnector from onyx....
209
7,569
onyx
backend/tests/daily/connectors/github/test_github_basic.py
.py
import time import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.github.connector import GithubConnector from tests.daily.connectors.utils import load_all_from_connector from tests.utils.secret_names import TestSecret pytestmark = pytest.mark.secrets(TestSecret.ACCESS_TOKEN_GITHUB) ...
82
2,737
onyx
backend/tests/daily/connectors/blob/test_blob_connector.py
.py
import os from unittest.mock import MagicMock, patch from urllib.parse import parse_qs, unquote, urlparse import pytest from onyx.configs.constants import BlobType from onyx.connectors.blob.connector import BlobStorageConnector from onyx.connectors.cross_connector_utils.tabular_section_utils import is_tabular_file fr...
271
9,237
onyx
backend/tests/daily/connectors/zendesk/test_zendesk_connector.py
.py
import json import time from pathlib import Path from typing import cast import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.models import Document, HierarchyNode from onyx.connectors.zendesk.connector import ZendeskConnector from tests.daily.connectors.utils import load_all_from_conn...
139
5,025
onyx
backend/tests/daily/connectors/file/test_file_connector.py
.py
import io from datetime import datetime, timezone from unittest.mock import MagicMock, patch from uuid import uuid4 import pytest from onyx.connectors.file.connector import LocalFileConnector from onyx.connectors.models import HierarchyNode from tests.daily.connectors.utils import set_test_staging_callback @pytest....
285
10,121
onyx
backend/tests/daily/connectors/bitbucket/test_bitbucket_slim_connector.py
.py
import os import time import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.bitbucket.connector import BitbucketConnector from onyx.connectors.models import HierarchyNode from tests.daily.connectors.utils import load_all_from_connector from tests.utils.secret_names import TestSecret py...
71
2,265
onyx
backend/tests/daily/connectors/bitbucket/test_bitbucket_checkpointed.py
.py
import os import time import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.bitbucket.connector import BitbucketConnector from tests.daily.connectors.utils import load_all_from_connector from tests.utils.secret_names import TestSecret pytestmark = pytest.mark.secrets( TestSecret.BI...
79
2,443
onyx
backend/tests/daily/connectors/bitbucket/conftest.py
.py
from tests.load_env_vars import load_env_vars # Load environment variables at the module level load_env_vars()
5
112
onyx
backend/tests/daily/connectors/imap/models.py
.py
from pydantic import BaseModel from onyx.connectors.models import Document from tests.daily.connectors.utils import to_text_sections class EmailDoc(BaseModel): subject: str recipients: set[str] body: str @classmethod def from_doc(cls, document: Document) -> "EmailDoc": # Acceptable to pe...
25
684
onyx
backend/tests/daily/connectors/imap/test_imap_connector.py
.py
import os import time import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.credentials_provider import OnyxStaticCredentialsProvider from onyx.connectors.imap.connector import ImapConnector from tests.daily.connectors.imap.models import EmailDoc from tests.daily.connectors.utils import...
82
2,303
onyx
backend/tests/daily/connectors/web/test_web_connector.py
.py
from concurrent.futures import ThreadPoolExecutor import pytest from onyx.connectors.models import Document, HierarchyNode from onyx.connectors.web.connector import WEB_CONNECTOR_VALID_SETTINGS, WebConnector EXPECTED_QUOTE = ( "If you can't explain it to a six year old, you don't understand it yourself." ) # N...
101
3,541
onyx
backend/tests/daily/connectors/notion/test_notion_connector.py
.py
import time import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.models import Document, HierarchyNode from onyx.connectors.notion.connector import NotionConnector from tests.utils.secret_names import TestSecret pytestmark = pytest.mark.secrets(TestSecret.NOTION_INTEGRATION_TOKEN) V...
180
6,473
onyx
backend/tests/daily/connectors/coda/test_coda_connector.py
.py
import os import time from collections.abc import Generator from typing import Any import pytest from onyx.configs.constants import DocumentSource from onyx.connectors.coda.connector import CodaConnector from onyx.connectors.exceptions import CredentialInvalidError from onyx.connectors.models import Document, Hierarc...
478
17,700
onyx
backend/tests/daily/embedding/test_embeddings.py
.py
import pytest from tenacity import ( retry, retry_if_exception_type, stop_after_attempt, wait_exponential, ) from onyx.natural_language_processing.search_nlp_models import EmbeddingModel from shared_configs.enums import EmbedTextType from shared_configs.model_server_models import EmbeddingProvider from...
168
6,110
onyx
backend/tests/airgap/test_default_model_server_embeddings_are_finite.py
.py
import json import math import urllib.request from onyx.configs.model_configs import ( ASYM_QUERY_PREFIX, DEFAULT_DOCUMENT_ENCODER_MODEL, DOC_EMBEDDING_DIM, ) from shared_configs.configs import ( DOC_EMBEDDING_CONTEXT_SIZE, MODEL_SERVER_HOST, MODEL_SERVER_PORT, ) from shared_configs.enums impor...
56
1,723
onyx
backend/tests/airgap/tls_failure_server.py
.py
import ssl import tempfile from datetime import UTC, datetime, timedelta from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer from ipaddress import IPv4Address from pathlib import Path from cryptography import x509 from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat...
77
2,470
onyx
backend/tests/evals/connector_filter_eval/scope_eval_cases.py
.py
"""Eval-question dataset for the source-scope filter extraction. Each case is one direct `decide_search_scope` invocation: the user-side conversation, the connected sources, the cycle state, and the exact scope the flow must return (`None` == unscoped, search everything). The regression runner in `test_filter_extracti...
332
13,238
onyx
backend/tests/evals/connector_filter_eval/test_filter_extraction_regression.py
.py
"""Scored regression eval for the source-scope filter extraction prompt. Runs every eval question in `scope_eval_cases.py` directly through `decide_search_scope` (real LLM, no agent loop) and fails if the pass rate drops below the threshold. This is the CI gate for changes to `onyx/prompts/filter_extration.py` — see t...
125
4,739
onyx
backend/tests/evals/connector_filter_eval/conftest.py
.py
import os from pathlib import Path import pytest from sqlalchemy.orm import Session from onyx.db.enums import LLMModelFlowType from onyx.db.llm import ( fetch_existing_llm_providers, fetch_llm_provider_view, update_default_provider, upsert_llm_provider, ) from onyx.llm.constants import LlmProviderName...
101
3,740
onyx
backend/scripts/upload_files_as_connectors.py
.py
""" Script to upload files from a directory as individual file connectors in Onyx. Each file gets its own connector named after the file. Usage: python upload_files_as_connectors.py --data-dir /path/to/files --api-key YOUR_KEY python upload_files_as_connectors.py --data-dir /path/to/files --api-key YOUR_KEY --...
292
8,546
onyx
backend/scripts/update_connector_prune_freq.py
.py
"""Script to update connector prune_freq from one value to another (in days). Must be run from inside a Kubernetes pod. DB connection is picked up automatically from the pod's environment variables. Usage: python -m scripts.update_connector_prune_freq --from-days <n> --to-days <n> [--dry-run] Example: python...
99
3,156
onyx
backend/scripts/decrypt.py
.py
"""Decrypt a raw hex-encoded credential value. Usage: python -m scripts.decrypt <hex_value> python -m scripts.decrypt <hex_value> --key "my-encryption-key" python -m scripts.decrypt <hex_value> --key "" Pass --key "" to skip decryption and just decode the raw bytes as UTF-8. Omit --key to use the current ...
94
2,804
onyx
backend/scripts/chat_loadtest.py
.py
"""Basic Usage: python scripts/chat_loadtest.py --api-key <api-key> --url <onyx-url>/api to run from the container itself, copy this file in and run: python chat_loadtest.py --api-key <api-key> --url localhost:8080 For more options, checkout the bottom of the file. """ import argparse import asyncio import logging...
235
7,767