Aggiunge task scheduler XML
This commit is contained in:
31
tests/test_task_xml.py
Normal file
31
tests/test_task_xml.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def test_task_xml_files_are_parseable() -> None:
|
||||
task_dir = Path("tasks")
|
||||
files = [
|
||||
task_dir / "BakRestBackupOnLogoff.xml",
|
||||
task_dir / "BakRestServerNotifierEvery30Minutes.xml",
|
||||
]
|
||||
|
||||
for file in files:
|
||||
ET.parse(file)
|
||||
|
||||
|
||||
def test_notifier_task_runs_every_30_minutes() -> None:
|
||||
xml = (Path("tasks") / "BakRestServerNotifierEvery30Minutes.xml").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
assert "<Interval>PT30M</Interval>" in xml
|
||||
assert "-m bakrest.server_notifier" in xml
|
||||
|
||||
|
||||
def test_backup_task_uses_logoff_event_and_nogui_backup() -> None:
|
||||
xml = (Path("tasks") / "BakRestBackupOnLogoff.xml").read_text(encoding="utf-8")
|
||||
|
||||
assert "EventID=4647" in xml
|
||||
assert "-m bakrest.tray_app --nogui" in xml
|
||||
Reference in New Issue
Block a user