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 |
|---|---|---|---|---|---|
QwenPaw | tests/integration/test_driver_mcp_stdio_flow.py | .py | # -*- coding: utf-8 -*-
from pathlib import Path
import pytest
from qwenpaw.drivers.capabilities import DriverInvocation
from qwenpaw.drivers.contracts import CredentialRef, DriverCard, PolicyRule
from qwenpaw.drivers.credentials.store import AsyncCredentialStore
from qwenpaw.drivers.credentials.types import Credenti... | 78 | 2,531 |
QwenPaw | tests/integration/test_security_real.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
# -*- coding: utf-8 -*-
"""Integration tests for the security stack β Sprint 3.3.
Goes beyond config CRUD (already in test_security_config.py /
test_approval.py) to verify:
A. Tool Guard built-in rules endpoint + config reload + auto-deny
of known-d... | 680 | 21,897 |
QwenPaw | tests/integration/test_agent_routing_config.py | .py | # -*- coding: utf-8 -*-
"""Smoke tests for ACP, LLM routing, allow-no-auth, timezone."""
from __future__ import annotations
import pytest
@pytest.mark.integration
@pytest.mark.p1
def test_agent_scoped_acp_put_get_roundtrip(app_server) -> None:
"""Test purpose:
- Verify agent-scoped ACP config endpoint suppor... | 432 | 15,461 |
QwenPaw | tests/integration/test_cron.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for agent-scoped cron job APIs."""
from __future__ import annotations
import copy
import pytest
from helpers import default_http_timeout
_CRON_HTTP_TIMEOUT = default_http_timeout(30.0)
def _minimal_text_cron_spec(*, name: str) -> dict:
"""Build a valid CronJobSpec w... | 196 | 6,579 |
QwenPaw | tests/integration/test_market.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for the Skill Market router."""
from __future__ import annotations
import pytest
from helpers import default_http_timeout
_MARKET_HTTP_TIMEOUT = default_http_timeout(15.0)
@pytest.mark.integration
@pytest.mark.p1
def test_market_providers_list_returns_array_contract(app_... | 79 | 2,738 |
QwenPaw | tests/integration/test_mcp.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for MCP client APIs."""
from __future__ import annotations
import json
import sys
import time
from pathlib import Path
import pytest
import yaml
@pytest.mark.integration
@pytest.mark.p0
def test_mcp_create_get_list_delete(app_server) -> None:
"""Test purpose:
- ... | 825 | 26,886 |
QwenPaw | tests/integration/test_messages_files.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for messages and files APIs."""
from __future__ import annotations
from urllib.parse import quote
import pytest
_MESSAGES_FILES_TIMEOUT = 20.0
@pytest.mark.integration
@pytest.mark.p0
def test_messages_send_console(app_server) -> None:
"""Test purpose:
- Verify ... | 361 | 11,520 |
QwenPaw | tests/integration/test_provider_switching.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
# -*- coding: utf-8 -*-
"""Integration tests for provider switching and retry/rate-limit
(Sprint 3.1-C).
Drives the mock LLM with custom HTTP status codes to exercise:
- Two distinct mock providers and active-model switching round-trip.
- 429 β recovery vi... | 471 | 14,203 |
QwenPaw | tests/integration/test_acp_mcp_driver_flow.py | .py | # -*- coding: utf-8 -*-
"""Integration coverage for ACP MCP cards through DriverManager."""
from __future__ import annotations
from pathlib import Path
import pytest
from acp.schema import EnvVariable, McpServerStdio
from qwenpaw.agents.acp.session_mcp import (
acp_mcp_scope_id,
build_acp_mcp_driver_cards,
... | 157 | 4,426 |
QwenPaw | tests/integration/test_driver_mcp_http_flow.py | .py | # -*- coding: utf-8 -*-
from pathlib import Path
import pytest
from qwenpaw.drivers.capabilities import DriverInvocation
from qwenpaw.drivers.contracts import CredentialRef, DriverCard, PolicyRule
from qwenpaw.drivers.credentials.store import AsyncCredentialStore
from qwenpaw.drivers.credentials.types import Credenti... | 74 | 2,440 |
QwenPaw | tests/integration/test_agents.py | .py | # -*- coding: utf-8 -*-
"""HTTP smoke tests for agents lifecycle (list/create/update/order/toggle)."""
from __future__ import annotations
import pytest
from qwenpaw.constant import BUILTIN_QA_AGENT_ID
from tests.integration.helpers import wait_for_agent_startup
_AGENT_PROFILE_TOP_LEVEL_KEYS = (
"channels",
... | 284 | 10,153 |
QwenPaw | tests/integration/test_multi_agent_lifecycle.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for multi-agent lifecycle management.
Covers agent creation (with full options, auto-id, workspace init),
updates, ordering, enable/disable routing effects, workspace isolation,
deletion behaviour, and error boundaries (duplicate, reserved, invalid
format, too short, nonexi... | 1,014 | 29,800 |
QwenPaw | tests/integration/test_driver_workspace_lifecycle.py | .py | # -*- coding: utf-8 -*-
from pathlib import Path
import pytest
from qwenpaw.app.workspace import Workspace
from qwenpaw.drivers.contracts import DriverCard
from qwenpaw.drivers.storage import card_path, dump_card
from tests.integration.driver_mcp_fakes import patch_mcp_runtime_clients
def _mcp_card(name: str) -> Dr... | 64 | 1,910 |
QwenPaw | tests/integration/test_heartbeat.py | .py | # -*- coding: utf-8 -*-
"""HTTP smoke tests for heartbeat config (global + agent-scoped)."""
from __future__ import annotations
import pytest
@pytest.mark.integration
@pytest.mark.p0
def test_global_heartbeat_put_get_roundtrip(app_server) -> None:
"""Test purpose:
- Verify global heartbeat config can be upda... | 208 | 7,500 |
QwenPaw | tests/integration/helpers.py | .py | # -*- coding: utf-8 -*-
"""Shared helpers for integration tests.
Extracted from individual test modules to eliminate duplication and
ensure fixes (e.g. TimeoutException handling) apply everywhere.
"""
from __future__ import annotations
import json
import os
import shutil
import time
from http.server import BaseHTTPRe... | 708 | 22,841 |
QwenPaw | tests/integration/test_coding_project.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for /api/workspace/project-directory/* (Sprint 4.3).
Target router: src/qwenpaw/app/routers/coding_project.py (8 routes, 0 cov)
Coverage strategy (happy path first):
- GET (root): read the active coding dir metadata (no side effects).
- POST /create: create a fresh pro... | 402 | 13,121 |
QwenPaw | tests/integration/test_settings_envs.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for settings and env management APIs."""
from __future__ import annotations
import pytest
@pytest.mark.integration
@pytest.mark.p1
def test_settings_language_default_en(app_server) -> None:
"""Test purpose:
- Verify the default language value in a fresh workspace.... | 138 | 4,184 |
QwenPaw | tests/integration/test_plugins.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for plugin install / upload / uninstall lifecycle.
Covers both ingest paths (POST /install with a local source path,
POST /upload with an in-memory zip) plus the catalog and status
endpoints. Two real bundled plugins (``cloudpaw`` and
``gpt-image2-tool``) are installed and ... | 628 | 21,577 |
QwenPaw | tests/integration/test_driver_mcp_approval_level_policy.py | .py | # -*- coding: utf-8 -*-
import asyncio
from pathlib import Path
from types import SimpleNamespace
import pytest
from qwenpaw.app.approvals.driver_gate import QwenPawDriverApprovalGate
from qwenpaw.app.approvals.service import ApprovalService
from qwenpaw.app.driver_config_watcher import DriverConfigWatcher
from qwenp... | 723 | 21,695 |
QwenPaw | tests/integration/test_chrome_extension_setup.py | .py | # -*- coding: utf-8 -*-
"""Chrome plugin integration contracts grouped by runtime boundary."""
from __future__ import annotations
import asyncio
import threading
from pathlib import Path
import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient
from plugins.bundle.chrome.api import routes
... | 137 | 3,752 |
QwenPaw | tests/integration/test_chrome_nm_host.py | .py | # -*- coding: utf-8 -*-
"""Chrome plugin integration contracts grouped by runtime boundary."""
from __future__ import annotations
import asyncio
import importlib.util
import io
import json
import struct
import subprocess
import sys
import threading
from pathlib import Path
from types import ModuleType
from typing imp... | 565 | 15,003 |
QwenPaw | tests/integration/test_skills_pool_autosync.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for skill-pool auto-sync deepening (Sprint 4.4).
Deepens coverage of ``SkillPoolService`` / the pool router beyond the
CRUD paths already in ``test_skills_pool.py``. Focus: the v2.0 auto-sync
surface that was previously 0-covered:
- PUT /api/skills/pool/{skill_name}/aut... | 385 | 12,673 |
QwenPaw | tests/integration/test_chats_global.py | .py | # -*- coding: utf-8 -*-
"""Smoke tests for global /api/chats (CRUD, batch, isolation)."""
from __future__ import annotations
import pytest
@pytest.mark.integration
@pytest.mark.p0
def test_api_chats_crud_and_agent_scoped_list(app_server) -> None:
"""Test purpose:
- Verify core chat CRUD works correctly unde... | 333 | 11,237 |
QwenPaw | tests/integration/test_skills_global.py | .py | # -*- coding: utf-8 -*-
"""Smoke tests for global /api/skills (CRUD, batch, validation)."""
from __future__ import annotations
import pytest
def _skill_md(name: str, description: str) -> str:
return (
"---\n"
f"name: {name}\n"
f"description: {description}\n"
"---\n\n"
"# I... | 727 | 23,847 |
QwenPaw | tests/integration/test_agent_scoped_misc.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for miscellaneous agent-scoped endpoints.
Covers tools config, heartbeat, console chat, and MCP OAuth start
through ``/api/agents/{agentId}/...`` paths.
"""
from __future__ import annotations
import httpx
import pytest
from tests.integration.helpers import (
create_ag... | 300 | 9,448 |
QwenPaw | tests/integration/test_tools.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for built-in tools API (scoped, no external keys)."""
from __future__ import annotations
import pytest
@pytest.mark.integration
@pytest.mark.p0
def test_agent_scoped_tools_toggle_and_async_execution_roundtrip(
app_server,
) -> None:
"""Test purpose:
- Verify a... | 90 | 3,379 |
QwenPaw | tests/integration/test_chats_agent_scoped.py | .py | # -*- coding: utf-8 -*-
"""HTTP smoke tests for agent-scoped chats endpoints."""
from __future__ import annotations
import pytest
@pytest.mark.integration
@pytest.mark.p0
def test_api_agent_scoped_chats_create_list_batch_delete(app_server) -> None:
"""Test purpose:
- Verify chats can be created, listed, and... | 179 | 6,498 |
QwenPaw | tests/integration/test_workspace_git.py | .py | # -*- coding: utf-8 -*-
"""Integration tests for /api/workspace/git/* (Sprint 4.3).
Target router: src/qwenpaw/app/routers/git.py (11 routes, 0 cov)
Backing: real ``git`` binary via ``_git()`` shelling out; the endpoints
operate on ``get_agent_project_dir(workspace)`` which, for the default agent,
resolves to ``<worki... | 499 | 15,495 |
QwenPaw | tests/integration/conftest.py | .py | # -*- coding: utf-8 -*-
"""Shared fixtures for integration tests.
These fixtures start a real QwenPaw app subprocess with isolated workspace
directories and a sanitized environment to avoid touching local secrets.
Subprocess coverage (optional):
QWENPAW_INTEGRATION_COVERAGE=1 pytest tests/integration/
When set,... | 481 | 16,529 |
QwenPaw | tests/integration/fixtures/acp_mock_runner.py | .py | # -*- coding: utf-8 -*-
"""Stdio Mock ACP Runner for integration tests.
Speaks ACP JSON-RPC v2.0 over stdin/stdout (NDJSON: one JSON message
per line). Behaviour is driven by environment variables so that
individual tests can script different scenarios without forking this
file.
Supported request methods:
- ``initia... | 237 | 7,954 |
QwenPaw | tests/integration/browser/test_execution_lifecycle_e2e.py | .py | # -*- coding: utf-8 -*-
"""Real worker-process lifecycle contracts for browser execution."""
from __future__ import annotations
# pylint: disable=protected-access
import asyncio
import os
import time
from fastapi import FastAPI
from qwenpaw.app._app import _start_browser_runtime, _stop_browser_runtime
from qwenpaw... | 113 | 3,417 |
QwenPaw | tests/integration/browser/test_e2e_isolation.py | .py | # -*- coding: utf-8 -*-
"""Real Chromium session-context isolation through the subprocess plane."""
import pytest
from qwenpaw.browser.control_link.playwright.adapter import (
PlaywrightControlLink,
)
from qwenpaw.browser.execution.subprocess_plane import SubprocessPlane
from qwenpaw.browser.execution.wire import... | 166 | 5,482 |
QwenPaw | tests/integration/browser/test_playwright_provider_e2e.py | .py | # -*- coding: utf-8 -*-
"""Real Chromium contracts for the Playwright control-link provider."""
import pytest
from qwenpaw.browser.control_link.playwright.adapter import (
PlaywrightControlLink,
)
from qwenpaw.browser.errors import BrowserError
def _locator_spec(method: str, *args: str, **kwargs: str) -> list[d... | 125 | 3,784 |
QwenPaw | tests/integration/browser/_fake_cdp_transport.py | .py | # -*- coding: utf-8 -*-
import asyncio
from qwenpaw.browser.errors import BrowserError, ErrorCategory
class FakeCdpTransport:
def __init__(self, results=None, hang=False):
self.results = results or {}
self.hang = hang
self.calls = []
self.sinks = []
async def connect(self, url... | 38 | 1,037 |
QwenPaw | tests/integration/browser/_fake_extension_bridge.py | .py | # -*- coding: utf-8 -*-
"""In-memory extension double honoring the frozen wire protocol (tab.*)."""
from __future__ import annotations
from typing import Any, Mapping
from qwenpaw.browser.control_link.chrome.protocol import EXTENSION_COMMANDS
_CDP_FIXTURES: dict[str, dict[str, Any]] = {
"Page.reload": {},
"... | 150 | 5,503 |
QwenPaw | tests/integration/browser/test_browser_tool_e2e.py | .py | # -*- coding: utf-8 -*-
"""Real Chromium journey through the public Browser tool."""
from collections.abc import AsyncGenerator
import pytest_asyncio
from agentscope.message import ToolResultState
from qwenpaw.agents.tools.browser import browser
from qwenpaw.browser.execution import kernel
from qwenpaw.browser.execu... | 44 | 1,402 |
QwenPaw | tests/integration/browser/test_token_rotation.py | .py | # -*- coding: utf-8 -*-
"""Token rotation recovery coverage for the Native Messaging bridge."""
# pylint: disable=protected-access,redefined-outer-name
import json
from pathlib import Path
import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient
from starlette.testclient import WebSocketDe... | 89 | 2,996 |
QwenPaw | tests/integration/browser/test_ws_bridge_auth.py | .py | # -*- coding: utf-8 -*-
"""Authentication coverage for the Native Messaging bridge endpoint."""
# pylint: disable=protected-access,redefined-outer-name
import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient
from starlette.testclient import WebSocketDenialResponse
from qwenpaw.browser.con... | 42 | 1,320 |
QwenPaw | tests/integration/browser/conftest.py | .py | # -*- coding: utf-8 -*-
"""Isolated Chromium fixtures for Unified Browser integration contracts."""
# pylint: disable=protected-access,wrong-import-position
from pathlib import Path
import json
import os
import shutil
import tempfile
import pytest
import pytest_asyncio
# This executes before any QwenPaw module is i... | 141 | 4,535 |
QwenPaw | tests/unit/test_memory_reranker.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pylint: disable=protected-access,unused-argument,redefined-outer-name
"""Unit tests for ReMe memory reranker (over-fetch + rerank + cap).
Tests cover:
- disabled: no rerank, behavior identical to plain search
- enabled + API ok: results reordered by reranker, capped... | 592 | 18,313 |
QwenPaw | tests/unit/workspace/test_agent_creation.py | .py | # -*- coding: utf-8 -*-
"""Tests for agent creation with short UUID."""
from unittest.mock import patch
from qwenpaw.config.config import (
AgentProfileConfig,
generate_short_agent_id,
)
def test_agent_creation_auto_generates_short_id():
"""Test that agent creation validates short ID generation."""
#... | 87 | 2,733 |
QwenPaw | tests/unit/workspace/test_cli_agent_id.py | .py | # -*- coding: utf-8 -*-
"""Tests for CLI --agent-id parameter support."""
import json
import tempfile
from pathlib import Path
from unittest.mock import patch, MagicMock
import pytest
from click.testing import CliRunner
from qwenpaw.cli.channels_cmd import channels_group
from qwenpaw.cli.cron_cmd import cron_group
fro... | 247 | 7,837 |
QwenPaw | tests/unit/workspace/__init__.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for workspace module."""
| 3 | 63 |
QwenPaw | tests/unit/workspace/test_prompt.py | .py | # -*- coding: utf-8 -*-
"""Tests for agent identity in system prompt."""
import tempfile
from pathlib import Path
import pytest
from qwenpaw.agents.prompt import build_system_prompt_from_working_dir
@pytest.fixture
def temp_workspace():
"""Create a temporary workspace directory."""
with tempfile.TemporaryDire... | 99 | 3,096 |
QwenPaw | tests/unit/workspace/test_agent_model.py | .py | # -*- coding: utf-8 -*-
"""Tests for per-agent model configuration."""
from pathlib import Path
import pytest
from qwenpaw.exceptions import (
ConfigurationException,
)
from qwenpaw.config.config import (
AgentProfileConfig,
AgentsRunningConfig,
load_agent_config,
save_agent_config,
)
from qwenpaw... | 296 | 9,461 |
QwenPaw | tests/unit/workspace/test_agent_id.py | .py | # -*- coding: utf-8 -*-
"""Tests for agent ID generation, sanitization, and validation."""
import pytest
from qwenpaw.config.config import (
generate_short_agent_id,
sanitize_agent_id,
validate_agent_id,
)
def test_generate_short_agent_id_length():
"""Test that generated agent ID has correct length."... | 125 | 3,634 |
QwenPaw | tests/unit/security/test_rm_bypass_fix_5090.py | .py | # -*- coding: utf-8 -*-
"""Focused regression test for #5090: rm -rf ${HOME} bypass.
The root cause: ``_RM_ESCAPE_PATTERNS`` applied a ``${VAR}`` blanking
substitution to the rm-part used for shlex tokenisation, which erased
real targets like ``${HOME}`` before path expansion β so the guard saw
no target and did not f... | 130 | 4,520 |
QwenPaw | tests/unit/security/test_secret_store.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
"""Tests for the encrypted secret store layer."""
from __future__ import annotations
from pathlib import Path
from unittest.mock import patch
import pytest
from qwenpaw.security.secret_store import (
AUTH_SECRET_FIELDS,
PROVIDER_SECRET_FIELDS,
de... | 252 | 8,778 |
QwenPaw | tests/unit/security/test_tool_guard_rm_bypass.py | .py | # -*- coding: utf-8 -*-
"""rm protection bypass regression tests.
Regression for #5090: rm protection must block root/home/absolute targets.
The guard in ``qwenpaw.security.tool_guard.guardians.rule_guardian`` extracts
rm targets, expands ``~``/``$HOME``/``${VAR}``, resolves them to absolute
paths, and flags any targ... | 237 | 8,394 |
QwenPaw | tests/unit/security/tool_guard/test_engine.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name,protected-access
"""Tests for qwenpaw.security.tool_guard.engine."""
from __future__ import annotations
from unittest.mock import MagicMock, patch
import pytest
from qwenpaw.security.tool_guard.engine import (
ToolGuardEngine,
_guard_enabled,
... | 610 | 21,328 |
QwenPaw | tests/unit/security/tool_guard/test_models.py | .py | # -*- coding: utf-8 -*-
"""Tests for qwenpaw.security.tool_guard.models."""
# pylint: disable=redefined-outer-name
from __future__ import annotations
from datetime import timezone
from qwenpaw.security.tool_guard.models import (
GuardFinding,
GuardSeverity,
GuardThreatCategory,
ToolGuardResult,
_s... | 483 | 16,590 |
QwenPaw | tests/unit/security/tool_guard/test_approval.py | .py | # -*- coding: utf-8 -*-
"""Tests for qwenpaw.security.tool_guard.approval."""
# pylint: disable=redefined-outer-name
from __future__ import annotations
from qwenpaw.security.tool_guard.approval import (
ApprovalDecision,
format_findings_summary,
)
from qwenpaw.security.tool_guard.models import (
GuardFind... | 145 | 5,581 |
QwenPaw | tests/unit/security/tool_guard/test_utils.py | .py | # -*- coding: utf-8 -*-
"""Tests for qwenpaw.security.tool_guard.utils."""
# pylint: disable=redefined-outer-name
from __future__ import annotations
from unittest.mock import patch
from qwenpaw.security.tool_guard.models import (
GuardFinding,
GuardSeverity,
GuardThreatCategory,
ToolGuardResult,
)
fro... | 540 | 20,208 |
QwenPaw | tests/unit/security/tool_guard/test_safety_checks.py | .py | # -*- coding: utf-8 -*-
"""Tests for shared safety check primitives."""
from __future__ import annotations
from pathlib import PureWindowsPath
import pytest
from qwenpaw.security.tool_guard.safety_checks import (
_is_posix_abs_token_catastrophic,
_is_resolved_path_catastrophic,
classify_destructive_comma... | 811 | 32,808 |
QwenPaw | tests/unit/security/tool_guard/conftest.py | .py | # -*- coding: utf-8 -*-
"""Shared fixtures for tool_guard tests."""
# pylint: disable=redefined-outer-name,unused-argument,protected-access
from __future__ import annotations
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from qwenpaw.security.tool_guard.models import (
GuardFi... | 146 | 4,226 |
QwenPaw | tests/unit/security/tool_guard/guardians/test_rule_guardian.py | .py | # -*- coding: utf-8 -*-
"""Tests for qwenpaw.security.tool_guard.guardians.rule_guardian."""
# pylint: disable=redefined-outer-name,unused-argument
from __future__ import annotations
import platform
from pathlib import Path
from unittest.mock import patch
import pytest
import yaml
from qwenpaw.security.tool_guard.gu... | 1,168 | 39,084 |
QwenPaw | tests/unit/security/tool_guard/guardians/test_file_guardian.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name,protected-access,unused-argument
"""Tests for file_guardian path-sensitive file guard.
Target: src/qwenpaw/security/tool_guard/guardians/file_guardian.py
Goal: push coverage from 38% to 78%+.
"""
from __future__ import annotations
from pathlib import Path... | 715 | 25,200 |
QwenPaw | tests/unit/security/skill_scanner/test_scanner.py | .py | # -*- coding: utf-8 -*-
"""Tests for qwenpaw.security.skill_scanner.scanner.
Covers:
- SkillScanner initialization and defaults
- scan_skill with valid/invalid directories
- _discover_files (symlink skip, extension skip, size limit, file count limit)
- register_analyzer
- Analyzer failure handling
- Deduplication of f... | 275 | 10,009 |
QwenPaw | tests/unit/security/skill_scanner/test_pattern_analyzer.py | .py | # -*- coding: utf-8 -*-
"""Tests for qwenpaw.security.skill_scanner.analyzers.pattern_analyzer.
Covers:
- SecurityRule: init, pattern compilation, matches_file_type, scan_content
- RuleLoader: load_rules from YAML, get_rule, get_rules_for_file_type/category
- PatternAnalyzer: analyze with policy filtering,
_is_known... | 396 | 14,380 |
QwenPaw | tests/unit/security/skill_scanner/test_models.py | .py | # -*- coding: utf-8 -*-
"""Tests for qwenpaw.security.skill_scanner.models.
Covers:
- Severity and ThreatCategory enums
- SkillFile creation and methods
- Finding creation and serialization
- ScanResult properties and methods
"""
# pylint: disable=redefined-outer-name,unused-argument,protected-access
from datetime imp... | 400 | 13,343 |
QwenPaw | tests/unit/security/skill_scanner/test_scan_policy.py | .py | # -*- coding: utf-8 -*-
"""Tests for qwenpaw.security.skill_scanner.scan_policy.
Covers:
- _safe_compile regex helper
- Data class defaults and construction
- ScanPolicy._from_dict / _to_dict roundtrip
- ScanPolicy._deep_merge
- ScanPolicy.is_doc_path
- ScanPolicy.get_severity_override / is_rule_disabled
- ScanPolicy.... | 423 | 13,913 |
QwenPaw | tests/unit/security/skill_scanner/test_init.py | .py | # -*- coding: utf-8 -*-
"""Tests for qwenpaw.security.skill_scanner.__init__.
Covers:
- compute_skill_content_hash
- is_skill_whitelisted
- BlockedSkillRecord (to_dict, from_dict)
- _finding_to_dict
- _record_blocked_skill, get_blocked_history,
clear_blocked_history, remove_blocked_entry
- _load_scanner_config, _get... | 875 | 30,179 |
QwenPaw | tests/unit/security/skill_scanner/conftest.py | .py | # -*- coding: utf-8 -*-
"""Shared fixtures for skill_scanner tests."""
# pylint: disable=redefined-outer-name,unused-argument,protected-access
from unittest.mock import MagicMock
import pytest
from qwenpaw.security.skill_scanner.models import (
Finding,
ScanResult,
Severity,
ThreatCategory,
)
from qwe... | 82 | 2,154 |
QwenPaw | tests/unit/sandbox/test_config.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
"""Unit tests for sandbox config and seatbelt profile generation."""
from __future__ import annotations
import logging
from unittest.mock import patch
from qwenpaw.sandbox import (
MountSpec,
PortRule,
SandboxConfig,
SandboxMode,
create_s... | 270 | 9,373 |
QwenPaw | tests/unit/sandbox/test_unenforced_config.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
"""Unit tests for unenforced-constraint reporting.
Regression cover for TC-SB-05: ``SandboxConfig`` accepts constraints that
some backends cannot apply (``max_memory_mb`` on every backend, everything
but the shell on ``NoneSandbox``). Dropping them silently l... | 658 | 24,423 |
QwenPaw | tests/unit/sandbox/test_windows_appcontainer_sandbox.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=unused-argument,protected-access,unused-variable
"""Unit tests for Windows AppContainer sandbox.
Test structure aligns with test_linux_sandbox.py:
1. Platform routing (probe_sandbox_support dispatches correctly)
2. Detailed probe logic (Windows version, icacls, WinDLL)... | 998 | 34,186 |
QwenPaw | tests/unit/sandbox/test_linux_sandbox.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=unused-argument
"""Unit tests for Linux Landlock sandbox and probe_sandbox_support."""
from __future__ import annotations
import sys
from unittest.mock import MagicMock, mock_open, patch
import pytest
from qwenpaw.sandbox import (
MountSpec,
SandboxCapability,
S... | 417 | 14,388 |
QwenPaw | tests/unit/sandbox/test_bubblewrap_sandbox.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access,unused-argument
"""Unit tests for Linux bubblewrap sandbox."""
from __future__ import annotations
from unittest.mock import MagicMock, patch
import pytest
from qwenpaw.sandbox import (
MountSpec,
SandboxCapability,
SandboxConfig,
SandboxMode... | 343 | 12,108 |
QwenPaw | tests/unit/sandbox/test_windows_unelevated_sandbox.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=unused-argument,protected-access,unused-variable
# pylint: disable=wrong-import-position
"""Unit tests for Windows Unelevated sandbox (WRITE_RESTRICTED, no admin).
Test structure:
1. Factory routing (create_sandbox dispatches correctly)
2. Shell command-line building
... | 686 | 23,482 |
QwenPaw | tests/unit/sandbox/test_windows_elevated_sandbox.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=unused-argument,protected-access,unused-variable
# pylint: disable=wrong-import-position
"""Unit tests for Windows Restricted-Token sandbox (WRITE_RESTRICTED backend).
Test structure mirrors test_windows_sandbox.py:
1. Factory routing (create_sandbox dispatches correctly)
... | 1,298 | 46,132 |
QwenPaw | tests/unit/tauri/test_sidecar_logging.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
from __future__ import annotations
import io
import logging
import sys
from qwenpaw.tauri import sidecar_logging as tauri_logging
def test_tee_stream_writes_text_to_both_streams():
primary = io.StringIO()
secondary = io.StringIO()
stream = tauri... | 70 | 2,210 |
QwenPaw | tests/unit/tauri/test_entry.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
from __future__ import annotations
import os
import socket
import sys
import types
import click
import pytest
from qwenpaw.tauri import entry
from qwenpaw.tauri.env import DESKTOP_CORS_ORIGINS_ENV, DESKTOP_READY_PREFIX
def test_install_desktop_runtime_pres... | 169 | 5,338 |
QwenPaw | tests/unit/tauri/test_pyinstaller_spec.py | .py | # -*- coding: utf-8 -*-
from __future__ import annotations
import ast
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[3]
SPEC_PATH = REPO_ROOT / "scripts" / "pack-tauri" / "qwenpaw.spec"
def _collected_submodule_packages() -> set[str]:
tree = ast.parse(SPEC_PATH.read_text(encoding="utf-8"... | 33 | 940 |
QwenPaw | tests/unit/routers/test_settings.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name
"""Unit tests for the global settings router (/api/settings/language)."""
from __future__ import annotations
import json
from pathlib import Path
from unittest.mock import patch
import pytest
from fastapi import FastAPI
from httpx import ASGITransport, As... | 165 | 5,190 |
QwenPaw | tests/unit/routers/test_console_placeholder.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for ``console._extract_placeholder_name``.
The console handler picks an immediate placeholder name for a new chat
from the first content part. Shapes match the agentscope content-block
formats (``{"type": "text", "text": "..."}`` dicts, ``TextBlock``-like
objects with ``.text``, r... | 89 | 3,086 |
QwenPaw | tests/unit/routers/test_git.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
from __future__ import annotations
import os
import subprocess
from pathlib import Path
from typing import Any
from unittest.mock import MagicMock
import pytest
from qwenpaw.app.routers import git as git_router
from qwenpaw.app.routers.git import CommitReque... | 176 | 4,694 |
QwenPaw | tests/unit/routers/test_console_project_directory.py | .py | # -*- coding: utf-8 -*-
"""Tests for Console Session project-directory request handling."""
from pathlib import Path
from types import SimpleNamespace
from unittest.mock import AsyncMock
import pytest
from fastapi import HTTPException
from qwenpaw.app.routers.console import _apply_session_project_dir
@pytest.mark.... | 93 | 2,671 |
QwenPaw | tests/unit/governance/test_policy.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
"""UT for GovernancePolicy β default policy load + assert_policy/audit."""
from __future__ import annotations
import tempfile
from pathlib import Path
import shutil
import pytest
from qwenpaw.governance.policy import (
DEFAULT_BUILTIN_RULES,
DEFAULT... | 1,917 | 72,716 |
QwenPaw | tests/unit/governance/test_unified_tool_registration.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
"""Tests for unified tool governance registration (issue #6114)."""
from __future__ import annotations
import threading
from pathlib import Path
from unittest.mock import patch
import pytest
from qwenpaw.agents.tools.delegate_external_agent import (
del... | 1,062 | 37,933 |
QwenPaw | tests/unit/governance/test_tool_adapter_scope.py | .py | # -*- coding: utf-8 -*-
"""UT for the tool_adapter approval-scope consumer (the lever).
``_ask_user_approval`` must pick the recorded rule target from the user's
chosen scope: SIMILAR β the generalized pattern, EXACT/None β the literal
target. This exercises that decision with a fake ApprovalService + governor
so no r... | 190 | 5,768 |
QwenPaw | tests/unit/governance/test_off_mode_sandbox.py | .py | # -*- coding: utf-8 -*-
"""UT for OFF-mode sandbox provisioning.
approval_level=OFF skips "ask the user" but must NOT skip "run it in a
sandbox". These tests pin that only fail-closed tools (the REPL) get a
sandbox_config compiled in OFF mode, that fail-open shell tools (Bash) are
left untouched, and that no sandbox p... | 226 | 7,971 |
QwenPaw | tests/unit/governance/test_detectors.py | .py | # -*- coding: utf-8 -*-
"""Tests for governance.detectors β deep security scan pure functions."""
import pytest
from qwenpaw.governance.detectors import (
GuardFinding,
_COMPILED_CACHE,
_get_compiled_patterns,
detect_dangerous_patterns,
detect_sensitive_paths,
detect_shell_evasion,
run_dee... | 420 | 14,842 |
QwenPaw | tests/unit/governance/test_generalize_rule_match.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
"""Standalone test suite for ``generalize_rule_match``.
Self-contained: defines its own fakes and patch helpers so the whole file
can be deleted without leaving references behind.
Covers:
- shell / file happy-path generalization
- output normalization... | 772 | 26,410 |
QwenPaw | tests/unit/token_usage/test_token_usage.py | .py | # -*- coding: utf-8 -*-
"""Unit tests for the token usage core module."""
from __future__ import annotations
import asyncio
import json
from unittest.mock import MagicMock
import pytest
from qwenpaw.token_usage.buffer import (
TokenUsageBuffer,
_UsageEvent,
_apply_event,
)
from qwenpaw.token_usage.manage... | 740 | 23,306 |
QwenPaw | tests/unit/loop/test_mode_lifecycle.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
"""Tests for mode-owned handler selection and reset lifecycle."""
from __future__ import annotations
from types import SimpleNamespace
from unittest.mock import patch
import pytest
from qwenpaw.loop.gates.base import (
StopAction,
StopHandlerRegistra... | 228 | 6,543 |
QwenPaw | tests/unit/loop/test_default_mode.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
"""Tests for DefaultMode gate ownership and lifecycle."""
from __future__ import annotations
from types import SimpleNamespace
from unittest.mock import patch
import pytest
from qwenpaw.loop.gates.doom_loop import DoomLoopGate
from qwenpaw.loop.gates.iterati... | 174 | 4,713 |
QwenPaw | tests/unit/loop/test_custom_loop_modes.py | .py | # -*- coding: utf-8 -*-
"""Tests for declarative custom loop modes."""
from __future__ import annotations
from types import SimpleNamespace
from unittest.mock import MagicMock
import pytest
from agentscope.message import Msg, TextBlock
from pydantic import ValidationError
from qwenpaw.config.config import (
Cust... | 573 | 16,575 |
QwenPaw | tests/unit/loop/test_doom_loop_gate.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name,protected-access
"""Tests for DoomLoopGate reset behaviour."""
from __future__ import annotations
from types import SimpleNamespace
from unittest.mock import patch
import pytest
from qwenpaw.loop.gates.base import StopAction
from qwenpaw.loop.gates.doom_... | 148 | 3,688 |
QwenPaw | tests/unit/loop/test_mission_settings.py | .py | # -*- coding: utf-8 -*-
"""Tests for user-editable Mission defaults."""
from __future__ import annotations
from unittest.mock import AsyncMock, patch
import pytest
from pydantic import ValidationError
from qwenpaw.config.config import MissionLoopModeConfig
from qwenpaw.modes.mission.handler import (
parse_missio... | 114 | 3,913 |
QwenPaw | tests/unit/loop/test_runner.py | .py | # -*- coding: utf-8 -*-
"""Tests for stop-handler result application."""
from types import SimpleNamespace
from typing import Any
import pytest
from qwenpaw.loop.gates.base import StopAction, StopHandlerResult
from qwenpaw.loop.gates.handler import StopHandler
from qwenpaw.loop.gates.runner import apply_stop_result, ... | 71 | 2,325 |
QwenPaw | tests/unit/loop/test_iteration_gate.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name,protected-access
"""Tests for IterationGate reset behaviour."""
from __future__ import annotations
from unittest.mock import patch
import pytest
from qwenpaw.loop.gates.base import StopAction
from qwenpaw.loop.gates.iteration import IterationGate
@pyte... | 142 | 3,652 |
QwenPaw | tests/unit/loop/test_handler_continuation_reset.py | .py | # -*- coding: utf-8 -*-
"""Tests for StopHandler peer-gate reset on continuation."""
from __future__ import annotations
from typing import Any, Optional, cast
import pytest
from qwenpaw.loop.gates.base import (
StopAction,
StopGate,
StopHandlerResult,
)
from qwenpaw.loop.gates.handler import StopHandler
... | 181 | 4,329 |
QwenPaw | tests/unit/local_models/test_download_manager.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
from __future__ import annotations
from qwenpaw.local_models.download_manager import (
DownloadProgressUpdate,
DownloadProgressTracker,
ProcessDownloadController,
ProcessDownloadTaskSpec,
ProcessDownloadTask,
DownloadTaskResult,
Dow... | 260 | 7,397 |
QwenPaw | tests/unit/local_models/test_llamacpp_backend.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
from __future__ import annotations
import asyncio
import io
import socket
import tarfile
import time
import zipfile
from pathlib import Path
from types import SimpleNamespace
from typing import Any, cast
import httpx
import pytest
import qwenpaw.local_models... | 1,322 | 37,497 |
QwenPaw | tests/unit/local_models/test_model_manager.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
from __future__ import annotations
import sys
from pathlib import Path
import pytest
from qwenpaw.local_models.download_manager import (
DownloadTaskResult,
DownloadTaskStatus,
)
from qwenpaw.local_models.model_manager import ModelManager, DownloadS... | 414 | 11,578 |
QwenPaw | tests/unit/local_models/test_local_model_manager.py | .py | # -*- coding: utf-8 -*-
from __future__ import annotations
import json
from pathlib import Path
from typing import cast
import pytest
from qwenpaw.local_models import manager as local_model_manager_module
from qwenpaw.local_models.llamacpp import LlamaCppServerSetupResult
from qwenpaw.local_models.manager import (
... | 300 | 9,471 |
QwenPaw | tests/unit/local_models/test_tag_parser.py | .py | # -*- coding: utf-8 -*-
# pylint: disable=protected-access
from __future__ import annotations
import pytest
from qwenpaw.local_models.tag_parser import (
extract_thinking_from_text,
parse_tool_calls_from_text,
text_contains_think_tag,
text_contains_tool_call_tag,
)
# ---------------------------------... | 228 | 7,408 |
QwenPaw | tests/unit/tool_calls/test_cancellable_wait_cancel_reason.py | .py | # -*- coding: utf-8 -*-
"""cancellable_wait cancel vs timeout reason separation."""
from __future__ import annotations
import asyncio
import pytest
from qwenpaw.tool_calls import (
OFFLOAD_TIMEOUT_RATIO,
arm_kill_deadline,
cancellable_wait,
reset_call_context,
set_call_context,
)
from qwenpaw.too... | 149 | 4,229 |
QwenPaw | tests/unit/tool_calls/test_coordinator_completion.py | .py | # -*- coding: utf-8 -*-
"""Tests for ToolCoordinator completion and offload lifecycle."""
from __future__ import annotations
import asyncio
from dataclasses import dataclass, field
from typing import Any, AsyncGenerator
import pytest
from agentscope.message import TextBlock, ToolResultBlock
from agentscope.tool impo... | 1,289 | 39,406 |
QwenPaw | tests/unit/services/test_unified_workspace_files.py | .py | # -*- coding: utf-8 -*-
"""Tests for unified Files workspace filesystem primitives."""
from __future__ import annotations
import os
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
import pytest
from qwenpaw.services.workspace_files import (
FileVersionConflict,
InvalidCursor,
... | 259 | 7,941 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.