CAPI tests adjusted to new password logic
[platform/core/test/security-tests.git] / tests / ckm / main.cpp
index ea39738..53ed8dc 100644 (file)
@@ -248,23 +248,23 @@ RUNNER_TEST(T1014_save_with_label)
     CharPtr top_label = get_label();
     std::string full_address = aliasWithLabel(top_label.get(), alias.c_str());
 
-    RUNNER_ASSERT_MSG_BT(
+    RUNNER_ASSERT_MSG(
         CKM_API_SUCCESS == (temp = manager->saveKey(full_address, key, CKM::Policy())),
         "Error=" << CKM::ErrorToString(temp));
 
     // lookup by name
-    RUNNER_ASSERT_MSG_BT(
+    RUNNER_ASSERT_MSG(
         CKM_API_SUCCESS == (temp = manager->getKey(alias, CKM::Password(), key_name)),
         "Error=" << CKM::ErrorToString(temp));
-    RUNNER_ASSERT_MSG_BT(
+    RUNNER_ASSERT_MSG(
         key->getDER() == key_name->getDER(),
         "Key value has been changed by service");
 
     // lookup by full address
-    RUNNER_ASSERT_MSG_BT(
+    RUNNER_ASSERT_MSG(
         CKM_API_SUCCESS == (temp = manager->getKey(full_address, CKM::Password(), key_full_addr)),
         "Error=" << CKM::ErrorToString(temp));
-    RUNNER_ASSERT_MSG_BT(
+    RUNNER_ASSERT_MSG(
         key->getDER() == key_full_addr->getDER(),
         "Key value has been changed by service");
 }
@@ -622,10 +622,10 @@ RUNNER_CHILD_TEST(T1042_create_rsa_key_foreign_label)
     ap.allowAPI("key-manager::api-storage", "rw");
     ap.applyAndSwithToUser(USER_APP, GROUP_APP);
 
-    RUNNER_ASSERT_MSG_BT(
+    RUNNER_ASSERT_MSG(
         CKM_API_ERROR_ACCESS_DENIED == (temp = manager->createKeyPairRSA(2048, CKM::Alias("iamsomebodyelse PRV_KEY2_RSA"), CKM::Alias("PUB_KEY2_RSA"), CKM::Policy(), CKM::Policy())),
         "Error=" << CKM::ErrorToString(temp));
-    RUNNER_ASSERT_MSG_BT(
+    RUNNER_ASSERT_MSG(
         CKM_API_ERROR_ACCESS_DENIED == (temp = manager->createKeyPairRSA(2048, CKM::Alias("PRV_KEY2_RSA"), CKM::Alias("iamsomebodyelse PUB_KEY2_RSA"), CKM::Policy(), CKM::Policy())),
         "Error=" << CKM::ErrorToString(temp));
 }
@@ -824,7 +824,7 @@ RUNNER_TEST(T12103_saveKey_foreign_label)
 
     int ret;
     auto manager = CKM::Manager::create();
-    RUNNER_ASSERT_MSG_BT(
+    RUNNER_ASSERT_MSG(
         CKM_API_ERROR_ACCESS_DENIED == (ret = manager->saveKey(alias, key, CKM::Policy())),
         "Error=" << CKM::ErrorToString(ret));
 }
@@ -920,7 +920,7 @@ RUNNER_TEST(T12106_saveCertificate_foreign_label)
 
     int temp;
     auto manager = CKM::Manager::create();
-    RUNNER_ASSERT_MSG_BT(
+    RUNNER_ASSERT_MSG(
         CKM_API_ERROR_ACCESS_DENIED == (temp = manager->saveCertificate(alias, cert, CKM::Policy())),
         "Error=" << CKM::ErrorToString(temp));
 }
@@ -958,7 +958,7 @@ RUNNER_TEST(T12109_saveData_foreign_label)
 
     int temp;
     auto manager = CKM::Manager::create();
-    RUNNER_ASSERT_MSG_BT(
+    RUNNER_ASSERT_MSG(
         CKM_API_ERROR_ACCESS_DENIED == (temp = manager->saveData(alias, buffer, CKM::Policy())),
         "Error=" << CKM::ErrorToString(temp));
 }
@@ -2698,9 +2698,13 @@ RUNNER_CHILD_TEST(T1612_init_change_user_password)
     RUNNER_ASSERT_MSG(
         CKM_API_SUCCESS == (tmp = control->changeUserPassword(USER_APP,"","user-pass")),
         "Error=" << CKM::ErrorToString(tmp));
+    // confirm changed password
+    RUNNER_ASSERT_MSG(
+        CKM_API_SUCCESS == (tmp = control->unlockUserKey(USER_APP,"user-pass")),
+        CKM::ErrorToString(tmp));
     RUNNER_ASSERT_MSG(
         CKM_API_SUCCESS == (tmp = control->lockUserKey(USER_APP)),
-        "Error=" << CKM::ErrorToString(tmp));
+        CKM::ErrorToString(tmp));
 }
 
 RUNNER_CHILD_TEST(T1613_unlock_default_passwd_negative)