Files
pve-cloud-backups/backend/tests/test_settings_api.py
T
Codex 88e6d042cd
CI / Frontend build (push) Successful in 12s
CI / Backend tests (push) Failing after 15s
CI / Script syntax (push) Successful in 3s
Fix CI timezone and fresh settings initialization
2026-07-15 01:13:29 +02:00

49 lines
1.6 KiB
Python

from app import commands
from app.main import _validate_settings
from app.migrations import _normalize_timezone
def test_system_timezone_absolute_utc_is_normalized():
assert _normalize_timezone("/UTC") == "UTC"
assert _normalize_timezone("/usr/share/zoneinfo/Europe/Berlin") == "Europe/Berlin"
def test_plain_onedrive_remote_is_accepted(monkeypatch):
monkeypatch.setattr(commands, "rclone_list_remotes", lambda rclone_path: ["onedrive"])
_validate_settings(
{
"setup_complete": True,
"proxmox_node": "pve",
"proxmox_storage": "backup-store",
"local_backup_dir": "/mnt/pve/backups/dump",
"rclone_path": "/usr/bin/rclone",
"rclone_remote": "onedrive",
"rclone_remote_path": "Backups/Proxmox",
"max_concurrent_backups": 1,
"timezone": "Europe/Berlin",
}
)
def test_invalid_timezone_is_rejected(monkeypatch):
monkeypatch.setattr(commands, "rclone_list_remotes", lambda rclone_path: ["onedrive"])
import pytest
from fastapi import HTTPException
with pytest.raises(HTTPException):
_validate_settings(
{
"setup_complete": True,
"proxmox_node": "pve",
"proxmox_storage": "backup-store",
"local_backup_dir": "/mnt/pve/backups/dump",
"rclone_path": "/usr/bin/rclone",
"rclone_remote": "onedrive",
"rclone_remote_path": "Backups/Proxmox",
"max_concurrent_backups": 1,
"timezone": "Not/AZone",
}
)