aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2017-11-16 17:21:23 +0100
committerAndreas Schneider <asn@cryptomilk.org>2017-12-21 11:43:19 +0100
commit53d84abb17137e281485ca3e7d9931ca4b4d1c09 (patch)
tree628fe907bf06d96869fce986a1b0f053d960a995
parentdab8985c05b7323b91ad0cff4016c8b865d5af67 (diff)
downloadlibssh-53d84abb17137e281485ca3e7d9931ca4b4d1c09.tar.gz
libssh-53d84abb17137e281485ca3e7d9931ca4b4d1c09.tar.xz
libssh-53d84abb17137e281485ca3e7d9931ca4b4d1c09.zip
tests/config: Newly parsed options
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--tests/unittests/torture_config.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/unittests/torture_config.c b/tests/unittests/torture_config.c
index e603d4c9..f4f592ef 100644
--- a/tests/unittests/torture_config.c
+++ b/tests/unittests/torture_config.c
@@ -24,6 +24,7 @@
#define MACS "hmac-sha1,hmac-sha2-256"
#define USER_KNOWN_HOSTS "%d/my_known_hosts"
#define GLOBAL_KNOWN_HOSTS "/etc/ssh/my_ssh_known_hosts"
+#define BIND_ADDRESS "::1"
static int setup_config_files(void **state)
{
@@ -60,7 +61,10 @@ static int setup_config_files(void **state)
torture_write_file(LIBSSH_TESTCONFIG6,
"ProxyCommand "PROXYCMD"\n\n");
+ /* new options */
torture_write_file(LIBSSH_TESTCONFIG7,
+ "\tBindAddress "BIND_ADDRESS"\n"
+ "\tConnectTimeout 30\n"
"\tGlobalKnownHostsFile "GLOBAL_KNOWN_HOSTS"\n"
"\tUserKnownHostsFile "USER_KNOWN_HOSTS"\n");
@@ -182,9 +186,10 @@ static void torture_config_glob(void **state) {
}
/**
- * @brief Verify the known host files are passed from configuration
+ * @brief Verify the new options are passed from configuration
*/
-static void torture_config_known_hosts(void **state) {
+static void torture_config_new(void **state)
+{
ssh_session session = *state;
int ret = 0;
@@ -193,6 +198,8 @@ static void torture_config_known_hosts(void **state) {
assert_string_equal(session->opts.knownhosts, USER_KNOWN_HOSTS);
assert_string_equal(session->opts.global_knownhosts, GLOBAL_KNOWN_HOSTS);
+ assert_int_equal(session->opts.timeout, 30);
+ assert_string_equal(session->opts.bindaddr, BIND_ADDRESS);
}
/**
@@ -262,7 +269,7 @@ int torture_run_tests(void) {
cmocka_unit_test_setup_teardown(torture_config_glob,
setup_config_files,
teardown),
- cmocka_unit_test_setup_teardown(torture_config_known_hosts,
+ cmocka_unit_test_setup_teardown(torture_config_new,
setup_config_files,
teardown),
cmocka_unit_test_setup_teardown(torture_config_auth_methods,