Files
OpenVPN-Monitoring-Simple/APP_PROFILER/test_client_template.py
T
ayurishchevandClaude Sonnet 5.5 d29c261347 OpenVPN templates: drop windows-driver, tls-client, client user/group
windows-driver was removed in OpenVPN 2.7 and broke clients; add
explicit-exit-notify for UDP clients, tidy the server template.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-07 09:38:09 +03:00

18 lines
849 B
Python

"""One test for the client profile template (templates/client.ovpn.j2), tcp and udp."""
import pytest
from services.generator import env
@pytest.mark.parametrize("protocol", ["tcp", "udp"])
def test_client_template(protocol):
text = env.get_template("client.ovpn.j2").render(
protocol=protocol, remote_ip="203.0.113.1", port=1194, ca_cert="CA",
client_cert="CERT", client_key="KEY", tls_auth="TA", tun_mtu=None)
lines = [x.strip() for x in text.splitlines()]
assert f"proto {protocol}" in lines and "client" in lines
# directives that OpenVPN 2.7 rejects or that are redundant/harmful on user devices
for gone in ("windows-driver", "tls-client", "#tls-client", "user", "group"):
assert not any(x.split(" ")[0] == gone for x in lines)
assert ("explicit-exit-notify" in lines) == (protocol == "udp")