From 399c68a3c9e779c7a3d95826f161bb1df5559987 Mon Sep 17 00:00:00 2001 From: Federico Capoano Date: Thu, 21 Nov 2024 14:25:26 -0300 Subject: [PATCH] [tests] Fixed test --- tests/openvpn/test_parser.py | 78 +++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/tests/openvpn/test_parser.py b/tests/openvpn/test_parser.py index 59de88f3f..8b05b62b4 100644 --- a/tests/openvpn/test_parser.py +++ b/tests/openvpn/test_parser.py @@ -43,6 +43,82 @@ def test_parse_text(self): } self.assertDictEqual(o.config, expected) + def test_parse_server(self): + native = """# openvpn config: test-server + +auth SHA1 +auth-nocache +ca ca.pem +cert cert.pem +cipher AES-128-GCM +comp-lzo adaptive +crl-verify crl.pem +dev tap0 +dev-type tap +dh dh.pem +duplicate-cn +engine rsax +fast-io +group nogroup +keepalive 20 60 +key key.pem +log /var/log/openvpn.log +mode server +mssfix 1450 +mtu-disc no +mute-replay-warnings +persist-key +persist-tun +port 1194 +proto udp +script-security 0 +status /var/log/openvpn.status 10 +status-version 1 +tls-server +user nobody +verb 3 +""" + expected = { + "openvpn": [ + { + "auth": "SHA1", + "auth_nocache": True, + "ca": "ca.pem", + "cert": "cert.pem", + "cipher": "AES-128-GCM", + "comp_lzo": "adaptive", + "crl_verify": "crl.pem", + "dev": "tap0", + "dev_type": "tap", + "dh": "dh.pem", + "duplicate_cn": True, + "engine": "rsax", + "fast_io": True, + "group": "nogroup", + "keepalive": "20 60", + "key": "key.pem", + "log": "/var/log/openvpn.log", + "mode": "server", + "name": "test-server", + "mssfix": 1450, + "mtu_disc": "no", + "mute_replay_warnings": True, + "persist_key": True, + "persist_tun": True, + "port": 1194, + "proto": "udp", + "script_security": 0, + "status": "/var/log/openvpn.status 10", + "status_version": 1, + "tls_server": True, + "user": "nobody", + "verb": 3, + } + ] + } + o = OpenVpn(native=native) + self.assertDictEqual(o.config, expected) + def test_parse_data_ciphers(self): native = """# openvpn config: test-server @@ -119,7 +195,6 @@ def test_parse_data_ciphers(self): "name": "test-server", "mssfix": 1450, "mtu_disc": "no", - "mtu_test": False, "mute_replay_warnings": True, "persist_key": True, "persist_tun": True, @@ -129,7 +204,6 @@ def test_parse_data_ciphers(self): "status": "/var/log/openvpn.status 10", "status_version": 1, "tls_server": True, - "tun_ipv6": False, "user": "nobody", "verb": 3, }