Fix unprivileged WireGuard status parsing

This commit is contained in:
sascha 2026-08-16 20:08:07 +02:00
parent e958f508cb
commit 8e04a374e2

View file

@ -92,6 +92,18 @@ def test_wireguard_status_rejects_unknown_host_without_ssh(monkeypatch):
assert response.status_code == 404
def test_wireguard_status_command_uses_sudo_and_accepts_off_keepalive():
import base64
import re
command = app._wireguard_status_command()
encoded = re.search(r"b64decode\('([^']+)'\)", command).group(1)
script = base64.b64decode(encoded).decode()
assert '["sudo", "-n", "wg", "show", "wg0", "dump"]' in script
assert '0 if fields[7] == "off" else int(fields[7])' in script
def test_tts_generate_returns_cloned_wav(monkeypatch):
captured = {}