Les choses sérieuses commencent

This commit is contained in:
L0m1g 2025-04-29 17:15:19 +02:00
parent 7a9fe18463
commit c63f62721b
41 changed files with 1270 additions and 0 deletions

5
tests/test_config.py Normal file
View file

@ -0,0 +1,5 @@
from erminig.config import Config
def test_db_path():
assert str(Config.DB_PATH).endswith("erminig.db")

20
tests/test_pakva.py Normal file
View file

@ -0,0 +1,20 @@
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"