From: Damian Chromejko Date: Fri, 6 Dec 2013 14:44:22 +0000 (+0100) Subject: Add new test cases for security-server password API. X-Git-Tag: security-manager_5.5_testing~306 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd5d2d11c7566b4062417b7e252cff6f3b8c9f50;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git Add new test cases for security-server password API. [Issue#] SSDWSSP-707 [Feature/Buf] New test case. [Cause] Checking cases not considered before. [Solution] Added a test checking if security-server behaves as required. Test tc41_security_server_empty_history_check was reworked in SSDWSSP-708 to check reusing password after limiting history because, although technically a part of this issue, it was necessary for the whole testsuite to pass. [Verification] Build, install, run tests. Change-Id: I0218d5fe411c3479140095c05942bb107fcc83df --- diff --git a/tests/security-server-tests/security_server_tests_password.cpp b/tests/security-server-tests/security_server_tests_password.cpp index d864257..a8dcfb7 100644 --- a/tests/security-server-tests/security_server_tests_password.cpp +++ b/tests/security-server-tests/security_server_tests_password.cpp @@ -1481,6 +1481,30 @@ RUNNER_TEST(tc49_security_server_no_retry_timeout_set_pwd_max_challenge) RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret); } +RUNNER_TEST(tc50_security_server_set_pwd_current_pwd_with_infinite_expiration_time) +{ + int ret; + unsigned int attempt, max_attempt, expire_sec; + + // Prepare environment + reset_security_server(); + ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10); + RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret); + usleep(PASSWORD_RETRY_TIMEOUT_US); + + // Assert security server sets infinite expiration time + ret = security_server_set_pwd(TEST_PASSWORD, SECOND_TEST_PASSWORD, 0, 0); + RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret); + usleep(PASSWORD_RETRY_TIMEOUT_US); + + ret = security_server_chk_pwd(SECOND_TEST_PASSWORD, &attempt, &max_attempt, &expire_sec); + RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret); + RUNNER_ASSERT_MSG((time_t) expire_sec == PASSWORD_INFINITE_EXPIRATION_TIME, + "invalid expiration time " << expire_sec); + + clean_password_dir(); +} + int main(int argc, char *argv[]) { SummaryCollector::Register();