aboutsummaryrefslogtreecommitdiff
path: root/tests/client/torture_proxycommand.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-06-03 16:55:45 +0200
committerAndreas Schneider <asn@cynapses.org>2010-06-03 16:55:45 +0200
commit11a1ae59f4954b4109cbf0d54b058157d8402886 (patch)
treea2eeb72ecc9d3951bee5fb536729c29e42da2690 /tests/client/torture_proxycommand.c
parentcd1129b9b879066754797ec6522e58ac7f7f5fc5 (diff)
downloadlibssh-11a1ae59f4954b4109cbf0d54b058157d8402886.tar.gz
libssh-11a1ae59f4954b4109cbf0d54b058157d8402886.tar.xz
libssh-11a1ae59f4954b4109cbf0d54b058157d8402886.zip
tests: Moved proxycommand test to client tests.
Diffstat (limited to 'tests/client/torture_proxycommand.c')
-rw-r--r--tests/client/torture_proxycommand.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/client/torture_proxycommand.c b/tests/client/torture_proxycommand.c
new file mode 100644
index 0000000..3ee30a7
--- /dev/null
+++ b/tests/client/torture_proxycommand.c
@@ -0,0 +1,54 @@
+#define LIBSSH_STATIC
+
+#include "torture.h"
+#include <libssh/libssh.h>
+#include "libssh/priv.h"
+ssh_session session;
+
+static void setup(void) {
+ session = ssh_new();
+}
+
+static void teardown(void) {
+ ssh_free(session);
+}
+
+START_TEST (torture_options_set_proxycommand)
+{
+ int rc;
+
+ rc = ssh_options_set(session, SSH_OPTIONS_HOST, "localhost");
+ ck_assert(rc == 0);
+
+ rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, "nc localhost 22");
+ ck_assert(rc == 0);
+ rc = ssh_connect(session);
+ ck_assert_msg(rc== SSH_OK,ssh_get_error(session));
+}
+END_TEST
+
+START_TEST (torture_options_set_proxycommand_notexist)
+{
+ int rc;
+
+ rc = ssh_options_set(session, SSH_OPTIONS_HOST, "localhost");
+ ck_assert(rc == 0);
+
+ rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, "this_command_does_not_exist");
+ ck_assert(rc == SSH_OK);
+ rc = ssh_connect(session);
+ ck_assert_msg(rc== SSH_ERROR);
+}
+END_TEST
+
+Suite *torture_make_suite(void) {
+ Suite *s = suite_create("libssh_proxycommand");
+
+ torture_create_case_fixture(s, "torture_options_set_proxycommand",
+ torture_options_set_proxycommand, setup, teardown);
+ torture_create_case_fixture(s, "torture_options_set_proxycommand_notexist",
+ torture_options_set_proxycommand_notexist, setup, teardown);
+
+
+ return s;
+}