Update cc-mode tests with "Ready" setting
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 20 Jan 2015 11:23:53 +0000 (12:23 +0100)
committerMaciej J. Karpiuk <m.karpiuk2@samsung.com>
Wed, 18 Feb 2015 09:40:44 +0000 (10:40 +0100)
[Issue#] N/A
[Feature/Bug] N/A
[Problem] "Ready" mode is not tested
[Cause] N/A
[Solution] Tests updated

[Verification] Run cc-mode tests

Change-Id: I16a86d9d10b5cef3ebbbd0880f981ef43b0ae6bc

tests/ckm/cc-mode.cpp

index 3d62a54..dd79f1d 100644 (file)
@@ -51,6 +51,7 @@ const size_t MAX_RETRIES = 50;
 const char* const ENABLED = "Enabled";
 const char* const ENFORCING = "Enforcing";
 const char* const DISABLED = "Disabled";
+const char* const READY = "Ready";
 
 const char* const CKM_LOCK = "/var/run/key-manager.pid";
 
@@ -198,6 +199,9 @@ RUNNER_TEST(TCC_0010_updateCCMode)
     mdpp.set(DISABLED);
     update_cc_mode();
 
+    mdpp.set(READY);
+    update_cc_mode();
+
     mdpp.set("whatever");
     update_cc_mode();
 }
@@ -234,6 +238,10 @@ RUNNER_TEST(TCC_0020_noListener)
     update_cc_mode();
     read_keys(CKM_API_ERROR_BAD_REQUEST);
 
+    mdpp.set(READY);
+    update_cc_mode();
+    read_keys(CKM_API_SUCCESS);
+
     mdpp.set("whatever");
     update_cc_mode();
     read_keys(CKM_API_SUCCESS);
@@ -290,6 +298,10 @@ RUNNER_TEST(TCC_0040_callbackRegistered)
     usleep(SLEEP); // give some time for notification to reach ckm
     read_keys(CKM_API_ERROR_BAD_REQUEST);
 
+    mdpp.set(READY);
+    usleep(SLEEP); // give some time for notification to reach ckm
+    read_keys(CKM_API_SUCCESS);
+
     mdpp.set(ENFORCING);
     usleep(SLEEP); // give some time for notification to reach ckm
     read_keys(CKM_API_ERROR_BAD_REQUEST);
@@ -330,6 +342,16 @@ RUNNER_TEST(TCC_0070_manualCkmEnforcing)
 }
 
 // run ckm manually and see if it properly loads mdpp setting
+RUNNER_TEST(TCC_0075_manualCkmReady)
+{
+    restart_ckm(READY);
+
+    remove_user_data();
+    save_keys();
+    read_keys(CKM_API_SUCCESS);
+}
+
+// run ckm manually and see if it properly loads mdpp setting
 RUNNER_TEST(TCC_0080_manualCkmWhatever)
 {
     restart_ckm("whatever");