[network-manager-openvpn] tests: add test for extra stuff at the end of http-proxy line



commit 2a37cc62a2451939d7e95419fea491241e8ed652
Author: Dan Williams <dcbw redhat com>
Date:   Tue Apr 12 11:27:32 2011 -0500

    tests: add test for extra stuff at the end of http-proxy line
    
    Like the auth method which we ignore anyway for now since we use
    autodetection.

 properties/tests/conf/Makefile.am               |    3 +-
 properties/tests/conf/proxy-http-with-auth.ovpn |   32 ++++++++++++++++
 properties/tests/test-import-export.c           |   44 +++++++++++++++++++++++
 3 files changed, 78 insertions(+), 1 deletions(-)
---
diff --git a/properties/tests/conf/Makefile.am b/properties/tests/conf/Makefile.am
index 8762194..25398ea 100644
--- a/properties/tests/conf/Makefile.am
+++ b/properties/tests/conf/Makefile.am
@@ -10,6 +10,7 @@ EXTRA_DIST = \
 	tun-opts.conf \
 	proxy-http.ovpn \
 	httpauthfile \
-	proxy-socks.ovpn
+	proxy-socks.ovpn \
+	proxy-http-with-auth.ovpn
 
 
diff --git a/properties/tests/conf/proxy-http-with-auth.ovpn b/properties/tests/conf/proxy-http-with-auth.ovpn
new file mode 100644
index 0000000..6aa41f5
--- /dev/null
+++ b/properties/tests/conf/proxy-http-with-auth.ovpn
@@ -0,0 +1,32 @@
+client
+dev tun
+
+proto tcp
+topology subnet
+
+rport 2352
+remote test.server.com 443
+nobind
+persist-key
+persist-tun
+user openvpn
+group openvpn
+
+http-proxy-retry
+http-proxy proxy.domain.tld 3128 httpauthfile basic
+
+ca cacert.pem
+cipher AES-256-CBC
+reneg-sec 0
+
+auth-user-pass
+auth-nocache
+
+ping 30
+ping-exit 120
+
+# random comment
+
+script-security 2
+
+
diff --git a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
index 6188968..5f6372d 100644
--- a/properties/tests/test-import-export.c
+++ b/properties/tests/test-import-export.c
@@ -825,6 +825,48 @@ test_proxy_http_export (NMVpnPluginUiInterface *plugin, const char *dir, const c
 }
 
 static void
+test_proxy_http_with_auth_import (NMVpnPluginUiInterface *plugin, const char *dir)
+{
+	NMConnection *connection;
+	NMSettingVPN *s_vpn;
+
+	connection = get_basic_connection ("proxy-http-with-auth-import", plugin, dir, "proxy-http-with-auth.ovpn");
+	ASSERT (connection != NULL, "proxy-http-with-auth-import", "failed to import connection");
+
+	/* VPN setting */
+	s_vpn = (NMSettingVPN *) nm_connection_get_setting (connection, NM_TYPE_SETTING_VPN);
+	ASSERT (s_vpn != NULL,
+	        "proxy-http-with-auth-import", "missing 'vpn' setting");
+
+	/* Data items */
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_CONNECTION_TYPE, NM_OPENVPN_CONTYPE_PASSWORD);
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_TAP_DEV, NULL);
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_PROTO_TCP, "yes");
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_COMP_LZO, NULL);
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_RENEG_SECONDS, "0");
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_REMOTE, "test.server.com");
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_PORT, "443");
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_CERT, NULL);
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_KEY, NULL);
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_STATIC_KEY, NULL);
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_STATIC_KEY_DIRECTION, NULL);
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_TA, NULL);
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_TA_DIR, NULL);
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_CIPHER, "AES-256-CBC");
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_LOCAL_IP, NULL);
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_REMOTE_IP, NULL);
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_AUTH, NULL);
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_AUTH, NULL);
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_PROXY_TYPE, "http");
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_PROXY_SERVER, "proxy.domain.tld");
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_PROXY_PORT, "3128");
+	test_item ("proxy-http-with-auth-import-data", s_vpn, NM_OPENVPN_KEY_HTTP_PROXY_USERNAME, "myusername");
+	test_secret ("proxy-http-with-auth-import-secrets", s_vpn, NM_OPENVPN_KEY_HTTP_PROXY_PASSWORD, "mypassword");
+
+	g_object_unref (connection);
+}
+
+static void
 test_proxy_socks_import (NMVpnPluginUiInterface *plugin, const char *dir)
 {
 	NMConnection *connection;
@@ -966,6 +1008,8 @@ int main (int argc, char **argv)
 	test_proxy_http_import (plugin, test_dir);
 	test_proxy_http_export (plugin, test_dir, argv[2]);
 
+	test_proxy_http_with_auth_import (plugin, test_dir);
+
 	test_proxy_socks_import (plugin, test_dir);
 	test_proxy_socks_export (plugin, test_dir, argv[2]);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]