Sunil Mohan Adapa baa44e91a2
*: Update imports statements from plinth to freedombox
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2026-08-28 07:35:18 -04:00

24 lines
759 B
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Test module for privileged snapshot operations.
"""
import pathlib
import pytest
from freedombox.modules.snapshot import privileged
systemctl_path = pathlib.Path('/usr/bin/systemctl')
systemd_installed = pytest.mark.skipif(not systemctl_path.exists(),
reason='systemd not available')
@pytest.mark.parametrize('input_path,escaped_path',
[('.snapshots', '\\x2esnapshots'), ('/', '-'),
('/home/user', 'home-user'), (':_.', ':_.')])
@systemd_installed
def test_systemd_path_escape(input_path, escaped_path):
"""Test escaping systemd paths."""
assert escaped_path == privileged._systemd_path_escape(input_path)