From 7e44ce155639a89e261a61de06f16fbe92898a6a Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Mon, 29 Oct 2018 16:25:20 +0100 Subject: [PATCH] tests: Improve error reporting in auth test Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider --- tests/client/torture_auth.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/client/torture_auth.c b/tests/client/torture_auth.c index 77405d06..3cb014fc 100644 --- a/tests/client/torture_auth.c +++ b/tests/client/torture_auth.c @@ -232,7 +232,7 @@ static void torture_auth_none_nonblocking(void **state) { /* This request should return a SSH_REQUEST_DENIED error */ if (rc == SSH_ERROR) { - assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED); + assert_int_equal(ssh_get_error_code(session), SSH_REQUEST_DENIED); } ssh_set_blocking(session,0); @@ -241,7 +241,7 @@ static void torture_auth_none_nonblocking(void **state) { rc = ssh_userauth_none(session,NULL); } while (rc == SSH_AUTH_AGAIN); assert_int_equal(rc, SSH_AUTH_DENIED); - assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED); + assert_int_equal(ssh_get_error_code(session), SSH_REQUEST_DENIED); } @@ -260,7 +260,7 @@ static void torture_auth_autopubkey(void **state) { rc = ssh_userauth_none(session,NULL); /* This request should return a SSH_REQUEST_DENIED error */ if (rc == SSH_ERROR) { - assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED); + assert_int_equal(ssh_get_error_code(session), SSH_REQUEST_DENIED); } rc = ssh_userauth_list(session, NULL); assert_true(rc & SSH_AUTH_METHOD_PUBLICKEY); @@ -313,7 +313,7 @@ static void torture_auth_kbdint(void **state) { rc = ssh_userauth_none(session,NULL); /* This request should return a SSH_REQUEST_DENIED error */ if (rc == SSH_ERROR) { - assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED); + assert_int_equal(ssh_get_error_code(session), SSH_REQUEST_DENIED); } rc = ssh_userauth_list(session, NULL); assert_true(rc & SSH_AUTH_METHOD_INTERACTIVE); @@ -352,7 +352,7 @@ static void torture_auth_kbdint_nonblocking(void **state) { /* This request should return a SSH_REQUEST_DENIED error */ if (rc == SSH_ERROR) { - assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED); + assert_int_equal(ssh_get_error_code(session), SSH_REQUEST_DENIED); } rc = ssh_userauth_list(session, NULL); assert_true(rc & SSH_AUTH_METHOD_INTERACTIVE); @@ -392,7 +392,7 @@ static void torture_auth_password(void **state) { rc = ssh_userauth_none(session, NULL); /* This request should return a SSH_REQUEST_DENIED error */ if (rc == SSH_AUTH_ERROR) { - assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED); + assert_int_equal(ssh_get_error_code(session), SSH_REQUEST_DENIED); } rc = ssh_userauth_list(session, NULL); assert_true(rc & SSH_AUTH_METHOD_PASSWORD); @@ -419,7 +419,7 @@ static void torture_auth_password_nonblocking(void **state) { /* This request should return a SSH_REQUEST_DENIED error */ if (rc == SSH_AUTH_ERROR) { - assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED); + assert_int_equal(ssh_get_error_code(session), SSH_REQUEST_DENIED); } rc = ssh_userauth_list(session, NULL); @@ -450,7 +450,7 @@ static void torture_auth_agent(void **state) { rc = ssh_userauth_none(session,NULL); /* This request should return a SSH_REQUEST_DENIED error */ if (rc == SSH_ERROR) { - assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED); + assert_int_equal(ssh_get_error_code(session), SSH_REQUEST_DENIED); } rc = ssh_userauth_list(session, NULL); assert_true(rc & SSH_AUTH_METHOD_PUBLICKEY); @@ -477,7 +477,7 @@ static void torture_auth_agent_nonblocking(void **state) { rc = ssh_userauth_none(session,NULL); /* This request should return a SSH_REQUEST_DENIED error */ if (rc == SSH_ERROR) { - assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED); + assert_int_equal(ssh_get_error_code(session), SSH_REQUEST_DENIED); } rc = ssh_userauth_list(session, NULL); assert_true(rc & SSH_AUTH_METHOD_PUBLICKEY); @@ -562,7 +562,7 @@ static void torture_auth_pubkey_types(void **state) rc = ssh_userauth_none(session, NULL); /* This request should return a SSH_REQUEST_DENIED error */ if (rc == SSH_ERROR) { - assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED); + assert_int_equal(ssh_get_error_code(session), SSH_REQUEST_DENIED); } rc = ssh_userauth_list(session, NULL); assert_true(rc & SSH_AUTH_METHOD_PUBLICKEY); @@ -599,7 +599,7 @@ static void torture_auth_pubkey_types_ecdsa(void **state) rc = ssh_userauth_none(session, NULL); /* This request should return a SSH_REQUEST_DENIED error */ if (rc == SSH_ERROR) { - assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED); + assert_int_equal(ssh_get_error_code(session), SSH_REQUEST_DENIED); } rc = ssh_userauth_list(session, NULL); assert_true(rc & SSH_AUTH_METHOD_PUBLICKEY); @@ -637,7 +637,7 @@ static void torture_auth_pubkey_types_ed25519(void **state) rc = ssh_userauth_none(session, NULL); /* This request should return a SSH_REQUEST_DENIED error */ if (rc == SSH_ERROR) { - assert_true(ssh_get_error_code(session) == SSH_REQUEST_DENIED); + assert_int_equal(ssh_get_error_code(session), SSH_REQUEST_DENIED); } rc = ssh_userauth_list(session, NULL); assert_true(rc & SSH_AUTH_METHOD_PUBLICKEY);