Files
OpenJarvis/tests/cli/test_vault_cmd.py
T
Jon Saad-FalconandClaude Opus 4.6 a4c4081ff4 Add desktop distribution pipeline: rolling releases, auto-updates, code signing
- Rewrite .github/workflows/desktop.yml: 2-job pipeline (validate + build-and-release)
  with rolling desktop-latest pre-release on push to main and stable desktop-v* releases
- Add UpdateChecker component: checks for updates on startup + every 30 min,
  background download with progress bar, one-click relaunch
- Configure Tauri updater: endpoints pointing to desktop-latest release, pubkey placeholder
- Add tauri-plugin-process for relaunch support (Cargo.toml, lib.rs, package.json)
- Add macOS Entitlements.plist for notarization (network + file access, no sandbox)
- Add scripts/bump-desktop-version.sh for atomic version bumps across 3 config files
- Add desktop/README.md with dev setup, auto-update architecture, signing docs
- Update .gitignore for desktop/node_modules, dist, target
- Configure macOS minimumSystemVersion, Windows timestampUrl
- Include all Phase 14-21 work: agent hardening, RBAC, taint tracking, workflows,
  skills, knowledge graph, sessions, A2A, MCP templates, WASM sandbox, TUI dashboard,
  production tools, CLI expansion, API expansion, learning productionization,
  Tauri desktop app, and 10 new channels

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 19:14:05 +00:00

72 lines
2.3 KiB
Python

"""Tests for the ``jarvis vault`` CLI commands."""
from __future__ import annotations
from pathlib import Path
from unittest import mock
import pytest
from click.testing import CliRunner
from openjarvis.cli.vault_cmd import vault
class TestVaultCmd:
def test_vault_group_help(self) -> None:
result = CliRunner().invoke(vault, ["--help"])
assert result.exit_code == 0
assert "set" in result.output
assert "get" in result.output
assert "list" in result.output
assert "remove" in result.output
def test_vault_set_help(self) -> None:
result = CliRunner().invoke(vault, ["set", "--help"])
assert result.exit_code == 0
def test_vault_get_help(self) -> None:
result = CliRunner().invoke(vault, ["get", "--help"])
assert result.exit_code == 0
def test_vault_list_empty(self) -> None:
with mock.patch(
"openjarvis.cli.vault_cmd._VAULT_FILE",
Path("/nonexistent/vault.enc"),
):
result = CliRunner().invoke(vault, ["list"])
assert result.exit_code == 0
assert "empty" in result.output.lower()
def test_vault_roundtrip(self, tmp_path: Path) -> None:
pytest.importorskip("cryptography")
vault_file = tmp_path / "vault.enc"
key_file = tmp_path / ".vault_key"
with (
mock.patch("openjarvis.cli.vault_cmd._VAULT_FILE", vault_file),
mock.patch("openjarvis.cli.vault_cmd._VAULT_KEY_FILE", key_file),
mock.patch(
"openjarvis.cli.vault_cmd.DEFAULT_CONFIG_DIR", tmp_path,
),
):
runner = CliRunner()
# Set a credential
result = runner.invoke(vault, ["set", "MY_API_KEY", "secret123"])
assert result.exit_code == 0
# Get it back
result = runner.invoke(vault, ["get", "MY_API_KEY"])
assert result.exit_code == 0
assert "secret123" in result.output
def test_vault_remove_not_found(self) -> None:
with mock.patch(
"openjarvis.cli.vault_cmd._VAULT_FILE",
Path("/nonexistent/vault.enc"),
):
result = CliRunner().invoke(vault, ["remove", "nonexistent"])
assert result.exit_code == 0
assert "not found" in result.output.lower()