[network-manager-openvpn/th/ping-bgo651657: 4/6] properties/tests: add tests for import/export of the ping/ping-exit/ping-restart options
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn/th/ping-bgo651657: 4/6] properties/tests: add tests for import/export of the ping/ping-exit/ping-restart options
- Date: Mon, 17 Aug 2015 14:31:38 +0000 (UTC)
commit 990d7495361eb85d6927ea31827c0607c3419bae
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Jun 18 14:19:38 2015 -0500
properties/tests: add tests for import/export of the ping/ping-exit/ping-restart options
[thaller redhat com: modified original patch to use g_assert()]
properties/tests/conf/ping-with-exit.ovpn | 26 +++++++++++++++++
properties/tests/conf/ping-with-restart.ovpn | 26 +++++++++++++++++
properties/tests/test-import-export.c | 38 ++++++++++++++++++++++++++
3 files changed, 90 insertions(+), 0 deletions(-)
---
diff --git a/properties/tests/conf/ping-with-exit.ovpn b/properties/tests/conf/ping-with-exit.ovpn
new file mode 100644
index 0000000..b34e02d
--- /dev/null
+++ b/properties/tests/conf/ping-with-exit.ovpn
@@ -0,0 +1,26 @@
+port 2345
+
+remote 173.8.149.245
+resolv-retry infinite
+
+dev tun
+persist-key
+persist-tun
+link-mtu 1400
+proto udp
+nobind
+pull
+tls-client
+
+ca keys/mg8.ca
+cert keys/clee.crt
+key keys/clee.key
+
+tls-auth keys/46.key 1
+tls-remote "/CN=myvpn.company.com"
+
+comp-lzo
+verb 3
+
+ping 10
+ping-exit 120
diff --git a/properties/tests/conf/ping-with-restart.ovpn b/properties/tests/conf/ping-with-restart.ovpn
new file mode 100644
index 0000000..7194cc1
--- /dev/null
+++ b/properties/tests/conf/ping-with-restart.ovpn
@@ -0,0 +1,26 @@
+port 2345
+
+remote 173.8.149.245
+resolv-retry infinite
+
+dev tun
+persist-key
+persist-tun
+link-mtu 1400
+proto udp
+nobind
+pull
+tls-client
+
+ca keys/mg8.ca
+cert keys/clee.crt
+key keys/clee.key
+
+tls-auth keys/46.key 1
+tls-remote "/CN=myvpn.company.com"
+
+comp-lzo
+verb 3
+
+ping 10
+ping-restart 30
diff --git a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
index 1d783bc..4726601 100644
--- a/properties/tests/test-import-export.c
+++ b/properties/tests/test-import-export.c
@@ -639,6 +639,38 @@ test_port_import (NMVpnPluginUiInterface *plugin,
}
static void
+test_ping_import (NMVpnPluginUiInterface *plugin,
+ const char *detail,
+ const char *dir,
+ const char *file,
+ const char *expected_ping,
+ const char *expected_ping_exit,
+ const char *expected_ping_restart)
+{
+ NMConnection *connection;
+ NMSettingConnection *s_con;
+ NMSettingVPN *s_vpn;
+
+ connection = get_basic_connection (detail, plugin, dir, file);
+ g_assert (connection);
+
+ /* Connection setting */
+ s_con = nm_connection_get_setting_connection (connection);
+ g_assert (s_con);
+
+ /* VPN setting */
+ s_vpn = nm_connection_get_setting_vpn (connection);
+ g_assert (s_vpn);
+
+ /* Data items */
+ test_item (detail, s_vpn, NM_OPENVPN_KEY_PING, expected_ping);
+ test_item (detail, s_vpn, NM_OPENVPN_KEY_PING_EXIT, expected_ping_exit);
+ test_item (detail, s_vpn, NM_OPENVPN_KEY_PING_RESTART, expected_ping_restart);
+
+ g_object_unref (connection);
+}
+
+static void
test_port_export (NMVpnPluginUiInterface *plugin,
const char *detail,
const char *dir,
@@ -1140,6 +1172,12 @@ int main (int argc, char **argv)
test_tun_opts_import (plugin, test_dir);
test_tun_opts_export (plugin, test_dir, argv[2]);
+ test_ping_import (plugin, "ping-with-exit-import", test_dir, "ping-with-exit.ovpn", "10", "120",
NULL);
+ test_ping_import (plugin, "ping-with-restart-import", test_dir, "ping-with-restart.ovpn", "10", NULL,
"30");
+
+ test_port_export (plugin, "ping-with-exit-export", test_dir, argv[2], "ping-with-exit.ovpn",
"ping-with-exit.ovpntest");
+ test_port_export (plugin, "ping-with-restart-export", test_dir, argv[2], "ping-with-restart.ovpn",
"ping-with-restart.ovpntest");
+
test_proxy_http_import (plugin, test_dir);
test_proxy_http_export (plugin, test_dir, argv[2]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]