Erminig/tests/test_pakva.py

29 lines
928 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#
# Erminig - Tests relatifs aux fichiers Pakva
# Copyright (C) 2025 L0m1g
# Sous licence DOUARN - Voir le fichier LICENCE pour les détails
#
# Ce fichier fait partie du projet Erminig.
# Libre comme lair, stable comme un menhir, et salé comme le beurre.
#
import pytest
from pathlib import Path
from unittest.mock import patch
# PATCH directement le décorateur run_as_user pour les tests
@patch("erminig.system.security.run_as_user", lambda x=None: (lambda f: f))
def test_pakva_save_and_read(tmp_path):
from erminig.controllers.govel.pakva import Pakva # Importer après patch !
pakva_path = tmp_path / "Pakva"
pakva = Pakva("testpkg", "1.0.0", "http://example.com/testpkg.tar.gz")
pakva.path = pakva_path
pakva.save()
loaded = Pakva.read(pakva_path)
assert loaded.name == "testpkg"
assert loaded.version == "1.0.0"
assert loaded.archive == "http://example.com/testpkg.tar.gz"