Files
pve-cloud-backups/backend/tests/test_settings_api.py
T

43 lines
1.4 KiB
Python

from app import commands
from app.main import _validate_settings
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",
}
)