Fix unit test's failiure 58/248558/2
authorIlho Kim <ilho159.kim@samsung.com>
Mon, 30 Nov 2020 03:04:51 +0000 (12:04 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Mon, 30 Nov 2020 03:15:42 +0000 (12:15 +0900)
In app-installers' admin user check logic, if gum_user_get_sync() return nullptr
then creation of PkgmgrInterface is failed. this patch change the mock function
of gum_user_get_sync() to return AdminUser's information

Change-Id: Iab03024f597830b32d202398cc2c297ce9a5e2d0
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
test/unit_tests/test_unified_installer_factory.cc

index 2b201e6f3995ce10a06ecd42383479fba09cff99..2e59c1d39604dfc5808a6184d7c8637ef615294a 100644 (file)
@@ -44,7 +44,12 @@ using ::testing::Return;
 
 static GumUser* __gum_user_get_sync_fake(
     uid_t, gboolean) {
-  return nullptr;
+  GumUser* user = reinterpret_cast<GumUser*>(g_object_new(GUM_TYPE_USER,
+      "offline", TRUE, NULL));
+  g_object_set(G_OBJECT(user), "username", "user_name", "usertype",
+      GUM_USERTYPE_ADMIN, NULL);
+
+  return user;
 }
 
 class Mocks : public ::testing::NiceMock<GumMock>,