29 lines
926 B
Python
29 lines
926 B
Python
#
|
||
# 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 l’air, 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.core.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"
|