topen/test/test_cli.py
Marty Oehme e960f56b93
Some checks are pending
website / build (push) Waiting to run
website / deploy (push) Blocked by required conditions
test: Add simple happypath annotation adding
2025-11-29 18:52:44 +01:00

17 lines
548 B
Python

from pathlib import Path
from unittest.mock import Mock, patch
from topen import add_annotation, open_editor
def test_open_editor_escapes_shell():
"""Ensure filenames with spaces/metas do not allow shell injection."""
with patch("subprocess.run") as run_mock:
open_editor(Path("my note$1.txt"), "vim")
run_mock.assert_called_once_with(["vim", "my note$1.txt"], check=True)
def test_add_annotation_calls_tasklib():
task = Mock()
add_annotation(task, "hello")
task.add_annotation.assert_called_once_with("hello")