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 |
|---|---|---|---|---|---|
OpenViking | tests/server/test_content_write_service.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
"""Service-level tests for content write coordination."""
from types import SimpleNamespace
import pytest
from openviking.server.identity import RequestContext, Role
from openviking.session.memory.dataclass import... | 1,574 | 57,725 |
OpenViking | tests/server/test_upload_token_store.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for openviking/server/upload_token_store.py."""
from __future__ import annotations
import pytest
from openviking.server.upload_token_store import (
_TOKEN_ALPHABET,
_TOKEN_LENGTH,
UploadTokenErro... | 127 | 3,809 |
OpenViking | tests/server/test_bot_proxy_auth.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Regression tests for bot proxy endpoint auth enforcement."""
import json
from types import SimpleNamespace
import httpx
import pytest
from fastapi import FastAPI
import openviking.server.routers.bot as bot_router... | 422 | 14,489 |
OpenViking | tests/server/test_mcp_parse_mode.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""MCP add_resource parse-mode propagation tests."""
from types import SimpleNamespace
from unittest.mock import AsyncMock
import pytest
from openviking.server import mcp_endpoint
from openviking.server.identity imp... | 117 | 3,460 |
OpenViking | tests/server/test_server_health.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for server infrastructure: health, system status, middleware, error handling."""
import asyncio
import time
from types import SimpleNamespace
import httpx
from openviking.server.app import _initialize_runti... | 328 | 11,182 |
OpenViking | tests/server/test_content_batch_write.py | .py | import base64
import hashlib
import pytest
import openviking.storage.content_write as content_write_module
from openviking.server.identity import RequestContext, Role
from openviking.storage.content_write import ContentWriteCoordinator
from openviking_cli.exceptions import (
ConflictError,
InvalidArgumentErro... | 529 | 17,451 |
OpenViking | tests/server/test_admin_rebuild_api.py | .py | """Tests for reindex admin endpoint and executor behavior."""
import httpx
import pytest
from openviking.core.context import ContextLevel
from openviking.server.identity import RequestContext, Role
from openviking_cli.exceptions import OpenVikingError, PermissionDeniedError
from openviking_cli.session.user_id import ... | 2,912 | 96,778 |
OpenViking | tests/server/test_error_mapping.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Focused tests for HTTP server exception-to-error mapping."""
from openviking.pyagfs.exceptions import (
AGFSClientError,
AGFSHTTPError,
AGFSIsADirectoryError,
AGFSNotSupportedError,
AGFSResource... | 235 | 7,479 |
OpenViking | tests/server/test_api_resources.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for resource management endpoints."""
import asyncio
import zipfile
from types import SimpleNamespace
import httpx
import pytest
from openviking.server.identity import RequestContext, Role
from openviking.s... | 1,069 | 32,872 |
OpenViking | tests/server/test_api_local_input_security.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Security tests for HTTP server local input handling."""
import threading
import zipfile
from http.server import BaseHTTPRequestHandler, HTTPServer
import httpx
import pytest
from openviking.parse.accessors.http_a... | 343 | 10,289 |
OpenViking | tests/server/test_resource_ingest_parse_mode.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""parse_mode propagation through shared temp-upload ingestion."""
from types import SimpleNamespace
from unittest.mock import AsyncMock
import pytest
from openviking.server import resource_ingest
from openviking.se... | 50 | 1,515 |
OpenViking | tests/server/test_api_privacy_configs.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import httpx
async def test_privacy_config_api_roundtrip(client: httpx.AsyncClient):
upsert = await client.post(
"/api/v1/privacy-configs/skill/demo-skill",
json={
"values": {"api_key"... | 123 | 4,347 |
OpenViking | tests/server/test_api_observer.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for observer endpoints (/api/v1/observer/*)."""
import httpx
async def test_observer_queue(client: httpx.AsyncClient):
"""GET /api/v1/observer/queue should return queue status."""
resp = await clien... | 55 | 1,792 |
OpenViking | tests/server/test_api_watches.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for watch management endpoints (RFC #2104)."""
import asyncio
import httpx
import pytest
@pytest.fixture
def watch_manager(service):
wm = service.watch_scheduler.watch_manager
assert wm is not None... | 247 | 9,530 |
OpenViking | tests/server/test_sdk_time_filters.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from datetime import datetime, timedelta, timezone
from openviking.server.identity import RequestContext, Role
from openviking.utils.time_utils import format_iso8601
from openviking_cli.session.user_id import UserIden... | 134 | 4,791 |
OpenViking | tests/server/test_api_agent_evolution.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import httpx
async def test_list_experience_trajectories_uses_default_pagination(
client: httpx.AsyncClient,
service,
monkeypatch,
):
captured = {}
async def fake_list(*, experience_uri, ctx, lim... | 172 | 4,846 |
OpenViking | tests/server/test_request_id.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Request ID validation, propagation, and logging tests."""
from __future__ import annotations
import asyncio
import logging
from types import SimpleNamespace
from uuid import UUID
import httpx
from fastapi import ... | 202 | 7,056 |
OpenViking | tests/server/test_bootstrap.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
import os
from types import SimpleNamespace
import openviking.server.app as app_module
import openviking.server.bootstrap as bootstrap
from openviking.server.config import ServerCon... | 285 | 9,321 |
OpenViking | tests/server/test_recall_peer_scope.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import httpx
from openviking_cli.retrieve import ContextType, MatchedContext
class _FakeFindResult:
def __init__(self, memories):
self.memories = memories
def _memory(uri: str, score: float = 0.9, abst... | 114 | 3,724 |
OpenViking | tests/server/test_api_search.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for search endpoints: find, search, grep, glob."""
from datetime import datetime, timezone
import httpx
import pytest
from openviking.models.embedder.base import EmbedResult
from openviking.server.auth impo... | 1,023 | 31,888 |
OpenViking | tests/server/test_error_scenarios.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for error scenarios: invalid JSON, missing fields, error mapping."""
import httpx
def _assert_invalid_request_response(resp: httpx.Response):
assert resp.status_code == 400
body = resp.json()
as... | 128 | 4,381 |
OpenViking | tests/server/test_watch_task_acl.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Regression tests for watch-task control file access boundaries."""
import contextvars
import pytest
from openviking.resource.watch_storage import (
WATCH_TASK_STORAGE_BAK_URI,
WATCH_TASK_STORAGE_TMP_URI,
... | 138 | 4,339 |
OpenViking | tests/server/test_admin_api.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for Admin API endpoints (openviking/server/routers/admin.py)."""
import asyncio
import hashlib
import json
import uuid
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI
from fastap... | 1,524 | 49,876 |
OpenViking | tests/server/test_peer_id_compat.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Peer ID request validation tests."""
import pytest
from openviking.server.routers.search import FindRequest
from openviking.server.routers.sessions import AddMessageRequest
def test_find_request_rejects_unpublis... | 34 | 1,016 |
OpenViking | tests/server/test_api_sessions_event_tags.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import httpx
def _event_tags(response: httpx.Response) -> list[str]:
return response.json()["result"]["memory_extraction_config"]["events"]["tags"]
async def test_session_config_updates_event_tags_and_auto_comm... | 129 | 4,169 |
OpenViking | tests/server/test_resource_parse_mode_request.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Request-boundary coverage for add_resource parse modes."""
from types import SimpleNamespace
from unittest.mock import AsyncMock
import pytest
from openviking.server.identity import RequestContext, Role
from openv... | 90 | 3,052 |
OpenViking | tests/server/test_api_search_context.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import json
import httpx
from openviking.server.identity import RequestContext, Role
from openviking_cli.retrieve import ContextType, MatchedContext
from openviking_cli.session.user_id import UserIdentifier
class _... | 464 | 16,131 |
OpenViking | tests/server/test_http_client_sdk.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""SDK tests using AsyncHTTPClient against a real uvicorn server."""
import asyncio
import httpx
import pytest
import pytest_asyncio
from openviking_cli.client.http import AsyncHTTPClient
from openviking_cli.excepti... | 511 | 16,167 |
OpenViking | tests/server/test_openviking_assets.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for server-side OpenViking Assets configuration resolution."""
import asyncio
import hashlib
from unittest.mock import AsyncMock, Mock
import httpx
import pytest
import pytest_asyncio
from openviking.server.... | 569 | 17,501 |
OpenViking | tests/server/ovpack_test_helpers.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""OVPack fixtures for server tests."""
import hashlib
import io
import json
import zipfile
def _content_sha256(entries: list[dict[str, object]]) -> str:
payload = json.dumps(
entries,
ensure_asc... | 88 | 2,708 |
OpenViking | tests/server/test_api_snapshot.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""End-to-end tests for /api/v1/snapshot/*."""
from types import SimpleNamespace
from unittest.mock import AsyncMock
import httpx
import pytest
import pytest_asyncio
from openviking.server.auth import get_request_con... | 733 | 28,297 |
OpenViking | tests/server/test_api_webdav.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for the resources-only WebDAV adapter."""
import xml.etree.ElementTree as ET
import httpx
from openviking.server.routers.webdav import _ensure_exposed_path, _exposed_child_entries
from openviking_cli.except... | 212 | 7,305 |
OpenViking | tests/server/test_temp_scope_acl.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Regression tests for temp-scope access control."""
from datetime import datetime, timezone
import pytest
from openviking.server.identity import RequestContext, Role
from openviking.storage.viking_fs import Viking... | 315 | 10,987 |
OpenViking | tests/server/test_api_relations.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for relations endpoints: get relations, link, unlink."""
async def test_get_relations_empty(client_with_resource):
client, uri = client_with_resource
resp = await client.get("/api/v1/relations", para... | 95 | 3,067 |
OpenViking | tests/server/conftest.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Shared fixtures for OpenViking server tests."""
import asyncio
import shutil
import socket
import threading
import time
from contextlib import asynccontextmanager
from pathlib import Path
from types import SimpleNa... | 313 | 11,218 |
OpenViking | tests/server/oauth/test_storage.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for openviking/server/oauth/storage.py."""
from __future__ import annotations
import asyncio
import time
import pytest
import pytest_asyncio
from openviking.server.oauth.otp import hash_secret
from openviki... | 437 | 15,020 |
OpenViking | tests/server/oauth/test_router.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""End-to-end tests for the OAuth flow: DCR → authorize page → verify → token.
The flow is:
1. Caller registers a client (SDK's RegistrationHandler).
2. Caller hits /authorize, which redirects to /oauth/authorize/page... | 670 | 26,203 |
OpenViking | tests/server/oauth/test_mcp_www_authenticate.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for the WWW-Authenticate hint emitted by the MCP middleware on 401.
Ensures Claude.ai / Claude Desktop can auto-discover the OAuth authorization
server per RFC 9728 §5.1.
"""
from __future__ import annotation... | 105 | 4,290 |
OpenViking | tests/server/oauth/test_auth_integration.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Integration tests for the OAuth opaque-token discriminator in auth.py."""
from __future__ import annotations
from typing import Optional
import pytest
import pytest_asyncio
from fastapi import FastAPI
from starlet... | 367 | 13,393 |
OpenViking | tests/parse/test_understanding_api.py | .py | from pathlib import Path
from unittest.mock import AsyncMock
import pytest
from openviking.parse.understanding_api import UnderstandingAPI
@pytest.mark.asyncio
async def test_parse_uses_downloaded_file_and_resolved_extension(monkeypatch, tmp_path):
downloaded = tmp_path / "download"
downloaded.write_bytes(b... | 75 | 2,453 |
OpenViking | tests/parse/test_gh_slug.py | .py | """Regression test: _gh_slug must match GitHub's heading-anchor algorithm.
GitHub's reference slugger (github-slugger) lowercases, strips a set of
punctuation, then maps *each* space to a hyphen individually
(``.replace(/ /g, '-')``) — it does not collapse consecutive whitespace.
Because punctuation is removed *befor... | 27 | 1,135 |
OpenViking | tests/parse/test_markdown_no_split.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for parsed documents whose Markdown body must remain in one file."""
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import AsyncMock
import pytest
from openviking.parse.mode im... | 134 | 4,354 |
OpenViking | tests/parse/test_resource_processor_no_split.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for routing parsed resources through no-split mode."""
from pathlib import Path
from typing import Any
import pytest
from openviking.parse.accessors.base import LocalResource, SourceType
from openviking.pars... | 83 | 2,824 |
OpenViking | tests/parse/test_add_directory.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Unit tests for DirectoryParser.
Verifies that:
- DirectoryParser correctly scans directories and classifies files;
- Files WITH a parser are delegated via ``parser.parse()`` and their
VikingFS temp output is merge... | 1,058 | 40,176 |
OpenViking | tests/parse/test_markdown_apply_layout.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for MarkdownParser._apply_layout.
``_apply_layout`` replays ``layout.ops`` verbatim: every mkdir op runs, and each
section is written through ``_write_section`` so it keeps VikingFS's parent-dir
and encrypted-... | 83 | 3,189 |
OpenViking | tests/parse/test_url_filename_preservation.py | .py | """Tests for URL filename preservation when importing resources via URL.
Verifies fix for https://github.com/volcengine/OpenViking/issues/251:
- Original filename preserved (not temp file name)
- File extension preserved (.py stays .py, not converted to .md)
- URL-encoded characters decoded properly
- Code file extens... | 451 | 16,944 |
OpenViking | tests/parse/test_markdown_split_token_budget.py | .py | """Regression test: _smart_split_content must respect the token budget.
The force-split branch previously stepped through an oversized paragraph by
``max_chars`` only. A paragraph that is under the character limit but over the
token budget (e.g. dense CJK text, weighted ~0.7 token/char) was therefore
emitted as a sing... | 28 | 1,166 |
OpenViking | tests/parse/test_directory_scan.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Unit tests for directory pre-scan validation module (RFC #83 T1)."""
from pathlib import Path
import pytest
from openviking.parse.directory_scan import (
CLASS_PROCESSABLE,
ClassifiedFile,
DirectorySca... | 511 | 22,011 |
OpenViking | tests/parse/test_feishu_parser_api.py | .py | import asyncio
import json
import zipfile
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import AsyncMock, Mock
import pytest
from openviking.parse.accessors.base import LocalResource, SourceType
from openviking.parse.understanding_api import PREPARED_RESPONSE_ID_ARG, UnderstandingAPI
f... | 970 | 33,621 |
OpenViking | tests/parse/test_markdown_filename_collision.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for _generate_merged_filename uniqueness when headings collide."""
from openviking.parse.parsers.markdown import MarkdownParser
from openviking_cli.utils.config.parser_config import ParserConfig
class TestGe... | 86 | 3,106 |
OpenViking | tests/parse/test_feishu_accessor.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for FeishuAccessor supported types, user token, and image handling."""
import asyncio
import json
import sys
from types import ModuleType, SimpleNamespace
from unittest.mock import MagicMock
import pytest
fr... | 983 | 34,394 |
OpenViking | tests/parse/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Directory scan test module"""
| 5 | 135 |
OpenViking | tests/parse/test_ast_extractor.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
from unittest.mock import Mock
import pytest
from openviking.parse.parsers.code.ast import extract_skeleton_result
from openviking.parse.parsers.code.ast.providers import is_skeleton_useful
from openviking.parse.pa... | 289 | 8,158 |
OpenViking | tests/parse/test_markdown_link_rewrite.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for MarkdownParser relative-link rewriting on ingest."""
from pathlib import Path
from unittest.mock import patch
import pytest
from openviking.parse.parsers.base_parser import BaseParser
from openviking.par... | 888 | 38,714 |
OpenViking | tests/parse/test_excel_process_pool.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for ExcelParser._should_use_process_pool, the config-gated routing decision
that decides whether Excel→Markdown conversion + layout planning run in a
ProcessPoolExecutor child process instead of the main proces... | 291 | 11,925 |
OpenViking | tests/parse/test_parser_router.py | .py | from types import SimpleNamespace
from unittest.mock import AsyncMock
import pytest
from openviking.parse.accessors.base import LocalResource, SourceType
from openviking.parse.parser_router import ParserRouter
from openviking.parse.parsers.media.utils import MPEG_TS_PACKET_SIZE, MPEG_TS_PROBE_BYTES
from openviking.pa... | 334 | 10,857 |
OpenViking | tests/parse/test_text_file_encoding.py | .py | import pytest
from openviking.parse.parsers import upload_utils
from openviking.parse.parsers.markdown import MarkdownParser
from openviking.parse.parsers.upload_utils import detect_and_convert_encoding
def test_markdown_file_read_normalizes_gb18030_text(tmp_path):
content = "# 编码兼容测试文档\n\n这是一段中文正文,用于验证旧编码文本不会被解... | 126 | 4,269 |
OpenViking | tests/parse/test_pdf_bookmark_extraction.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Tests for PDF bookmark/outline extraction in PDFParser.
Verifies that _extract_bookmarks correctly extracts bookmark entries
and that _convert_local injects them as markdown headings.
"""
from contextlib import nu... | 536 | 19,973 |
OpenViking | tests/parse/test_markdown_local_image_refs.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for MarkdownParser._layout_has_local_image_refs, the in-memory image-ref
probe that lets _apply_layout skip _ingest_local_images's glob+read pass over
every generated markdown chunk when a layout (e.g. an Excel... | 44 | 1,972 |
OpenViking | tests/parse/test_html_parser_extraction.py | .py | """Regression tests for HTMLParser._html_to_markdown after switching to trafilatura.
Focus: verify that the WeChat-public-account preprocessing path still produces
non-empty Markdown after the underlying extractor changed from
readabilipy + markdownify to trafilatura.
"""
from openviking.parse.parsers.html import HTM... | 53 | 2,011 |
OpenViking | tests/parse/test_understanding_api_artifact_images.py | .py | import json
import zipfile
from pathlib import Path
from unittest.mock import patch
import pytest
from openviking.parse.image_rewrite import (
IMAGE_MAPPINGS_FILENAME,
build_artifact_image_mappings,
)
from openviking.parse.understanding_api import UnderstandingAPI
class _FakeVikingFS:
def __init__(self)... | 103 | 3,298 |
OpenViking | tests/parse/test_parser_config_wiring.py | .py | """Tests for parser config propagation through registries and composed parsers."""
from openviking.parse.parsers.html import HTMLParser
from openviking.parse.parsers.pdf import PDFParser
from openviking_cli.utils.config.parser_config import (
HTMLConfig,
PDFConfig,
)
def test_pdf_parser_passes_its_config_to_... | 27 | 951 |
OpenViking | tests/parse/test_markdown_frontmatter.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for YAML frontmatter handling in MarkdownParser.
Frontmatter is parsed into ``ParseResult.meta`` but that metadata is never written
to VikingFS, so removing the block from the stored body loses the fields for ... | 85 | 2,644 |
OpenViking | tests/parse/test_media_understanding_summary.py | .py | import asyncio
import io
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import AsyncMock
import pytest
from PIL import Image
from openviking.parse.parsers.media import utils as media_utils
from openviking_cli.utils.config.parser_config import ImageConfig
from openviking_cli.utils.config... | 323 | 9,799 |
OpenViking | tests/parse/test_directory_parser_routing.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Isolated unit tests for directory-import parser routing and path mapping.
This script verifies **two independent concerns** without invoking the full
``ResourceService`` pipeline:
1. **Parser selection** – given a ... | 413 | 17,724 |
OpenViking | tests/parse/test_media_resource_name.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Media parsers must honor a caller-supplied resource_name / source_name for
the resource's internal filename, URI and title, instead of leaking the temp
upload id (upload_<uuid>) — matching the markdown parser. Regres... | 146 | 5,121 |
OpenViking | tests/parse/test_document_parser_threading.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Regression tests for offloading synchronous document conversions."""
import sys
import zipfile
from pathlib import Path
from types import SimpleNamespace
from typing import Any, Callable
import pytest
from openvik... | 278 | 9,589 |
OpenViking | tests/parse/test_feishu_errors.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for Feishu OpenAPI error mapping."""
from types import SimpleNamespace
import pytest
from openviking.parse.accessors.feishu_accessor import _raise_from_lark_response
from openviking_cli.exceptions import Ope... | 86 | 2,413 |
OpenViking | tests/parse/test_multimodal_file_matrix_integration.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Black-box compatibility tests for multimodal resource ingestion."""
import json
import os
from dataclasses import dataclass
from typing import Any
from uuid import uuid4
import pytest
import pytest_asyncio
import ... | 416 | 11,114 |
OpenViking | tests/parse/parsers/test_html.py | .py | from openviking.parse.parsers.html import HTMLParser
class TestHTMLParserMarkdownCleaning:
def setup_method(self):
self.parser = HTMLParser()
def test_strips_data_image_markdown(self):
md = "before  after"
assert "data:image" not in self.parser._clean_... | 79 | 3,119 |
OpenViking | tests/parse/parsers/test_text.py | .py | from types import SimpleNamespace
from unittest.mock import AsyncMock
from openviking.parse.base import NodeType, ResourceNode, create_parse_result
from openviking.parse.parsers.text import TextParser
async def test_file_parse_preserves_text_parser_metadata_and_instruction(tmp_path):
source = tmp_path / "notes.t... | 26 | 979 |
OpenViking | tests/parse/accessors/web_crawler/test_config.py | .py | import pytest
from openviking.parse.accessors.web_crawler.config import CrawlConfig
class TestCrawlConfigValidation:
def test_defaults_are_valid(self):
config = CrawlConfig()
assert config.skip_download_links is True
def test_depth_minus_one_unlimited_ok(self):
CrawlConfig(depth=-1)
... | 50 | 1,522 |
OpenViking | tests/parse/accessors/web_crawler/test_scrapy_spider.py | .py | import pytest
from unittest.mock import MagicMock
from scrapy.exceptions import CloseSpider
from openviking.parse.accessors.web_crawler.config import CrawlConfig
from openviking.parse.accessors.web_crawler.scrapy_spider import OpenVikingWebSpider
def _make_spider(config=None, root_url="http://example.com/"):
re... | 269 | 10,200 |
OpenViking | tests/parse/accessors/web_crawler/test_middlewares.py | .py | from unittest.mock import MagicMock
import pytest
from scrapy.exceptions import IgnoreRequest
from openviking.parse.accessors.web_crawler.config import CrawlConfig
from openviking.parse.accessors.web_crawler.middlewares import RequestValidatorMiddleware
def _make_spider(validator):
spider = MagicMock()
spid... | 54 | 1,890 |
OpenViking | tests/eval/test_ragas_validation.py | .py | #!/usr/bin/env python3
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Validation script for eval module using local_doc_example_glm5.jsonl.
"""
import json
import sys
from pathlib import Path
from typing import Any, Dict, List
def load_jsonl(file_path: str) -... | 206 | 6,499 |
OpenViking | tests/eval/test_ragas_eval.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import json
from pathlib import Path
import pytest
from openviking.eval.ragas import (
EvalDataset,
EvalSample,
RagasConfig,
RagasEvaluator,
_create_ragas_llm_from_config,
)
EVAL_RESULTS_FILE = P... | 239 | 7,304 |
OpenViking | tests/eval/test_ragas_basic.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import json
import queue
import tempfile
import threading
from pathlib import Path
from openviking.eval.ragas.generator import DatasetGenerator
from openviking.eval.ragas.pipeline import RAGQueryPipeline
from openviki... | 138 | 4,225 |
OpenViking | tests/storage/test_viking_fs_glob.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import pytest
from openviking.server.identity import RequestContext, Role
from openviking.storage.viking_fs import VikingFS
from openviking_cli.exceptions import InvalidArgumentError
from openviking_cli.session.user_i... | 335 | 10,889 |
OpenViking | tests/storage/test_queue_manager.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Focused tests for QueueManager concurrency selection."""
import os
import subprocess
import sys
from openviking.storage.queuefs.queue_manager import QueueManager
def test_queuefs_package_imports_in_a_clean_proces... | 37 | 1,131 |
OpenViking | tests/storage/test_semantic_processor_code_routing.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
import asyncio
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from openviking.parse.parsers.constants import (
FILE_TYPE_CODE,
FILE_TYPE_DOCUMENTATION,
FILE_TYPE_OTHER,
)
from openv... | 143 | 4,780 |
OpenViking | tests/storage/test_viking_vector_scope_filter.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
import pytest
from openviking.core.namespace import uri_parts
from openviking.server.identity import RequestContext, Role
from openviking.storage.expr import And, Eq, In, Or, PathScope
from openviking.storage.viking... | 258 | 7,315 |
OpenViking | tests/storage/test_viking_fs_tree.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from datetime import datetime, timezone
import pytest
from openviking.server.identity import RequestContext, Role
from openviking.storage import viking_fs as viking_fs_module
from openviking.storage.viking_fs import ... | 644 | 22,580 |
OpenViking | tests/storage/test_semantic_processor_lock_ownership.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
import pytest
from openviking.storage.queuefs.semantic_msg import SemanticMsg
from openviking.storage.queuefs.semantic_processor import SemanticProcessor
class _FakePathLock:
... | 60 | 1,602 |
OpenViking | tests/storage/test_semantic_processor_target_preexisting.py | .py | from types import SimpleNamespace
from unittest.mock import AsyncMock
import pytest
from openviking.storage.queuefs.semantic_msg import SemanticMsg
from openviking.storage.queuefs.semantic_processor import SemanticProcessor
from openviking.storage.viking_fs import SyncDiff
class _FakeVikingFS:
async def exists(... | 205 | 6,444 |
OpenViking | tests/storage/test_stale_lock.py | .py | """Tests for stale RocksDB LOCK file cleanup."""
import os
from pathlib import Path
import openviking.storage.vectordb.utils.stale_lock as stale_lock_module
class TestStaleLockCleanup:
"""Tests for clean_stale_rocksdb_locks()."""
def _create_lock_file(self, base_dir: Path, *path_parts: str) -> Path:
... | 145 | 6,107 |
OpenViking | tests/storage/mock_backend.py | .py | from typing import Any, Dict, List, Optional
from openviking.storage.vectordb.collection.collection import Collection, ICollection
from openviking.storage.vectordb.collection.result import AggregateResult, SearchResult
from openviking.storage.vectordb.index.index import IIndex
from openviking.storage.vectordb_adapters... | 200 | 7,181 |
OpenViking | tests/storage/test_mv_copy_node_limit.py | .py | #!/usr/bin/env python3
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Regression test: mv() must enumerate every entry of a source directory.
``VikingFS._copy_dir_through_vikingfs`` drives the copy phase of ``mv()`` for
non-temp directories. It must pass ``node_... | 87 | 2,846 |
OpenViking | tests/storage/test_semantic_processor_l0_l1.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from types import SimpleNamespace
from openviking.storage.queuefs import semantic_processor as semantic_processor_module
from openviking.storage.queuefs.semantic_processor import SemanticProcessor
def _patch_semanti... | 154 | 5,387 |
OpenViking | tests/storage/test_semantic_processor_overview_batching.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from types import SimpleNamespace
import pytest
from openviking.storage.queuefs import semantic_processor as semantic_processor_module
from openviking.storage.queuefs.semantic_processor import SemanticProcessor
cla... | 62 | 1,812 |
OpenViking | tests/storage/test_semantic_processor_language.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: Apache-2.0
import asyncio
import os
import re
import tempfile
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from openviking.prompts import render_prompt
from openviking.session.m... | 646 | 27,111 |
OpenViking | tests/storage/test_viking_fs_grep.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import time
import pytest
import openviking.storage.viking_fs as viking_fs_module
from openviking.storage.expr import And, PathScope, RawDSL
from openviking.storage.viking_fs import _DEFAULT_GREP_FILE_CONCURRENCY, Vi... | 523 | 15,961 |
OpenViking | tests/storage/test_semantic_msg_ingest_options.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from openviking.utils.ingest_options import IngestOptions
from openviking.storage.queuefs.semantic_msg import SemanticMsg
def test_semantic_msg_serializes_ingest_options():
msg = SemanticMsg(
uri="viking:... | 42 | 1,207 |
OpenViking | tests/storage/test_vectordb_adapter_scores.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from datetime import datetime, timezone
from openviking.storage.vectordb_adapters.base import _normalize_result_score
def test_normalize_result_score_keeps_finite_numeric_scores():
assert _normalize_result_score... | 18 | 673 |
OpenViking | tests/storage/test_local_collection_update.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from types import SimpleNamespace
import pytest
from openviking.storage.vectordb.collection.local_collection import LocalCollection
from openviking.storage.vectordb.collection.resu... | 242 | 6,605 |
OpenViking | tests/storage/test_ingest_ls_node_limit.py | .py | """Regression: internal directory enumeration during ingest must not be capped
at ``viking_fs.ls``'s default ``node_limit=1000``.
When a resource namespace already exists, re-ingesting a directory takes the
incremental sync path (``VikingFS.sync_tree`` -> ``sync_dir`` -> ``list_children``),
which lists the temp root's... | 162 | 6,119 |
OpenViking | tests/storage/test_viking_fs_write_locking.py | .py | from unittest.mock import AsyncMock
import pytest
from openviking.server.identity import RequestContext, Role
from openviking.storage.viking_fs import VikingFS
from openviking_cli.session.user_id import UserIdentifier
class _FakeAGFS:
"""Minimal synchronous AGFS stub for VikingFS write-path tests."""
def _... | 337 | 11,873 |
OpenViking | tests/storage/test_embedding_msg.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from uuid import uuid4
from openviking.storage.queuefs.embedding_msg import EmbeddingMsg
from openviking.telemetry.request_wait_tracker import RequestWaitTracker
def test_embedding_msg_roundtrip_preserves_id_for_req... | 30 | 958 |
OpenViking | tests/storage/test_content_write_processing_mode.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from types import SimpleNamespace
from unittest.mock import AsyncMock
import pytest
from openviking.server.identity import RequestContext, Role
from openviking.storage import content_write as content_write_module
fro... | 179 | 5,963 |
OpenViking | tests/storage/test_semantic_dag_media_overview.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from types import SimpleNamespace
from unittest.mock import patch
from openviking.server.identity import RequestContext, Role
from openviking.storage.queuefs.semantic_dag import (
DirNode,
SemanticDagExecutor,... | 67 | 1,930 |
OpenViking | tests/storage/test_viking_fs_actor_peer_view.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import pytest
from openviking.server.identity import RequestContext, Role
from openviking.storage.viking_fs import VikingFS
from openviking_cli.exceptions import NotFoundError, PermissionDeniedError
from openviking_cl... | 292 | 10,265 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.