From: Marcin Niesluchowski Date: Thu, 3 Apr 2014 09:18:54 +0000 (+0200) Subject: Remove unnecessary verify_chk_pwd_basic function. X-Git-Tag: security-manager_5.5_testing~255 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F74%2F18974%2F2;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git Remove unnecessary verify_chk_pwd_basic function. Verification: -> security-tests.sh ss-password --output=text --runignored (no changes) Change-Id: I804a3fc1d63da369eb155f7f776b9ac104542fbd --- diff --git a/tests/security-server-tests/security_server_tests_password.cpp b/tests/security-server-tests/security_server_tests_password.cpp index 8520793..7c95cfe 100644 --- a/tests/security-server-tests/security_server_tests_password.cpp +++ b/tests/security-server-tests/security_server_tests_password.cpp @@ -850,20 +850,19 @@ RUNNER_TEST(tc33_security_server_reset_by_null_pwd) /* * Use this instead of security_server_chk_pwd directly to verify the function output. * For example: - * verify_chk_pwd(__LINE__, "password", SECURITY_SERVER_API_SUCCESS, 2, 5, 10000, "debug string") + * verify_chk_pwd("password", SECURITY_SERVER_API_SUCCESS, 2, 5, "debug string") */ -void verify_chk_pwd_basic( +void verify_chk_pwd ( const char* challenge, int expected_result, unsigned int expected_current_attempt, unsigned int expected_max_attempt, - unsigned int expected_valid_secs, - const std::string &info) + const std::string &info = std::string()) { /* ensure that initial values differ from expected ones */ unsigned int attempt = expected_current_attempt - 1; unsigned int max_attempt = expected_max_attempt - 1; - unsigned int expire_sec = expected_valid_secs - 1; + unsigned int expire_sec = PASSWORD_INFINITE_EXPIRATION_TIME - 1; usleep(PASSWORD_RETRY_TIMEOUT_US); int ret = security_server_chk_pwd(challenge, &attempt, &max_attempt, &expire_sec); @@ -883,41 +882,11 @@ void verify_chk_pwd_basic( info << "security_server_chk_pwd returned max_attempt = " << max_attempt << " (expected: " << expected_max_attempt << ")"); - // validate expire seconds - if (expected_valid_secs == PASSWORD_INFINITE_EXPIRATION_TIME) { - RUNNER_ASSERT_MSG_BT(expire_sec == expected_valid_secs, - info << "security_server_chk_pwd returned expire_sec = " << expire_sec << - " (expected: " << expected_valid_secs << ")"); - } else { - // because of sleeps in test code we need to check period of time. - unsigned int begin = expected_valid_secs > 5 ? expected_valid_secs - 5 : 0; - unsigned int end = expected_valid_secs + 5; - - RUNNER_ASSERT_MSG_BT(expire_sec >= begin && expire_sec <= end, - info << "security_server_chk_pwd returned expire_sec = " << expire_sec << - " (expected: <" << begin << "," << end << ")"); - } -} - -/* This function is required because we cannot use default value in expected_valid_secs in - * verify_chk_pwd_basic and define Tracker at the same time. */ -void verify_chk_pwd( - const char *challenge, - int expected_result, - unsigned int expected_current_attempt, - unsigned int expected_max_attempt, - const std::string &info = std::string()) -{ - verify_chk_pwd_basic( - challenge, - expected_result, - expected_current_attempt, - expected_max_attempt, - PASSWORD_INFINITE_EXPIRATION_TIME, - info); + RUNNER_ASSERT_MSG_BT(expire_sec == PASSWORD_INFINITE_EXPIRATION_TIME, + info << "security_server_chk_pwd returned expire_sec = " << expire_sec << + " (expected: " << PASSWORD_INFINITE_EXPIRATION_TIME << ")"); } - /** * Reach last attempt few times in a row (before exceeding max_attempt). */