Add new tests for new security-server api function
authorPawel Polawski <p.polawski@partner.samsung.com>
Mon, 15 Apr 2013 15:01:56 +0000 (17:01 +0200)
committerMarcin Niesluchowski <m.niesluchow@samsung.com>
Thu, 23 Jan 2014 13:19:16 +0000 (14:19 +0100)
[Issue#]        SSDWSSP-185
[Feature]       New security-server API
[Problem]       N/A
[Cause]         N/A
[Solution]      N/A

[Verification]  New test should not fail

Change-Id: Ie733c0b47545f874b7b7856fc479ccda204cfdbd

tests/security-server-tests/security_server_tests_server.cpp

index 955c57d..355aca6 100644 (file)
@@ -405,6 +405,22 @@ RUNNER_TEST(tc01b_security_server_app_give_access)
     RUNNER_ASSERT(0 == smack_have_access(subject, object, "----t"));
 }
 
+RUNNER_TEST(tc02_check_privilege_by_pid)
+{
+    int ret;
+    int pid;
+
+    pid = getpid();
+
+    //we checking existing rule, it should return positive
+    ret = security_server_check_privilege_by_pid(pid, "_", "rx");
+    RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+
+    //we checking rule with label that not exist
+    ret = security_server_check_privilege_by_pid(pid, "thislabelisnotreal", "rwxat");
+    RUNNER_ASSERT(ret != SECURITY_SERVER_API_SUCCESS);
+}
+
 int main(int argc, char *argv[])
 {
     server_sockfd = -1;