Initial working version

This commit is contained in:
Philip Henning 2026-03-08 18:32:25 +01:00
parent 34a0627e76
commit b6886cb34a
61 changed files with 4475 additions and 6 deletions

30
tests/test_factory.py Normal file
View file

@ -0,0 +1,30 @@
from pve_vm_setup.services.factory import ProxmoxServiceFactory
from pve_vm_setup.services.fake import FakeProxmoxService
from pve_vm_setup.services.proxmox import LiveProxmoxService
from pve_vm_setup.settings import AppSettings
def test_factory_returns_fake_service_when_live_env_is_missing() -> None:
settings = AppSettings.from_env({}, load_dotenv_file=False)
service = ProxmoxServiceFactory.create(settings)
assert isinstance(service, FakeProxmoxService)
def test_factory_returns_live_service_when_live_env_is_present() -> None:
settings = AppSettings.from_env(
{
"PROXMOX_URL": "https://proxmox.example.invalid:8006",
"PROXMOX_USER": "root",
"PROXMOX_PASSWORD": "secret",
"PROXMOX_REALM": "pam",
},
load_dotenv_file=False,
)
service = ProxmoxServiceFactory.create(settings)
try:
assert isinstance(service, LiveProxmoxService)
finally:
service.close()