feat(infra): auto-commit con 88 cambios

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-11 00:16:46 +02:00
parent 6bc97df5c0
commit eb8dbf66a1
126 changed files with 10933 additions and 287 deletions
@@ -0,0 +1,54 @@
"""Tests para resolve_obsidian_embed."""
import os
import pytest
from resolve_obsidian_embed import resolve_obsidian_embed
def _write(path, content="x"):
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(content, encoding="utf-8")
return str(path)
def test_match_exacto_en_subcarpeta(tmp_path):
# Golden path: archivo en subcarpeta resuelto por nombre exacto.
target = _write(tmp_path / "attachments" / "imagen.jpg")
result = resolve_obsidian_embed(str(tmp_path), "imagen.jpg")
assert result == os.path.abspath(target)
def test_match_case_insensitive(tmp_path):
# Edge: el nombre en disco difiere en mayusculas/minusculas.
target = _write(tmp_path / "media" / "Foto.JPG")
result = resolve_obsidian_embed(str(tmp_path), "foto.jpg")
assert result == os.path.abspath(target)
def test_sin_extension_acepta_cualquier_match(tmp_path):
# Edge: embed sin extension -> coincide cualquier archivo con ese stem.
target = _write(tmp_path / "doc.pdf")
result = resolve_obsidian_embed(str(tmp_path), "doc")
assert result == os.path.abspath(target)
def test_no_existe_devuelve_vacio(tmp_path):
# Error de dominio (no excepcion): nombre inexistente -> "".
_write(tmp_path / "otra.png")
assert resolve_obsidian_embed(str(tmp_path), "no_existe.png") == ""
def test_excluye_obsidian_y_trash(tmp_path):
# Edge: archivos en .obsidian/ y .trash/ no se resuelven.
_write(tmp_path / ".obsidian" / "config.jpg")
_write(tmp_path / ".trash" / "borrada.jpg")
assert resolve_obsidian_embed(str(tmp_path), "config.jpg") == ""
assert resolve_obsidian_embed(str(tmp_path), "borrada.jpg") == ""
def test_vault_inexistente_lanza(tmp_path):
# Error path: vault_dir que no existe -> FileNotFoundError.
with pytest.raises(FileNotFoundError):
resolve_obsidian_embed(str(tmp_path / "no_vault"), "imagen.jpg")