From 09a72376bf1e4fd38cb9899b84a7094cc7f74ecd Mon Sep 17 00:00:00 2001 From: Bartlomiej Grzelewski Date: Tue, 10 Feb 2015 16:33:40 +0100 Subject: [PATCH 1/1] CKM: Fix Control::restUserPassword test. resetUserPassword will work if no key exists for the user. Change-Id: Idc5080dc48e3e965c4af791f86572d2897ee7a43 --- tests/ckm/main.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/ckm/main.cpp b/tests/ckm/main.cpp index 23f8157..a06ea1c 100644 --- a/tests/ckm/main.cpp +++ b/tests/ckm/main.cpp @@ -102,8 +102,32 @@ RUNNER_TEST(T0014_Control) { int temp; auto control = CKM::Control::create(); - RUNNER_ASSERT_MSG( - CKM_API_ERROR_BAD_REQUEST == (temp = control->resetUserPassword(14, "simple-password")), + RUNNER_ASSERT_MSG_BT( + CKM_API_SUCCESS == (temp = control->removeUserData(14)), + "Error=" << CKM::ErrorToString(temp)); + + RUNNER_ASSERT_MSG_BT( + CKM_API_SUCCESS == (temp = control->resetUserPassword(14, "simple-password")), + "Error=" << CKM::ErrorToString(temp)); + + RUNNER_ASSERT_MSG_BT( + CKM_API_SUCCESS == (temp = control->resetUserPassword(14, "something")), + "Error=" << CKM::ErrorToString(temp)); + + RUNNER_ASSERT_MSG_BT( + CKM_API_SUCCESS == (temp = control->unlockUserKey(14, "test-pass")), + "Error=" << CKM::ErrorToString(temp)); + + RUNNER_ASSERT_MSG_BT( + CKM_API_SUCCESS == (temp = control->lockUserKey(14)), + "Error=" << CKM::ErrorToString(temp)); + + RUNNER_ASSERT_MSG_BT( + CKM_API_ERROR_BAD_REQUEST == (temp = control->resetUserPassword(14, "something")), + "Error=" << CKM::ErrorToString(temp)); + + RUNNER_ASSERT_MSG_BT( + CKM_API_SUCCESS == (temp = control->removeUserData(14)), "Error=" << CKM::ErrorToString(temp)); } -- 2.7.4