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", } )