diff --git a/services/ipc/src/user_auth_service.cpp b/services/ipc/src/user_auth_service.cpp index 727d4ab3d520d5f31bb2a52c5488ac478409d88e..884452846154f9b85d975223b6a51c555f11fa61 100644 --- a/services/ipc/src/user_auth_service.cpp +++ b/services/ipc/src/user_auth_service.cpp @@ -294,7 +294,7 @@ int32_t UserAuthService::GetPropertyInner(AuthType authType, const std::vectorOnGetExecutorPropertyResult(GENERAL_ERROR, values.Serialize()); - return GENERAL_ERROR; + return SUCCESS; } std::vector uint32Keys; @@ -311,7 +311,7 @@ int32_t UserAuthService::GetPropertyInner(AuthType authType, const std::vectorOnGetExecutorPropertyResult(result, values.Serialize()); - return result; + return SUCCESS; } int32_t UserAuthService::GetProperty(int32_t userId, int32_t authType, @@ -325,7 +325,7 @@ int32_t UserAuthService::GetProperty(int32_t userId, int32_t authType, if (!IpcCommon::CheckPermission(*this, ACCESS_USER_AUTH_INTERNAL_PERMISSION)) { IAM_LOGE("failed to check permission"); getExecutorPropertyCallback->OnGetExecutorPropertyResult(CHECK_PERMISSION_FAILED, values.Serialize()); - return CHECK_PERMISSION_FAILED; + return SUCCESS; } std::vector attrKeys; @@ -340,7 +340,7 @@ int32_t UserAuthService::GetProperty(int32_t userId, int32_t authType, IAM_LOGE("get templates fail, ret:%{public}d, userId:%{public}d, authType:%{public}d", ret, userId, authType); getExecutorPropertyCallback->OnGetExecutorPropertyResult(GENERAL_ERROR, values.Serialize()); - return ret; + return SUCCESS; } if (templateIds.size() == 0) { IAM_LOGE("template id list is required, but templateIds size is 0"); @@ -363,7 +363,7 @@ int32_t UserAuthService::GetPropertyById(uint64_t credentialId, const std::vecto if (!IpcCommon::CheckPermission(*this, ACCESS_USER_AUTH_INTERNAL_PERMISSION)) { IAM_LOGE("failed to check permission"); getExecutorPropertyCallback->OnGetExecutorPropertyResult(CHECK_PERMISSION_FAILED, values.Serialize()); - return CHECK_PERMISSION_FAILED; + return SUCCESS; } std::shared_ptr credInfo; @@ -372,7 +372,7 @@ int32_t UserAuthService::GetPropertyById(uint64_t credentialId, const std::vecto if (ret != SUCCESS) { IAM_LOGE("get credentialInfp fail, ret:%{public}d", ret); getExecutorPropertyCallback->OnGetExecutorPropertyResult(ret, values.Serialize()); - return ret; + return SUCCESS; } if (credInfo == nullptr) { IAM_LOGE("credential is nullptr"); diff --git a/test/unittest/services/src/user_auth_service_test_part01.cpp b/test/unittest/services/src/user_auth_service_test_part01.cpp index 7e581819d35f294a154165105390a9018152bd55..6adf70284908565cb6e76e34336ab9787b63b97f 100644 --- a/test/unittest/services/src/user_auth_service_test_part01.cpp +++ b/test/unittest/services/src/user_auth_service_test_part01.cpp @@ -282,7 +282,7 @@ HWTEST_F(UserAuthServiceTest, UserAuthServiceGetProperty001, TestSize.Level0) EXPECT_CALL(*testCallback, OnGetExecutorPropertyResult(_, _)).Times(2); sptr callbackInterface = testCallback; int32_t ret = service.GetProperty(testUserId, testAuthType, testKeys, callbackInterface); - EXPECT_EQ(ret, CHECK_PERMISSION_FAILED); + EXPECT_EQ(ret, SUCCESS); IpcCommon::AddPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION); ret = service.GetProperty(testUserId, testAuthType, testKeys, callbackInterface); EXPECT_EQ(ret, SUCCESS); @@ -332,9 +332,9 @@ HWTEST_F(UserAuthServiceTest, UserAuthServiceGetProperty002, TestSize.Level0) IpcCommon::AddPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION); callbackInterface = testCallback; ret = service.GetProperty(testUserId, testAuthType, testKeys, callbackInterface); - EXPECT_EQ(ret, GENERAL_ERROR); + EXPECT_EQ(ret, SUCCESS); ret = service.GetProperty(testUserId, testAuthType, testKeys, callbackInterface); - EXPECT_EQ(ret, GENERAL_ERROR); + EXPECT_EQ(ret, SUCCESS); EXPECT_TRUE(ResourceNodePool::Instance().Delete(2)); IpcCommon::DeleteAllPermission(); } @@ -374,9 +374,9 @@ HWTEST_F(UserAuthServiceTest, UserAuthServiceGetProperty003, TestSize.Level0) IpcCommon::AddPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION); callbackInterface = testCallback; ret = service.GetProperty(testUserId, testAuthType, testKeys, callbackInterface); - EXPECT_EQ(ret, GENERAL_ERROR); + EXPECT_EQ(ret, SUCCESS); ret = service.GetProperty(testUserId, testAuthType, testKeys, callbackInterface); - EXPECT_EQ(ret, GENERAL_ERROR); + EXPECT_EQ(ret, SUCCESS); EXPECT_TRUE(ResourceNodePool::Instance().Delete(2)); IpcCommon::DeleteAllPermission(); } @@ -424,9 +424,9 @@ HWTEST_F(UserAuthServiceTest, UserAuthServiceGetProperty004, TestSize.Level0) IpcCommon::AddPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION); callbackInterface = testCallback; ret = service.GetProperty(testUserId, testAuthType, testKeys, callbackInterface); - EXPECT_EQ(ret, GENERAL_ERROR); + EXPECT_EQ(ret, SUCCESS); ret = service.GetProperty(testUserId, testAuthType, testKeys, callbackInterface); - EXPECT_EQ(ret, GENERAL_ERROR); + EXPECT_EQ(ret, SUCCESS); EXPECT_TRUE(ResourceNodePool::Instance().Delete(2)); IpcCommon::DeleteAllPermission(); } @@ -474,7 +474,7 @@ HWTEST_F(UserAuthServiceTest, UserAuthServiceGetProperty005, TestSize.Level0) IpcCommon::AddPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION); callbackInterface = testCallback; ret = service.GetProperty(testUserId, testAuthType, testKeys, callbackInterface); - EXPECT_EQ(ret, FAIL); + EXPECT_EQ(ret, SUCCESS); EXPECT_TRUE(ResourceNodePool::Instance().Delete(2)); IpcCommon::DeleteAllPermission(); } @@ -525,7 +525,7 @@ HWTEST_F(UserAuthServiceTest, UserAuthServiceGetProperty006, TestSize.Level0) IpcCommon::AddPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION); callbackInterface = testCallback; ret = service.GetProperty(testUserId, testAuthType, testKeys, callbackInterface); - EXPECT_EQ(ret, FAIL); + EXPECT_EQ(ret, SUCCESS); EXPECT_TRUE(ResourceNodePool::Instance().Delete(2)); IpcCommon::DeleteAllPermission(); } @@ -1328,10 +1328,10 @@ HWTEST_F(UserAuthServiceTest, UserAuthServiceGetPropertyById001, TestSize.Level0 EXPECT_CALL(*testCallback, OnGetExecutorPropertyResult(_, _)).Times(2); sptr callbackInterface = testCallback; int32_t ret = service.GetPropertyById(testCredentialId, testKeys, callbackInterface); - EXPECT_EQ(ret, CHECK_PERMISSION_FAILED); + EXPECT_EQ(ret, SUCCESS); IpcCommon::AddPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION); ret = service.GetPropertyById(testCredentialId, testKeys, callbackInterface); - EXPECT_EQ(ret, GENERAL_ERROR); + EXPECT_EQ(ret, SUCCESS); IpcCommon::DeleteAllPermission(); } @@ -1377,9 +1377,9 @@ HWTEST_F(UserAuthServiceTest, UserAuthServiceGetPropertyById002, TestSize.Level0 IpcCommon::AddPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION); callbackInterface = testCallback; ret = service.GetPropertyById(testCredentialId, testKeys, callbackInterface); - EXPECT_EQ(ret, GENERAL_ERROR); + EXPECT_EQ(ret, SUCCESS); ret = service.GetPropertyById(testCredentialId, testKeys, callbackInterface); - EXPECT_EQ(ret, GENERAL_ERROR); + EXPECT_EQ(ret, SUCCESS); EXPECT_TRUE(ResourceNodePool::Instance().Delete(2)); IpcCommon::DeleteAllPermission(); } @@ -1420,7 +1420,7 @@ HWTEST_F(UserAuthServiceTest, UserAuthServiceGetPropertyById003, TestSize.Level0 IpcCommon::AddPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION); callbackInterface = testCallback; ret = service.GetPropertyById(testCredentialId, testKeys, callbackInterface); - EXPECT_EQ(ret, GENERAL_ERROR); + EXPECT_EQ(ret, SUCCESS); EXPECT_TRUE(ResourceNodePool::Instance().Delete(2)); IpcCommon::DeleteAllPermission(); } @@ -1467,7 +1467,7 @@ HWTEST_F(UserAuthServiceTest, UserAuthServiceGetPropertyById004, TestSize.Level0 IpcCommon::AddPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION); callbackInterface = testCallback; ret = service.GetPropertyById(testCredentialId, testKeys, callbackInterface); - EXPECT_EQ(ret, GENERAL_ERROR); + EXPECT_EQ(ret, SUCCESS); EXPECT_TRUE(ResourceNodePool::Instance().Delete(2)); IpcCommon::DeleteAllPermission(); } @@ -1513,7 +1513,7 @@ HWTEST_F(UserAuthServiceTest, UserAuthServiceGetPropertyById005, TestSize.Level0 IpcCommon::AddPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION); callbackInterface = testCallback; ret = service.GetPropertyById(testCredentialId, testKeys, callbackInterface); - EXPECT_EQ(ret, FAIL); + EXPECT_EQ(ret, SUCCESS); EXPECT_TRUE(ResourceNodePool::Instance().Delete(2)); IpcCommon::DeleteAllPermission(); } @@ -1563,7 +1563,7 @@ HWTEST_F(UserAuthServiceTest, UserAuthServiceGetPropertyById006, TestSize.Level0 IpcCommon::AddPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION); callbackInterface = testCallback; ret = service.GetPropertyById(testCredentialId, testKeys, callbackInterface); - EXPECT_EQ(ret, FAIL); + EXPECT_EQ(ret, SUCCESS); EXPECT_TRUE(ResourceNodePool::Instance().Delete(2)); IpcCommon::DeleteAllPermission(); }