Test for app_add_friend() changed - friends should be made even with nonexisting...
authorMarcin Niesluchowski <m.niesluchow@samsung.com>
Tue, 14 May 2013 16:17:00 +0000 (18:17 +0200)
committerMarcin Niesluchowski <m.niesluchow@samsung.com>
Thu, 23 Jan 2014 13:32:20 +0000 (14:32 +0100)
[Issue#]        SSDWSSP-260
[Bug/Feature]   Fix libprivilege-control tests
[Cause]         N/A
[Solution]      N/A
[Verification]  Run privilege_control11_app_enable_permissions and privilege_control14_app_add_friend libprivilege-control tests (should pass)

Change-Id: I6d893de9e5060e69f8a851cd9791644e228770a9

tests/libprivilege-control-tests/test_cases.cpp

index 688c6f7..cb7bd74 100644 (file)
@@ -1088,7 +1088,7 @@ RUNNER_TEST(privilege_control11_app_enable_permissions)
     fseek(pFile, 0L, SEEK_END);
     smack_file_length = ftell(pFile);
     RUNNER_ASSERT_MSG(smack_file_length>0,
-            "SMACK file empty, but privileges list was not empty.. Errno: " << errno);
+            "SMACK file empty with persistant mode 1. Errno: " << errno);
 
     if (pFile != NULL)
         fclose(pFile);
@@ -1112,8 +1112,17 @@ RUNNER_TEST(privilege_control11_app_enable_permissions)
 
     //// File exists?
     pFile = fopen(SMACK_RULES_DIR APP_ID, "rb");
-    RUNNER_ASSERT_MSG(pFile==NULL,
-            "SMACK file created!.");
+    RUNNER_ASSERT_MSG(pFile != NULL,
+            "SMACK file NOT created!. Errno: " << errno);
+
+    //// Is it empty?
+    fseek(pFile, 0L, SEEK_END);
+    smack_file_length = ftell(pFile);
+    RUNNER_ASSERT_MSG(smack_file_length==0,
+            "SMACK file not empty with persistant mode 0. Errno: " << errno);
+
+    if (pFile != NULL)
+        fclose(pFile);
 
     // Clean up
     result = app_revoke_permissions(APP_ID);
@@ -1141,7 +1150,7 @@ RUNNER_TEST(privilege_control11_app_enable_permissions)
     fseek(pFile, 0L, SEEK_END);
     smack_file_length = ftell(pFile);
     RUNNER_ASSERT_MSG(smack_file_length>0,
-            "SMACK file empty, but privileges list was not empty.. Errno: " << errno);
+            "SMACK file empty with persistant mode 1. Errno: " << errno);
 
     if (pFile != NULL)
         fclose(pFile);
@@ -1173,7 +1182,7 @@ RUNNER_TEST(privilege_control11_app_enable_permissions)
     fseek(pFile, 0L, SEEK_END);
     smack_file_length = ftell(pFile);
     RUNNER_ASSERT_MSG(smack_file_length>0,
-            "SMACK file empty, but privileges list was not empty.. Errno: " << errno);
+            "SMACK file empty with persistant mode 1. Errno: " << errno);
 
     if (pFile != NULL)
         fclose(pFile);
@@ -1214,7 +1223,7 @@ RUNNER_TEST(privilege_control11_app_enable_permissions)
     fseek(pFile, 0L, SEEK_END);
     smack_file_length = ftell(pFile);
     RUNNER_ASSERT_MSG(smack_file_length>0,
-            "SMACK file empty, but privileges list was not empty.. Errno: " << errno);
+            "SMACK file empty with persistant mode 1. Errno: " << errno);
 
     if (pFile != NULL)
         fclose(pFile);
@@ -1427,13 +1436,13 @@ RUNNER_TEST(privilege_control14_app_add_friend)
 
     // Adding imaginairy friend as second
     result = app_add_friend(APP_FRIEND_1, APP_FRIEND_2);
-    RUNNER_ASSERT_MSG(result != PC_OPERATION_SUCCESS,
-        " Error making friends (first) with imaginairy friend succeeded. Result: "
+    RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+        " Error making friends (first) with imaginairy friend failed. Result: "
         << result);
     // Adding imaginairy friend as first
     result = app_add_friend(APP_FRIEND_2, APP_FRIEND_1);
-    RUNNER_ASSERT_MSG(result != PC_OPERATION_SUCCESS,
-        " Error making friends (second) with imaginairy friend succeeded. Result: "
+    RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+        " Error making friends (second) with imaginairy friend failed. Result: "
         << result);
     // Clean up
     result = app_revoke_permissions(APP_FRIEND_1);