libretime/easypanel/code/tools/packages_test.py
Cesar Jhoanny Mendivil Rubio 697b7cc288
Some checks are pending
Container / meta (analyzer) (push) Waiting to run
Container / meta (api) (push) Waiting to run
Container / meta (legacy) (push) Waiting to run
Container / meta (nginx) (push) Waiting to run
Container / meta (playout) (push) Waiting to run
Container / meta (worker) (push) Waiting to run
Container / build (push) Blocked by required conditions
Project / pre-commit (push) Waiting to run
Project / test-tools (push) Waiting to run
Release-Please / release-please (push) Waiting to run
feat(easypanel): actualizar configuración y scripts de EasyPanel, incluyendo mejoras en la generación de contraseñas, sincronización de herramientas y gestión de configuraciones
2025-10-01 17:41:20 -07:00

38 lines
1.1 KiB
Python

from pathlib import Path
from tools.packages import list_packages, load_packages
PACKAGE_INI = """
[common]
postgresql = focal, jammy
# Some comment
curl = bullseye, jammy
[legacy]
some-package = focal, bullseye
[=development]
ffmpeg = focal, bullseye, jammy
"""
result_jammy = {"curl", "postgresql"}
result_bullseye = {"some-package", "curl", "ffmpeg"}
result_focal = {"postgresql", "some-package", "ffmpeg"}
result_exclude = {"postgresql", "ffmpeg"}
def test_load_packages():
assert load_packages(PACKAGE_INI, "jammy", False) == result_jammy
assert load_packages(PACKAGE_INI, "bullseye", True) == result_bullseye
assert load_packages(PACKAGE_INI, "focal", True) == result_focal
assert load_packages(PACKAGE_INI, "focal", True, ["legacy"]) == result_exclude
def test_list_packages(tmp_path: Path) -> None:
package_file = tmp_path / "packages.ini"
package_file.write_text(PACKAGE_INI)
assert list_packages([tmp_path, package_file], "jammy", False) == result_jammy
assert list_packages([tmp_path, package_file], "bullseye", True) == result_bullseye
assert list_packages([tmp_path, package_file], "focal", True) == result_focal