2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file temp_test_user.cpp
19 * @author Jan Cybulski (j.cybulski@partner.samsung.com)
21 * @brief File with class for users management
25 #include <temp_test_user.h>
26 #include <glib-object.h>
27 #include <dpl/test/test_runner.h>
29 void TemporaryTestUser::create(void)
35 m_guser = gum_user_create_sync (m_offline);
36 RUNNER_ASSERT_MSG(m_guser != nullptr, "Failed to create gumd user object");
37 g_object_set(G_OBJECT(m_guser), "usertype", m_userType, NULL);
38 g_object_set(G_OBJECT(m_guser), "username", m_userName.c_str(), NULL);
39 gboolean added = gum_user_add_sync(m_guser);
40 RUNNER_ASSERT_MSG(added, "Failed to add user");
41 g_object_get(G_OBJECT(m_guser), "uid", &m_uid, NULL);
42 RUNNER_ASSERT_MSG(m_uid != 0, "Something strange happened during user creation. uid == 0.");
43 g_object_get(G_OBJECT(m_guser), "gid", &m_gid, NULL);
44 RUNNER_ASSERT_MSG(m_gid != 0, "Something strange happened during user creation. gid == 0.");
47 void TemporaryTestUser::remove(void)
50 gum_user_delete_sync(m_guser, TRUE);
51 g_object_unref(m_guser);
56 TemporaryTestUser::~TemporaryTestUser()