Initial pve cloud backup app
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from datetime import datetime, timezone
|
||||
|
||||
import pytest
|
||||
|
||||
from app.jobs import next_run, validate_cron
|
||||
|
||||
|
||||
def test_cron_validation_accepts_standard_expression():
|
||||
validate_cron("0 2 * * *")
|
||||
assert next_run("0 2 * * *")
|
||||
|
||||
|
||||
def test_cron_validation_rejects_invalid_expression():
|
||||
with pytest.raises(ValueError):
|
||||
validate_cron("not a cron")
|
||||
|
||||
|
||||
def test_next_run_interprets_cron_in_configured_timezone():
|
||||
base = datetime(2026, 1, 1, 0, 0, tzinfo=timezone.utc)
|
||||
|
||||
assert next_run("0 2 * * *", base=base, timezone_name="Europe/Berlin") == "2026-01-01T01:00:00+00:00"
|
||||
Reference in New Issue
Block a user