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/api_test/scenarios/resources_retrieval_slow/test_build_platform_wikipedia.py | .py | from build_test_helpers import (
_extract_error_message,
assert_resource_indexed,
assert_root_uri_valid,
assert_source_format,
)
class TestBuildPlatformWikipedia:
"""TC-P05 Wikipedia 平台 URL 构建测试"""
WIKI_URLS = [
"https://en.wikipedia.org/api/rest_v1/page/summary/Software_testing",
... | 62 | 2,635 |
OpenViking | tests/api_test/scenarios/resources_retrieval_slow/test_build_archive_resources.py | .py | import os
import shutil
import tempfile
import uuid
import zipfile
from build_test_helpers import assert_resource_indexed, assert_root_uri_valid, assert_source_format
class TestBuildArchiveResources:
"""TC-B10~B12 压缩包与目录类资源构建测试"""
def test_build_zip_file(self, api_client):
"""TC-B10 ZIP压缩包构建:验证 .zip... | 113 | 4,384 |
OpenViking | tests/api_test/scenarios/resources_retrieval_slow/test_build_error_handling_slow.py | .py | import os
import shutil
import tempfile
import uuid
from build_test_helpers import (
_extract_error_message,
assert_resource_indexed,
assert_root_uri_valid,
assert_source_format,
cleanup_temp_dir,
create_test_file,
)
class TestBuildErrorHandlingSlow:
"""TC-E01~E16 异常与边界测试"""
def test... | 430 | 19,250 |
OpenViking | tests/api_test/scenarios/resources_retrieval_slow/test_build_uri_params_slow.py | .py | import uuid
from build_test_helpers import (
cleanup_temp_dir,
create_test_file,
)
class TestBuildUriParamsSlow:
"""TC-E17 指定to参数构建"""
def test_build_with_to_param(self, api_client):
"""TC-E17 指定to参数构建:验证 root_uri == to"""
random_id = str(uuid.uuid4())[:8]
unique_keyword = f"... | 39 | 1,334 |
OpenViking | tests/api_test/scenarios/resources_retrieval_slow/test_build_text_resources_slow.py | .py | import uuid
from build_test_helpers import (
assert_resource_indexed,
assert_root_uri_valid,
assert_source_format,
cleanup_temp_dir,
create_test_file,
)
class TestBuildTextResourcesSlow:
"""TC-B01, B02, B14, B15 文本类资源构建测试"""
def test_build_txt_file(self, api_client):
"""TC-B01 纯文... | 157 | 6,323 |
OpenViking | tests/api_test/scenarios/resources_retrieval_slow/test_build_document_resources_slow.py | .py | import os
import shutil
import tempfile
import uuid
import pytest
from build_test_helpers import (
assert_resource_indexed,
assert_root_uri_valid,
assert_source_format,
)
def _create_pdf_file():
try:
from fpdf import FPDF
except ImportError:
pytest.skip("fpdf 未安装,跳过 PDF 构建测试")
... | 333 | 12,023 |
OpenViking | tests/api_test/scenarios/resources_retrieval_slow/build_test_helpers.py | .py | import os
import shutil
import tempfile
import uuid
def create_test_file(content=None, suffix=".txt", filename=None):
if content is None:
content = (
f"测试文件内容 - {uuid.uuid4()}\n这是一个用于构建测试的临时文件。\n包含一些测试数据。"
)
temp_dir = tempfile.mkdtemp()
fname = filename or f"test_file_{str(uu... | 278 | 9,763 |
OpenViking | tests/api_test/sessions/test_session_commit_used_context.py | .py | class TestSessionCommitUsedContext:
def test_session_commit_flow(self, api_client):
session_id = None
try:
create_resp = api_client.create_session()
assert create_resp.status_code == 200
session_id = create_resp.json()["result"]["session_id"]
api_clie... | 255 | 10,302 |
OpenViking | tests/api_test/sessions/test_create_session.py | .py | import json
import pytest
import requests
class TestCreateSession:
def test_create_session(self, api_client):
try:
response = api_client.create_session()
except requests.exceptions.ConnectionError:
pytest.fail("Could not connect to server service - service is not running")... | 69 | 2,984 |
OpenViking | tests/api_test/sessions/test_list_sessions.py | .py | import json
import pytest
import requests
class TestListSessions:
def test_list_sessions(self, api_client):
try:
response = api_client.list_sessions()
except requests.exceptions.ConnectionError:
pytest.fail("Could not connect to server service - service is not running")
... | 30 | 1,080 |
OpenViking | tests/api_test/sessions/test_add_message.py | .py | import json
class TestAddMessage:
def test_add_message(self, api_client):
session_id = None
try:
response = api_client.create_session()
assert response.status_code == 200, "Create session failed"
data = response.json()
session_id = data["result"]["s... | 32 | 1,229 |
OpenViking | tests/api_test/sessions/test_get_session.py | .py | import json
import pytest
import requests
class TestGetSession:
def test_get_session(self, api_client):
session_id = None
try:
response = api_client.create_session()
assert response.status_code == 200, "Create session failed"
data = response.json()
... | 36 | 1,436 |
OpenViking | tests/api_test/sessions/test_delete_session.py | .py | import json
import pytest
import requests
class TestDeleteSession:
def test_delete_session(self, api_client):
session_id = None
try:
response = api_client.create_session()
assert response.status_code == 200, "Create session failed"
data = response.json()
... | 31 | 1,165 |
OpenViking | tests/api_test/sessions/test_session_messages.py | .py | import uuid
from math import ceil
class TestSessionMessages:
def test_add_message_increments_count(self, api_client):
session_id = None
try:
create_resp = api_client.create_session()
assert create_resp.status_code == 200
session_id = create_resp.json()["result"]... | 410 | 16,841 |
OpenViking | tests/api_test/sessions/test_session_used_commit.py | .py | import json
import pytest
import requests
class TestSessionUsedCommit:
def test_session_used_commit(self, api_client):
session_id = None
try:
response = api_client.create_session()
assert response.status_code == 200, "Create session failed"
data = response.jso... | 53 | 2,408 |
OpenViking | tests/api_test/sessions/slow/test_session_detail_fields.py | .py | import time
class TestSessionDetailFields:
def test_session_detail_contains_all_meta_fields(self, api_client):
session_id = None
try:
create_resp = api_client.create_session()
assert create_resp.status_code == 200
session_id = create_resp.json()["result"]["sessi... | 256 | 10,838 |
OpenViking | tests/api_test/sessions/slow/test_session_context_budget.py | .py | import time
class TestSessionContextBudget:
def test_context_default_budget_returns_all_messages(self, api_client):
session_id = None
try:
create_resp = api_client.create_session()
assert create_resp.status_code == 200
session_id = create_resp.json()["result"]["... | 311 | 13,851 |
OpenViking | tests/api_test/sessions/slow/test_context_assembly.py | .py | import time
import uuid
class TestSessionContextAssembly:
def test_context_contains_recent_messages(self, api_client):
session_id = None
try:
r = api_client.create_session()
session_id = r.json()["result"]["session_id"]
unique_kw = f"ctx_recent_{uuid.uuid4().he... | 222 | 9,523 |
OpenViking | tests/api_test/sessions/slow/test_session_list_deep.py | .py | class TestSessionListDeep:
def test_list_sessions_returns_list(self, api_client):
resp = api_client.list_sessions()
assert resp.status_code == 200
result = resp.json().get("result", [])
assert isinstance(result, list), (
f"list_sessions result should be list, got {type(re... | 154 | 6,254 |
OpenViking | tests/api_test/sessions/slow/test_session_message_format.py | .py | import time
import uuid
class TestSessionMessageFormat:
def test_message_parts_structure(self, api_client):
session_id = None
try:
create_resp = api_client.create_session()
assert create_resp.status_code == 200
session_id = create_resp.json()["result"]["session_... | 335 | 14,111 |
OpenViking | tests/api_test/sessions/slow/test_context_budget_memory.py | .py | import time
import uuid
class TestContextBudgetMemory:
def test_small_budget_drops_messages_keeps_stats(self, api_client):
session_id = None
try:
create_resp = api_client.create_session()
assert create_resp.status_code == 200
session_id = create_resp.json()["res... | 335 | 14,255 |
OpenViking | tests/api_test/sessions/slow/test_session_concurrency.py | .py | import uuid
class TestSessionConcurrency:
def test_add_messages_after_commit_without_waiting(self, api_client):
session_id = None
try:
create_resp = api_client.create_session()
assert create_resp.status_code == 200
session_id = create_resp.json()["result"]["sess... | 221 | 9,161 |
OpenViking | tests/api_test/sessions/slow/test_multi_session_isolation.py | .py | import time
import uuid
class TestMultiSessionIsolation:
def test_messages_isolated_between_sessions(self, api_client):
sid1 = None
sid2 = None
try:
r1 = api_client.create_session()
assert r1.status_code == 200
sid1 = r1.json()["result"]["session_id"]
... | 206 | 8,012 |
OpenViking | tests/api_test/sessions/slow/test_session_used_commit_deep.py | .py | import time
import uuid
class TestSessionUsedCommitDeep:
def test_used_contexts_reflected_in_context_response(self, api_client):
session_id = None
try:
r = api_client.create_session()
session_id = r.json()["result"]["session_id"]
ctx_uri = f"viking://resources/... | 167 | 6,765 |
OpenViking | tests/api_test/api/__init__.py | .py | from .client import OpenVikingAPIClient
__all__ = ["OpenVikingAPIClient"]
| 4 | 75 |
OpenViking | tests/api_test/api/client.py | .py | import json
import os
import tempfile
import time
import zipfile
from pathlib import Path
from typing import Any, Dict, Optional
from urllib.parse import urlencode
import requests
from config import Config
class OpenVikingAPIClient:
def __init__(
self,
base_url: Optional[str] = None,
serv... | 685 | 26,827 |
OpenViking | tests/api_test/skills/test_add_skill.py | .py | import json
import uuid
class TestAddSkill:
def test_add_skill_with_dict(self, api_client):
try:
skill_name = f"test-skill-{uuid.uuid4().hex[:8]}"
skill = {
"name": skill_name,
"description": "A test skill for API testing",
"content":... | 86 | 3,322 |
OpenViking | tests/api_test/skills/slow/test_skill_crud_deep.py | .py | import uuid
class TestSkillCrudDeep:
def test_add_skill_basic(self, api_client):
skill_data = {
"name": f"test_skill_{uuid.uuid4().hex[:8]}",
"description": "A test skill for CRUD validation",
"content": "# test_skill\n\nA test skill for CRUD validation.",
}
... | 126 | 5,265 |
OpenViking | tests/api_test/common/test_response_types.py | .py | import os
import tempfile
import uuid
import pytest
class TestResponseDataTypes:
def test_fs_stat_response_types(self, api_client):
dir_uri = f"viking://resources/type_check_{uuid.uuid4().hex[:8]}"
try:
mkdir_resp = api_client.fs_mkdir(dir_uri)
if mkdir_resp.status_code !=... | 154 | 6,627 |
OpenViking | tests/api_test/common/test_edge_cases.py | .py | import os
import tempfile
import uuid
class TestResourceEdgeCases:
def test_add_resource_with_temp_file_id_and_path_returns_400(self, api_client):
with tempfile.TemporaryDirectory() as temp_dir:
test_file = os.path.join(temp_dir, "both_params.txt")
with open(test_file, "w") as f:
... | 217 | 9,074 |
OpenViking | tests/api_test/common/slow/test_error_format.py | .py | import uuid
class TestErrorFormatConsistency:
def test_all_error_responses_have_status_field(self, api_client):
error_scenarios = [
(
"fs_stat_nonexistent",
lambda: api_client.fs_stat("viking://resources/nonexistent_error_test"),
),
(
... | 139 | 6,013 |
OpenViking | tests/api_test/common/slow/test_boundary_conditions.py | .py | import uuid
class TestBoundaryConditions:
def test_uri_with_special_characters(self, api_client):
uri = f"viking://resources/special-chars_{uuid.uuid4().hex[:8]}"
mkdir_resp = api_client.fs_mkdir(uri)
assert mkdir_resp.status_code == 200, (
f"mkdir with hyphenated URI should re... | 166 | 7,228 |
OpenViking | tests/api_test/admin/test_admin_accounts.py | .py | import json
import uuid
class TestAdminAccounts:
def test_admin_list_accounts(self, api_client):
try:
response = api_client.admin_list_accounts()
print(f"\nAdmin list accounts API status code: {response.status_code}")
data = response.json()
print("\n" + "="... | 65 | 2,748 |
OpenViking | tests/api_test/admin/test_admin_regenerate_key.py | .py | import json
import uuid
class TestAdminRegenerateKey:
def test_admin_regenerate_key(self, api_client):
random_id = str(uuid.uuid4())[:8]
test_user_id = f"test-user-{random_id}"
try:
response = api_client.admin_register_user("default", test_user_id, "user")
print(f"... | 38 | 1,546 |
OpenViking | tests/api_test/admin/test_admin_users.py | .py | import json
import uuid
class TestAdminUsers:
def test_admin_list_users(self, api_client):
try:
response = api_client.admin_list_users("default")
print(f"\nAdmin list users API status code: {response.status_code}")
data = response.json()
print("\n" + "=" * ... | 63 | 2,564 |
OpenViking | tests/api_test/admin/test_admin_role.py | .py | import json
import uuid
class TestAdminRole:
def test_admin_set_role(self, api_client):
random_id = str(uuid.uuid4())[:8]
test_user_id = f"test-user-{random_id}"
try:
response = api_client.admin_register_user("default", test_user_id, "user")
print(f"\nAdmin registe... | 37 | 1,441 |
OpenViking | tests/api_test/content/slow/test_content_read_l2_deep.py | .py | import os
import tempfile
import uuid
class TestContentReadL2Deep:
def _create_resource(self, api_client, content):
temp_dir = tempfile.mkdtemp()
unique_kw = f"readl2_{uuid.uuid4().hex[:8]}"
test_file = os.path.join(temp_dir, f"{unique_kw}.md")
with open(test_file, "w") as f:
... | 140 | 6,156 |
OpenViking | tests/api_test/content/slow/test_content_download.py | .py | class TestContentDownload:
def test_download_nonexistent_uri(self, api_client):
dl_resp = api_client.content_download("viking://resources/nonexistent_file_xyz")
assert dl_resp.status_code == 404, (
f"Expected 404 or 500 for nonexistent URI, got {dl_resp.status_code}"
)
| 7 | 310 |
OpenViking | tests/api_test/content/slow/test_content_hierarchy.py | .py | import os
import tempfile
import uuid
class TestContentHierarchy:
def test_abstract_shorter_than_overview(self, api_client):
with tempfile.TemporaryDirectory() as temp_dir:
unique_kw = f"l0l1_{uuid.uuid4().hex[:8]}"
test_file = os.path.join(temp_dir, f"{unique_kw}.md")
... | 131 | 5,799 |
OpenViking | tests/api_test/content/slow/test_content_update_consistency.py | .py | import time
import uuid
class TestContentUpdateConsistency:
def test_write_replace_updates_search_index(self, api_client):
file_uri = f"viking://resources/idx_update_{uuid.uuid4().hex[:8]}.md"
try:
write1 = api_client.fs_write(
file_uri,
"Original indexe... | 161 | 6,017 |
OpenViking | tests/api_test/content/slow/test_content_write_modes_deep.py | .py | import os
import tempfile
import time
import uuid
class TestContentWriteModesDeep:
def _create_resource_file(self, api_client, content):
temp_dir = tempfile.mkdtemp()
unique_kw = f"writemode_{uuid.uuid4().hex[:8]}"
test_file = os.path.join(temp_dir, f"{unique_kw}.md")
with open(tes... | 132 | 5,264 |
OpenViking | tests/api_test/content/slow/test_content_deep.py | .py | import os
import tempfile
class TestContentDeep:
def test_abstract_returns_string(self, api_client):
with tempfile.TemporaryDirectory() as temp_dir:
test_file = os.path.join(temp_dir, "abstract_test.txt")
with open(test_file, "w") as f:
f.write("Content for abstract... | 62 | 2,982 |
OpenViking | tests/api_test/content/slow/test_reindex_download_deep.py | .py | import os
import tempfile
import uuid
class TestReindexDownloadDeep:
def test_download_nonexistent_uri(self, api_client):
dl_resp = api_client.content_download("viking://resources/nonexistent_dl_test_99999.md")
assert dl_resp.status_code == 404, (
f"download nonexistent should return e... | 33 | 1,308 |
OpenViking | tests/api_test/retrieval/test_grep.py | .py | import json
import pytest
import requests
class TestGrep:
def test_grep_basic(self, api_client):
try:
response = api_client.grep("viking://user/", "viking")
print(f"\nGrep API status code: {response.status_code}")
if response.status_code == 200:
data =... | 36 | 1,478 |
OpenViking | tests/api_test/retrieval/test_glob.py | .py | import json
class TestGlob:
def test_glob_basic(self, api_client):
try:
response = api_client.glob("**/*", "viking://user/")
print(f"\nGlob API status code: {response.status_code}")
data = response.json()
print("\n" + "=" * 80)
print("Glob API R... | 27 | 1,057 |
OpenViking | tests/api_test/retrieval/test_search.py | .py | import json
class TestSearch:
def test_basic_search(self, api_client):
try:
response = api_client.search("how to authenticate users", limit=10)
print(f"\nSearch API status code: {response.status_code}")
data = response.json()
print("\n" + "=" * 80)
... | 56 | 2,507 |
OpenViking | tests/api_test/retrieval/test_find.py | .py | import json
class TestFind:
def test_find_basic(self, api_client):
try:
response = api_client.find("how to authenticate", limit=10)
print(f"\nFind API status code: {response.status_code}")
data = response.json()
print("\n" + "=" * 80)
print("Fin... | 56 | 2,481 |
OpenViking | tests/api_test/retrieval/slow/test_search_context_aware.py | .py | class TestSearchContextAware:
def test_search_with_session_returns_context(self, api_client):
session_id = None
try:
r = api_client.create_session()
session_id = r.json()["result"]["session_id"]
api_client.add_message(
session_id, "user", "I am wo... | 133 | 5,899 |
OpenViking | tests/api_test/retrieval/slow/test_search_result_quality.py | .py | import os
import tempfile
import uuid
class TestSearchResultQuality:
def test_find_result_has_resources_memories_skills_total(self, api_client):
resp = api_client.find(query="test", limit=5)
assert resp.status_code == 200, f"find should return 200, got {resp.status_code}"
data = resp.json(... | 284 | 12,927 |
OpenViking | tests/api_test/retrieval/slow/test_glob_deep_v2.py | .py | import os
import tempfile
import uuid
class TestSearchGlobDeep:
def test_glob_all_md_files(self, api_client):
glob_resp = api_client.glob(pattern="**/*.md")
assert glob_resp.status_code == 200
result = glob_resp.json().get("result", {})
if isinstance(result, dict):
item... | 114 | 5,173 |
OpenViking | tests/api_test/retrieval/slow/test_search_filter_sort_deep.py | .py | import os
import tempfile
import uuid
class TestSearchFilterSortDeep:
def test_find_with_score_threshold(self, api_client):
find_resp = api_client.find(query="machine learning", limit=10, score_threshold=0.5)
assert find_resp.status_code == 200
resources = find_resp.json().get("result", {}... | 139 | 6,271 |
OpenViking | tests/api_test/retrieval/slow/test_search_dedup_sort.py | .py | import os
import tempfile
import uuid
class TestSearchDedupSort:
def test_find_results_no_duplicate_uris(self, api_client):
with tempfile.TemporaryDirectory() as temp_dir:
unique_kw = f"dedup_{uuid.uuid4().hex[:8]}"
test_file = os.path.join(temp_dir, f"{unique_kw}.md")
... | 189 | 8,670 |
OpenViking | tests/api_test/retrieval/slow/test_search_advanced.py | .py | import os
import tempfile
import uuid
class TestSearchAdvanced:
def test_find_with_filter_parameter(self, api_client):
find_resp = api_client.find(
query="test",
limit=5,
filter={"type": "resource"},
)
assert find_resp.status_code == 200, (
f... | 201 | 8,984 |
OpenViking | tests/api_test/retrieval/slow/test_glob_deep.py | .py | import os
import tempfile
import uuid
class TestGlobDeep:
def test_glob_md_pattern(self, api_client):
with tempfile.TemporaryDirectory() as temp_dir:
unique_kw = f"glob_md_{uuid.uuid4().hex[:8]}"
for i in range(3):
test_file = os.path.join(temp_dir, f"{unique_kw}_{i... | 163 | 7,407 |
OpenViking | tests/api_test/system/test_is_healthy.py | .py | import json
class TestIsHealthy:
def test_is_healthy(self, api_client):
try:
response = api_client.is_healthy()
print(f"\nIs healthy API status code: {response.status_code}")
data = response.json()
print("\n" + "=" * 80)
print("Is Healthy API Re... | 23 | 740 |
OpenViking | tests/api_test/system/test_system_wait.py | .py | import json
class TestSystemWait:
def test_system_wait(self, api_client):
try:
response = api_client.system_wait()
print(f"\nSystem wait API status code: {response.status_code}")
data = response.json()
print("\n" + "=" * 80)
print("System Wait A... | 24 | 812 |
OpenViking | tests/api_test/system/test_observer.py | .py | import json
class TestObserver:
def test_observer_queue(self, api_client):
try:
response = api_client.observer_queue()
print(f"\nObserver queue API status code: {response.status_code}")
data = response.json()
print("\n" + "=" * 80)
print("Observ... | 84 | 3,209 |
OpenViking | tests/api_test/system/test_system_status.py | .py | import json
class TestSystemStatus:
def test_system_status(self, api_client):
try:
response = api_client.system_status()
print(f"\nSystem status API status code: {response.status_code}")
data = response.json()
print("\n" + "=" * 80)
print("Syste... | 24 | 822 |
OpenViking | tests/session/test_session_usage.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Usage record tests"""
from openviking.message import TextPart
from openviking.session import Session
class TestUsed:
"""Test usage recording"""
async def test_used_contexts(self, session: Session):
... | 67 | 2,165 |
OpenViking | tests/session/test_retention.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import pytest
from openviking.message import Message, TextPart, ToolPart
from openviking.server.routers.sessions import CommitRequest
from openviking.session.retention import (
build_turns,
fit_active_messages... | 272 | 8,382 |
OpenViking | tests/session/test_session_context.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Context retrieval tests"""
import asyncio
import json
from functools import partial
import pytest
import pytest_asyncio
from openviking.message import Message, TextPart
from openviking.server.identity import Requ... | 780 | 32,397 |
OpenViking | tests/session/test_session_usage_reporter.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import pytest
from openviking.message import ToolPart
from openviking.service.core import OpenVikingService
from openviking.service.task_tracker import get_task_tracker
from openviking.usage_reporter import MemoryUsag... | 72 | 2,394 |
OpenViking | tests/session/test_session_lifecycle.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Session lifecycle tests"""
import re
from openviking.server.identity import RequestContext
from openviking.service.core import OpenVikingService
from openviking.session import Session
class TestSessionCreate:
... | 184 | 6,033 |
OpenViking | tests/session/__init__.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Session test module"""
| 4 | 127 |
OpenViking | tests/session/test_memory_batching.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import asyncio
import logging
import os
from unittest.mock import MagicMock, patch
import pytest
from openviking.storage.queuefs.semantic_msg import SemanticMsg
from openviking.storage.queuefs.semantic_processor impo... | 184 | 8,054 |
OpenViking | tests/session/test_tool_result_synopsis.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import pytest
from openviking.session.tool_result_synopsis import (
ToolResultSynopsis,
generate_tool_result_synopsis,
render_tool_result_stub,
)
@pytest.fixture(autouse=True)
def _drain_background_tasks... | 184 | 6,493 |
OpenViking | tests/session/test_memory_extraction_scope.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Session commit memory extraction scope tests."""
from openviking.message import Message, TextPart
from openviking.server.identity import RequestContext, Role
from openviking.session.memory_policy import MemoryPolic... | 70 | 2,256 |
OpenViking | tests/session/test_session_commit_race.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Tests for session commit race condition fix (#580)."""
import asyncio
from openviking.message import TextPart
class TestCommitRace:
"""Test concurrent commit safety."""
async def test_concurrent_commit_... | 78 | 3,053 |
OpenViking | tests/session/test_commit_skill_inference.py | .py | from types import SimpleNamespace
from unittest.mock import AsyncMock, MagicMock
import pytest
from openviking.core.skill_loader import SkillLoader
from openviking.message import Message, TextPart
from openviking.server.identity import RequestContext, Role
from openviking.session.compressor_v3 import _v3_extraction_r... | 476 | 16,209 |
OpenViking | tests/session/test_memory_extractor_response_types.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Tests that memory extraction handles non-dict LLM responses gracefully.
Covers issue #605: Ollama models may return a JSON list instead of the
expected {"memories": [...]} dict, causing AttributeError on .get().
""... | 78 | 2,753 |
OpenViking | tests/session/test_session_retention_integration.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import asyncio
import json
from types import SimpleNamespace
from uuid import uuid4
import pytest
from openviking.message import Message, TextPart, ToolPart
from openviking.models.vlm.base import ToolCall, VLMRespons... | 1,875 | 66,590 |
OpenViking | tests/session/test_tool_result_externalization.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
import json
import pytest
import openviking.session.session as session_module
import openviking.session.tool_result_store as tool_result_store
from openviking.message import ToolPart
from openviking.server.config imp... | 147 | 4,626 |
OpenViking | tests/session/test_session_commit.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Commit tests"""
import asyncio
import json
from types import SimpleNamespace
from unittest.mock import AsyncMock, MagicMock
from openviking.message import TextPart
from openviking.server.identity import RequestCon... | 615 | 26,233 |
OpenViking | tests/session/test_session_messages.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Message management tests"""
import pytest
from openviking.message import ContextPart, TextPart, ToolPart
from openviking.session import Session
from openviking_cli.exceptions import InvalidArgumentError
class Te... | 160 | 6,225 |
OpenViking | tests/session/test_compressor_v3.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
from unittest.mock import AsyncMock
import pytest
from openviking.message import Message, TextPart
from openviking.server.identity import RequestC... | 1,717 | 60,980 |
OpenViking | tests/session/conftest.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""Session test fixtures"""
import asyncio
from functools import partial
from typing import AsyncGenerator
import pytest_asyncio
from openviking.message import TextPart, ToolPart
from openviking.server.identity impo... | 167 | 5,552 |
OpenViking | tests/session/train/test_fakes.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
import threading
from types import SimpleNamespace
from typing import Any
class InMemoryAGFS:
"""Tiny synchronous AGFS fake for training integration tests."""
def __init__... | 236 | 8,629 |
OpenViking | tests/session/train/test_train_components.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from typing import Any
import pytest
from test_fakes import fake_request_context
from openviking.session.memory.dataclass import MemoryFile, StoredLink
from openviking.session.memo... | 868 | 30,192 |
OpenViking | tests/session/train/test_train_framework.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
import asyncio
import json
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any
import pytest
from test_fakes import fake_request_context
from o... | 1,873 | 66,045 |
OpenViking | tests/session/train/test_batch_runner_cache.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
from pathlib import Path
from openviking.session.train.batch_runner import (
BatchTrainEvalConfig,
CachedEpochZeroTrainRolloutExecutor,
_baseline_cache_key,
_clean_r... | 545 | 17,784 |
OpenViking | tests/session/train/test_dataset_service_redaction.py | .py | from openviking.session.train.components.dataset_service import redact_sensitive
def test_redact_sensitive_recursively_masks_openviking_api_key():
payload = {
"policy_set": {
"metadata": {
"openviking_api_key": "secret-key",
"openviking_url": "http://127.0.0.1:1... | 35 | 1,287 |
OpenViking | tests/session/train/test_gradient_estimator_component.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 asyncio
import pytest
from openviking.session.memory.dataclass import MemoryFile
from openviking.session.train import (
CriterionResult... | 271 | 9,961 |
OpenViking | tests/session/train/test_trajectory_analyzer_component.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.message import Message, TextPart, ToolPart
from openviking.session.memory.dataclass import ResolvedOperation, Resolv... | 284 | 9,651 |
OpenViking | tests/session/train/test_policy_optimization_real_llm_e2e.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
import json
from types import SimpleNamespace
import pytest
from test_fakes import InMemoryVikingFS
from openviking.message import Message
from openviking.models.vlm.llm import par... | 769 | 30,429 |
OpenViking | tests/session/train/test_rollout_executor_component.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
import asyncio
import threading
from pathlib import Path
from types import SimpleNamespace
import pytest
from openviking.session.train import (
Case,
ExecutionContext,
... | 918 | 31,031 |
OpenViking | tests/session/memory/test_patch_merge_context_provider.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
import json
from types import SimpleNamespace
from unittest.mock import AsyncMock
import pytest
from openviking.session.memory.dataclass import MemoryFile, MemoryTypeSchema
from op... | 408 | 15,117 |
OpenViking | tests/session/memory/test_memory_react.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Tests for memory ExtractLoop orchestrator.
"""
from unittest.mock import AsyncMock, MagicMock
import pytest
from openviking.session.memory.dataclass import (
MemoryFile,
MemoryTypeSchema,
ResolvedOper... | 356 | 13,044 |
OpenViking | tests/session/memory/test_streaming_memory_updater.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from __future__ import annotations
import asyncio
from unittest.mock import AsyncMock
import pytest
from openviking.message import Message, TextPart
from openviking.server.identity import RequestContext, Role
from o... | 1,247 | 41,774 |
OpenViking | tests/session/memory/test_resource_refs.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from openviking.session.memory.dataclass import MemoryFile
from openviking.session.memory.utils.resource_refs import (
contains_resource_uri,
extract_resource_uris,
sync_memory_resource_refs,
unlink_res... | 127 | 4,532 |
OpenViking | tests/session/memory/test_memory_read_tool_strip_links.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, ToolContext
from openviking.session.memory.dataclass import MemoryFile
from openviking.session.memory.tools import MemoryReadTool
from openvik... | 73 | 2,219 |
OpenViking | tests/session/memory/test_memory_isolation_handler.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Tests for MemoryIsolationHandler.
"""
from unittest.mock import MagicMock, patch
import pytest
from openviking.message.message import Message
from openviking.message.part import TextPart
from openviking.server.id... | 1,201 | 45,440 |
OpenViking | tests/session/memory/test_memory_react_system_prompt.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Test that provider instruction correctly instructs LLM.
"""
from openviking.message import ImagePart, Message, TextPart, ToolPart
from openviking.session.memory.session_extract_context_provider import SessionExtrac... | 349 | 12,923 |
OpenViking | tests/session/memory/test_agent_experience_context_provider.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, patch
import pytest
from openviking.server.identity import RequestContext, Role
from openviking.session.memory.agent_experience_context_provider ... | 190 | 7,433 |
OpenViking | tests/session/memory/test_merge_ops.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Tests for MergeOp architecture - type-safe merge operations.
"""
import asyncio
import threading
import pytest
from openviking.session.memory.dataclass import (
MemoryField,
)
from openviking.session.memory.m... | 391 | 14,406 |
OpenViking | tests/session/memory/test_memory_timestamp_parsing.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.message import Message
from openviking.message.part import TextPart
from openviking.server.identity import RequestContext, Role
from openviking.session.... | 212 | 7,283 |
OpenViking | tests/session/memory/test_json_stability.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Tests for JSON stable parsing utilities.
"""
import json
from typing import List, Optional
from unittest.mock import patch
from pydantic import BaseModel, Field
from openviking.session.memory.utils import (
J... | 456 | 17,244 |
OpenViking | tests/session/memory/test_memory_tools_template.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from pathlib import Path
import pytest_asyncio
import yaml
from openviking.session.memory.dataclass import MemoryFile
from openviking.session.memory.utils.memory_file_utils import MemoryFileUtils
@pytest_asyncio.fi... | 61 | 1,657 |
OpenViking | tests/session/memory/test_template_utils.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from types import SimpleNamespace
from openviking.session.memory.utils.template_utils import TemplateUtils
class TestTemplateUtils:
def test_render_supports_extract_context(self):
extract_context = Simpl... | 33 | 1,122 |
OpenViking | tests/session/memory/test_graph_view_collect.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from unittest.mock import AsyncMock, MagicMock
import pytest
from openviking.server.identity import RequestContext, Role
from openviking.session.memory.graph_view import MemoryGraph
from openviking_cli.session.user_i... | 199 | 8,132 |
OpenViking | tests/session/memory/test_memory_utils.py | .py | # Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
"""
Tests for memory utilities - URI generation, etc.
"""
import pytest
from openviking.session.memory.dataclass import (
MemoryField,
MemoryFile,
MemoryTypeSchema,
)
from openviking.session.memory.merge_o... | 426 | 14,897 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.