Add wrappers for user add and delete API 53/32353/7
authorMichal Eljasiewicz <m.eljasiewic@samsung.com>
Wed, 17 Dec 2014 10:21:14 +0000 (11:21 +0100)
committerJan Cybulski <j.cybulski@samsung.com>
Mon, 12 Jan 2015 11:05:41 +0000 (12:05 +0100)
Change-Id: Ia7f087fec2f042492ab08ca08b7bbba20d90795d
Signed-off-by: Michal Eljasiewicz <m.eljasiewic@samsung.com>
tests/security-manager-tests/common/sm_api.cpp
tests/security-manager-tests/common/sm_api.h

index 7ffe85b..6fc59ee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
  *    you may not use this file except in compliance with the License.
@@ -99,6 +99,26 @@ void prepareApp(const char *appId, lib_retcode expectedResult)
                           << " Expected result: " << expectedResult);
 }
 
+void addUser(const UserRequest &request, lib_retcode expectedResult)
+{
+    int result = security_manager_user_add(request.get());
+    RUNNER_ASSERT_MSG((lib_retcode)result == expectedResult,
+                      "adding user returned wrong value."
+                          << " UserRequest: [ " << request << "];"
+                          << " Result: " << result << ";"
+                          << " Expected result: " << expectedResult);
+}
+
+void deleteUser(const UserRequest &request, lib_retcode expectedResult)
+{
+    int result = security_manager_user_delete(request.get());
+    RUNNER_ASSERT_MSG((lib_retcode)result == expectedResult,
+                      "deleting user returned wrong value."
+                          << " UserRequest: [ " << request << "];"
+                          << " Result: " << result << ";"
+                          << " Expected result: " << expectedResult);
+}
+
 } // namespace Api
 
 } // namespace SecurityManagerTest
index 49e4088..a5f5921 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
  *    you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
 #define SECURITY_MANAGER_TEST_API
 
 #include <sm_request.h>
+#include <sm_user_request.h>
 
 #include <security-manager.h>
 
@@ -32,6 +33,8 @@ void setProcessLabel(const char *appId, lib_retcode expectedResult = SECURITY_MA
 void setProcessGroups(const char *appId, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
 void dropProcessPrivileges(lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
 void prepareApp(const char *appId, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
+void addUser(const UserRequest &request, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
+void deleteUser(const UserRequest &request, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS);
 
 } // namespace Api