• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gtest/gtest.h>
17 #define private public
18 #include "account_iam_info.h"
19 #include "account_info.h"
20 #undef private
21 #include "account_log_wrapper.h"
22 #include "iam_common_defines.h"
23 #include "message_parcel.h"
24 #include "test_common.h"
25 
26 namespace OHOS {
27 namespace AccountTest {
28 
29 using namespace testing;
30 using namespace testing::ext;
31 using namespace OHOS::AccountSA;
32 namespace {
33 const int32_t TEST_USER_ID = 101;
34 const std::vector<uint8_t> TEST_CHALLENGE = {1, 2, 3, 4};
35 const int32_t TEST_TOKEN_SIZE = 4;
36 const int32_t TEST_TOKEN_PID = 5;
37 const std::string TEST_ACCOUNT_NAME = "TestAccountName";
38 const std::string TEST_NICKNAME = "NickName_Test";
39 const std::string TEST_AVATAR = "Avatar_Test";
40 const std::string TEST_ACCOUNT_UID = "123456789";
41 const std::string TEST_RAW_UID = "123456";
42 const int32_t TEST_ACCOUNT_STATUS = 0;
43 const std::string TEST_ACCOUNT_NICKNAME = TEST_NICKNAME;
44 const std::string KEY_ACCOUNT_INFO_SCALABLEDATA = "age";
45 }
46 class AccountIAMInfoTest : public testing::Test {
47 public:
48     static void SetUpTestCase(void);
49     static void TearDownTestCase(void);
50     void SetUp(void) override;
51     void TearDown(void) override;
52 };
53 
SetUpTestCase(void)54 void AccountIAMInfoTest::SetUpTestCase(void)
55 {}
56 
TearDownTestCase(void)57 void AccountIAMInfoTest::TearDownTestCase(void)
58 {}
59 
SetUp(void)60 void AccountIAMInfoTest::SetUp(void) __attribute__((no_sanitize("cfi")))
61 {
62     testing::UnitTest *test = testing::UnitTest::GetInstance();
63     EXPECT_NE(test, nullptr);
64     const testing::TestInfo *testinfo = test->current_test_info();
65     EXPECT_NE(testinfo, nullptr);
66     string testCaseName = string(testinfo->name());
67     ACCOUNT_LOGI("[SetUp] %{public}s start", testCaseName.c_str());
68 }
69 
TearDown(void)70 void AccountIAMInfoTest::TearDown(void)
71 {}
72 
73 /**
74  * @tc.name: AccountIAMInfo_WriteRemoteAuthParam_0100
75  * @tc.desc: WriteRemoteAuthParam
76  * @tc.type: FUNC
77  * @tc.require:
78  */
79 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_WriteRemoteAuthParam_0100, TestSize.Level3)
80 {
81     AccountSA::AuthParam authParam;
82     Parcel parcel;
83     EXPECT_TRUE(authParam.WriteRemoteAuthParam(parcel));
84 }
85 
86 /**
87  * @tc.name: AccountIAMInfo_WriteRemoteAuthParam_0200
88  * @tc.desc: WriteRemoteAuthParam
89  * @tc.type: FUNC
90  * @tc.require:
91  */
92 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_WriteRemoteAuthParam_0200, TestSize.Level3)
93 {
94     AccountSA::AuthParam authParam;
95     Parcel parcel;
96     std::optional<RemoteAuthParam> testremoteAuthParam = RemoteAuthParam();
97     testremoteAuthParam.value().verifierNetworkId = "verifierNetworkId";
98     testremoteAuthParam.value().collectorNetworkId = "collectorNetworkId";
99     testremoteAuthParam.value().collectorTokenId = 1;
100     authParam.remoteAuthParam = testremoteAuthParam;
101     EXPECT_NE(authParam.remoteAuthParam, std::nullopt);
102     EXPECT_EQ(authParam.remoteAuthParam.value().verifierNetworkId.value(), "verifierNetworkId");
103     EXPECT_NE(authParam.remoteAuthParam.value().verifierNetworkId, std::nullopt);
104     EXPECT_EQ(authParam.remoteAuthParam.value().collectorNetworkId.value(), "collectorNetworkId");
105     EXPECT_NE(authParam.remoteAuthParam.value().collectorNetworkId, std::nullopt);
106     EXPECT_EQ(authParam.remoteAuthParam.value().collectorTokenId.value(), 1);
107     EXPECT_NE(authParam.remoteAuthParam.value().collectorTokenId, std::nullopt);
108     EXPECT_TRUE(authParam.WriteRemoteAuthParam(parcel));
109 }
110 
111 /**
112  * @tc.name: AccountIAMInfo_Marshalling_0100
113  * @tc.desc: Marshalling
114  * @tc.type: FUNC
115  * @tc.require:
116  */
117 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_Marshalling_0100, TestSize.Level3)
118 {
119     AccountSA::AuthParam authParam;
120     Parcel parcel;
121     EXPECT_TRUE(authParam.Marshalling(parcel));
122 }
123 
124 /**
125  * @tc.name: AccountIAMInfo_Unmarshalling_0100
126  * @tc.desc: Unmarshalling
127  * @tc.type: FUNC
128  * @tc.require:
129  */
130 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_Unmarshalling_0100, TestSize.Level3)
131 {
132     AccountSA::AuthParam authParam;
133     Parcel parcel;
134     EXPECT_TRUE(authParam.Marshalling(parcel));
135     EXPECT_NE(authParam.Unmarshalling(parcel), nullptr);
136 }
137 
138 /**
139  * @tc.name: AccountIAMInfo_Marshalling_0200
140  * @tc.desc: Marshalling and Unmarshalling
141  * @tc.type: FUNC
142  * @tc.require:
143  */
144 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_Marshalling_0200, TestSize.Level3)
145 {
146     Parcel parcel;
147     AccountSA::AuthParam authParam;
148     authParam.userId = TEST_USER_ID;
149     authParam.challenge = TEST_CHALLENGE;
150     authParam.authType = AuthType::PIN;
151     authParam.authTrustLevel = AuthTrustLevel::ATL1;
152     authParam.authIntent = AuthIntent::DEFAULT;
153 
154     EXPECT_TRUE(authParam.Marshalling(parcel));
155     AccountSA::AuthParam *authParam1 = authParam.Unmarshalling(parcel);
156     EXPECT_NE(authParam1, nullptr);
157 
158     EXPECT_EQ(authParam.authIntent, authParam1->authIntent);
159     EXPECT_EQ(authParam.authTrustLevel, authParam1->authTrustLevel);
160     EXPECT_EQ(authParam.authType, authParam1->authType);
161     EXPECT_EQ(authParam.challenge, authParam1->challenge);
162     EXPECT_EQ(authParam.userId, authParam1->userId);
163 }
164 
165 /**
166  * @tc.name: AccountIAMInfo_ReadFromParcel_0100
167  * @tc.desc: ReadFromParcel
168  * @tc.type: FUNC
169  * @tc.require:
170  */
171 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_ReadFromParcel_0100, TestSize.Level3)
172 {
173     Parcel parcel;
174     AccountSA::AuthParam authParam;
175     authParam.userId = TEST_USER_ID;
176     authParam.challenge = TEST_CHALLENGE;
177     authParam.authType = AuthType::PIN;
178     authParam.authTrustLevel = AuthTrustLevel::ATL1;
179     authParam.authIntent = AuthIntent::DEFAULT;
180 
181     EXPECT_TRUE(authParam.Marshalling(parcel));
182     EXPECT_TRUE(authParam.ReadFromParcel(parcel));
183     EXPECT_EQ(authParam.userId, TEST_USER_ID);
184     EXPECT_EQ(authParam.challenge, TEST_CHALLENGE);
185     EXPECT_EQ(authParam.authType, AuthType::PIN);
186     EXPECT_EQ(authParam.authTrustLevel, AuthTrustLevel::ATL1);
187     EXPECT_EQ(authParam.authIntent, AuthIntent::DEFAULT);
188 }
189 
190 /**
191  * @tc.name: AccountIAMInfo_ReadRemoteAuthParam_0100
192  * @tc.desc: ReadRemoteAuthParam
193  * @tc.type: FUNC
194  * @tc.require:
195  */
196 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_ReadRemoteAuthParam_0100, TestSize.Level3)
197 {
198     AccountSA::AuthParam authParam;
199     AccountSA::AuthParam readAuthParam;
200     Parcel parcel;
201     std::optional<RemoteAuthParam> testremoteAuthParam = RemoteAuthParam();
202     testremoteAuthParam.value().verifierNetworkId = "verifierNetworkId";
203     testremoteAuthParam.value().collectorNetworkId = "collectorNetworkId";
204     testremoteAuthParam.value().collectorTokenId = 1;
205     authParam.remoteAuthParam = testremoteAuthParam;
206     EXPECT_NE(authParam.remoteAuthParam, std::nullopt);
207     EXPECT_EQ(authParam.remoteAuthParam.value().verifierNetworkId.value(), "verifierNetworkId");
208     EXPECT_NE(authParam.remoteAuthParam.value().verifierNetworkId, std::nullopt);
209     EXPECT_EQ(authParam.remoteAuthParam.value().collectorNetworkId.value(), "collectorNetworkId");
210     EXPECT_NE(authParam.remoteAuthParam.value().collectorNetworkId, std::nullopt);
211     EXPECT_EQ(authParam.remoteAuthParam.value().collectorTokenId.value(), 1);
212     EXPECT_NE(authParam.remoteAuthParam.value().collectorTokenId, std::nullopt);
213     EXPECT_TRUE(authParam.WriteRemoteAuthParam(parcel));
214     EXPECT_TRUE(readAuthParam.ReadRemoteAuthParam(parcel));
215     EXPECT_TRUE(readAuthParam.remoteAuthParam.has_value());
216     auto readValue = readAuthParam.remoteAuthParam.value();
217     EXPECT_EQ(readValue.verifierNetworkId.value(), "verifierNetworkId");
218     EXPECT_EQ(readValue.collectorNetworkId.value(), "collectorNetworkId");
219     EXPECT_EQ(readValue.collectorTokenId.value(), 1);
220 }
221 
222 /**
223  * @tc.name: AccountIAMInfo_ConvertToCredentialInfoIamList_0100
224  * @tc.desc: ConvertToCredentialInfoIamList
225  * @tc.type: FUNC
226  * @tc.require:
227  */
228 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_ConvertToCredentialInfoIamList_0100, TestSize.Level3)
229 {
230     std::vector<UserIam::UserAuth::CredentialInfo> infoList;
231     UserIam::UserAuth::CredentialInfo credentialInfo;
232     credentialInfo.authType = AuthType::PIN;
233     credentialInfo.pinType = PinSubType::PIN_MAX;
234     infoList.emplace_back(credentialInfo);
235     std::vector<OHOS::AccountSA::CredentialInfoIam> infoIamList = ConvertToCredentialInfoIamList(infoList);
236     EXPECT_EQ(infoList.size(), infoIamList.size());
237     EXPECT_EQ(infoList[0].authType, infoIamList[0].credentialInfo.authType);
238     EXPECT_EQ(infoList[0].pinType, infoIamList[0].credentialInfo.pinType);
239 }
240 
241 /**
242  * @tc.name: AccountIAMInfo_ConvertToCredentialInfoList_0100
243  * @tc.desc: ConvertToCredentialInfoList
244  * @tc.type: FUNC
245  * @tc.require:
246  */
247 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_ConvertToCredentialInfoList_0100, TestSize.Level3)
248 {
249     std::vector<OHOS::AccountSA::CredentialInfoIam> infoIamList;
250     OHOS::AccountSA::CredentialInfoIam credentialInfoIam;
251     UserIam::UserAuth::CredentialInfo credentialInfo;
252     credentialInfo.authType = AuthType::PIN;
253     credentialInfo.pinType = PinSubType::PIN_MAX;
254     credentialInfoIam.credentialInfo = credentialInfo;
255     infoIamList.emplace_back(credentialInfoIam);
256     std::vector<UserIam::UserAuth::CredentialInfo> infoList = ConvertToCredentialInfoList(infoIamList);
257     EXPECT_EQ(infoList.size(), infoIamList.size());
258 }
259 
260 /**
261  * @tc.name: AccountIAMInfo_Marshalling_0300
262  * @tc.desc: Marshalling and Unmarshalling
263  * @tc.type: FUNC
264  * @tc.require:
265  */
266 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_Marshalling_0300, TestSize.Level3)
267 {
268     Parcel parcel;
269     OHOS::AccountSA::CredentialInfoIam credentialInfoIam;
270     credentialInfoIam.credentialInfo.authType = AuthType::PIN;
271     credentialInfoIam.credentialInfo.credentialId = 1;
272     credentialInfoIam.credentialInfo.templateId = 2;
273     credentialInfoIam.credentialInfo.isAbandoned = true;
274     credentialInfoIam.credentialInfo.validityPeriod = 3;
275     EXPECT_TRUE(credentialInfoIam.Marshalling(parcel));
276     OHOS::AccountSA::CredentialInfoIam *credentialInfoIam1 = credentialInfoIam.Unmarshalling(parcel);
277     EXPECT_NE(credentialInfoIam1, nullptr);
278 
279     EXPECT_EQ(credentialInfoIam.credentialInfo.authType, credentialInfoIam1->credentialInfo.authType);
280     EXPECT_EQ(credentialInfoIam.credentialInfo.credentialId, credentialInfoIam1->credentialInfo.credentialId);
281     EXPECT_EQ(credentialInfoIam.credentialInfo.templateId, credentialInfoIam1->credentialInfo.templateId);
282     EXPECT_EQ(credentialInfoIam.credentialInfo.isAbandoned, credentialInfoIam1->credentialInfo.isAbandoned);
283     EXPECT_EQ(credentialInfoIam.credentialInfo.validityPeriod, credentialInfoIam1->credentialInfo.validityPeriod);
284 }
285 
286 /**
287  * @tc.name: AccountIAMInfo_CredentialParametersIam_Marshalling_0100
288  * @tc.desc: Marshalling
289  * @tc.type: FUNC
290  * @tc.require:
291  */
292 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_CredentialParametersIam_Marshalling_0100, TestSize.Level3)
293 {
294     AccountSA::CredentialParametersIam credentialParametersIam;
295     Parcel parcel;
296     EXPECT_TRUE(credentialParametersIam.Marshalling(parcel));
297 }
298 
299 /**
300  * @tc.name: AccountIAMInfo_CredentialParametersIam_Unmarshalling_0100
301  * @tc.desc: Unmarshalling
302  * @tc.type: FUNC
303  * @tc.require:
304  */
305 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_CredentialParametersIam_Unmarshalling_0100, TestSize.Level3)
306 {
307     AccountSA::CredentialParametersIam credentialParametersIam;
308     Parcel parcel;
309     EXPECT_TRUE(credentialParametersIam.Marshalling(parcel));
310     EXPECT_NE(credentialParametersIam.Unmarshalling(parcel), nullptr);
311 }
312 
313 /**
314  * @tc.name: AccountIAMInfo_CredentialParametersIam_ReadFromParcel_0100
315  * @tc.desc: ReadFromParcel
316  * @tc.type: FUNC
317  * @tc.require:
318  */
319 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_CredentialParametersIam_ReadFromParcel_0100, TestSize.Level3)
320 {
321     AccountSA::CredentialParametersIam credentialParametersIam;
322     Parcel parcel;
323     EXPECT_TRUE(credentialParametersIam.Marshalling(parcel));
324     EXPECT_TRUE(credentialParametersIam.ReadFromParcel(parcel));
325 }
326 
327 /**
328  * @tc.name: AccountIAMInfo_Marshalling_0400
329  * @tc.desc: Marshalling and Unmarshalling
330  * @tc.type: FUNC
331  * @tc.require:
332  */
333 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_Marshalling_0400, TestSize.Level3)
334 {
335     Parcel parcel;
336     OHOS::AccountSA::CredentialParametersIam credentialParametersIam;
337     std::vector<uint8_t> TEST_TOKEN;
338     TEST_TOKEN.push_back(TEST_TOKEN_SIZE);
339     TEST_TOKEN.push_back(TEST_TOKEN_PID);
340     credentialParametersIam.credentialParameters.authType = AuthType::PIN;
341     credentialParametersIam.credentialParameters.token = TEST_TOKEN;
342     EXPECT_TRUE(credentialParametersIam.Marshalling(parcel));
343     OHOS::AccountSA::CredentialParametersIam *credential = credentialParametersIam.Unmarshalling(parcel);
344     EXPECT_NE(credential, nullptr);
345 
346     EXPECT_EQ(credentialParametersIam.credentialParameters.authType, credential->credentialParameters.authType);
347     EXPECT_EQ(credentialParametersIam.credentialParameters.token, credential->credentialParameters.token);
348     EXPECT_EQ(credential->credentialParameters.token.size(), credentialParametersIam.credentialParameters.token.size());
349 }
350 
351 /**
352  * @tc.name: AccountIAMInfo_GetPropertyRequestIam_Marshalling_0100
353  * @tc.desc: Marshalling
354  * @tc.type: FUNC
355  * @tc.require:
356  */
357 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_GetPropertyRequestIam_Marshalling_0100, TestSize.Level3)
358 {
359     AccountSA::GetPropertyRequestIam getPropertyRequestIam;
360     UserIam::UserAuth::GetPropertyRequest getPropertyRequest;
361     Parcel parcel;
362     EXPECT_TRUE(getPropertyRequestIam.Marshalling(parcel));
363 }
364 
365 /**
366  * @tc.name: AccountIAMInfo_GetPropertyRequestIam_Unmarshalling_0100
367  * @tc.desc: Unmarshalling
368  * @tc.type: FUNC
369  * @tc.require:
370  */
371 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_GetPropertyRequestIam_Unmarshalling_0100, TestSize.Level3)
372 {
373     AccountSA::GetPropertyRequestIam getPropertyRequestIam;
374     UserIam::UserAuth::GetPropertyRequest getPropertyRequest;
375     Parcel parcel;
376     EXPECT_TRUE(getPropertyRequestIam.Marshalling(parcel));
377     EXPECT_NE(getPropertyRequestIam.Unmarshalling(parcel), nullptr);
378 }
379 
380 /**
381  * @tc.name: AccountIAMInfo_GetPropertyRequestIam_ReadFromParcel_0100
382  * @tc.desc: ReadFromParcel
383  * @tc.type: FUNC
384  * @tc.require:
385  */
386 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_GetPropertyRequestIam_ReadFromParcel_0100, TestSize.Level3)
387 {
388     AccountSA::GetPropertyRequestIam getPropertyRequestIam;
389     UserIam::UserAuth::GetPropertyRequest getPropertyRequest;
390     Parcel parcel;
391     EXPECT_TRUE(getPropertyRequestIam.Marshalling(parcel));
392     EXPECT_TRUE(getPropertyRequestIam.ReadFromParcel(parcel));
393 }
394 
395 /**
396  * @tc.name: AccountIAMInfo_Marshalling_0500
397  * @tc.desc: Marshalling and Unmarshalling
398  * @tc.type: FUNC
399  * @tc.require:
400  */
401 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_Marshalling_0500, TestSize.Level3)
402 {
403     Parcel parcel;
404     OHOS::AccountSA::GetPropertyRequestIam getPropertyRequestIam;
405     std::vector<Attributes::AttributeKey> TEST_KEYS;
406     TEST_KEYS.push_back(Attributes::AttributeKey::ATTR_AUTH_TOKEN);
407     TEST_KEYS.push_back(Attributes::AttributeKey::ATTR_AUTH_TYPE);
408     getPropertyRequestIam.getPropertyRequest.authType = AuthType::PIN;
409     getPropertyRequestIam.getPropertyRequest.keys = TEST_KEYS;
410     EXPECT_TRUE(getPropertyRequestIam.Marshalling(parcel));
411     OHOS::AccountSA::GetPropertyRequestIam *getPropertyRequestIam1 = getPropertyRequestIam.Unmarshalling(parcel);
412     EXPECT_NE(getPropertyRequestIam1, nullptr);
413 
414     EXPECT_EQ(getPropertyRequestIam.getPropertyRequest.authType, getPropertyRequestIam1->getPropertyRequest.authType);
415     EXPECT_EQ(getPropertyRequestIam.getPropertyRequest.keys, getPropertyRequestIam1->getPropertyRequest.keys);
416     EXPECT_EQ(getPropertyRequestIam1->getPropertyRequest.keys.size(),
417         getPropertyRequestIam.getPropertyRequest.keys.size());
418 }
419 
420 /**
421  * @tc.name: AccountIAMInfo_SetPropertyRequestIam_Marshalling_0100
422  * @tc.desc: Marshalling
423  * @tc.type: FUNC
424  * @tc.require:
425  */
426 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_SetPropertyRequestIam_Marshalling_0100, TestSize.Level3)
427 {
428     AccountSA::SetPropertyRequestIam setPropertyRequestIam;
429     UserIam::UserAuth::SetPropertyRequest setPropertyRequest;
430     Parcel parcel;
431     EXPECT_TRUE(setPropertyRequestIam.Marshalling(parcel));
432 }
433 
434 /**
435  * @tc.name: AccountIAMInfo_SetPropertyRequestIam_Unmarshalling_0100
436  * @tc.desc: Unmarshalling
437  * @tc.type: FUNC
438  * @tc.require:
439  */
440 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_SetPropertyRequestIam_Unmarshalling_0100, TestSize.Level3)
441 {
442     AccountSA::SetPropertyRequestIam setPropertyRequestIam;
443     UserIam::UserAuth::SetPropertyRequest setPropertyRequest;
444     Parcel parcel;
445     EXPECT_TRUE(setPropertyRequestIam.Marshalling(parcel));
446     EXPECT_NE(setPropertyRequestIam.Unmarshalling(parcel), nullptr);
447 }
448 
449 /**
450  * @tc.name: AccountIAMInfo_SetPropertyRequestIam_ReadFromParcel_0100
451  * @tc.desc: ReadFromParcel
452  * @tc.type: FUNC
453  * @tc.require:
454  */
455 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_SetPropertyRequestIam_ReadFromParcel_0100, TestSize.Level3)
456 {
457     AccountSA::SetPropertyRequestIam setPropertyRequestIam;
458     UserIam::UserAuth::SetPropertyRequest setPropertyRequest;
459     Parcel parcel;
460     EXPECT_TRUE(setPropertyRequestIam.Marshalling(parcel));
461     EXPECT_TRUE(setPropertyRequestIam.ReadFromParcel(parcel));
462 }
463 
464 /**
465  * @tc.name: AccountIAMInfo_Marshalling_0600
466  * @tc.desc: Marshalling and Unmarshalling
467  * @tc.type: FUNC
468  * @tc.require:
469  */
470 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_Marshalling_0600, TestSize.Level3)
471 {
472     Parcel parcel;
473     OHOS::AccountSA::SetPropertyRequestIam setPropertyRequestIam;
474     UserIam::UserAuth::SetPropertyRequest setPropertyRequest;
475     setPropertyRequestIam.setPropertyRequest.authType = AuthType::PIN;
476     EXPECT_TRUE(setPropertyRequestIam.Marshalling(parcel));
477     OHOS::AccountSA::SetPropertyRequestIam *setPropertyRequestIam1 = setPropertyRequestIam.Unmarshalling(parcel);
478     EXPECT_NE(setPropertyRequestIam1, nullptr);
479 
480     EXPECT_EQ(setPropertyRequestIam.setPropertyRequest.authType, setPropertyRequestIam1->setPropertyRequest.authType);
481 }
482 
483 /**
484  * @tc.name: AccountIAMInfo_ReadFromParcel_0500
485  * @tc.desc: ReadFromParcel
486  * @tc.type: FUNC
487  * @tc.require:
488  */
489 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_ReadFromParcel_0500, TestSize.Level3)
490 {
491     Parcel parcel;
492     OHOS::AccountSA::SetPropertyRequestIam setPropertyRequestIam;
493     UserIam::UserAuth::SetPropertyRequest setPropertyRequest;
494     setPropertyRequestIam.setPropertyRequest.authType = AuthType::PIN;
495     EXPECT_TRUE(setPropertyRequestIam.Marshalling(parcel));
496     EXPECT_TRUE(setPropertyRequestIam.ReadFromParcel(parcel));
497     EXPECT_EQ(setPropertyRequestIam.setPropertyRequest.authType, 1);
498 }
499 
500 /**
501  * @tc.name: AccountIAMInfo_Marshalling_0700
502  * @tc.desc: Marshalling and Unmarshalling
503  * @tc.type: FUNC
504  * @tc.require:
505  */
506 HWTEST_F(AccountIAMInfoTest, AccountIAMInfo_Marshalling_0700, TestSize.Level3)
507 {
508     MessageParcel parcel;
509     AccountSA::OhosAccountInfo ohosAccountInfo;
510     ohosAccountInfo.name_ = TEST_ACCOUNT_NAME;
511     ohosAccountInfo.uid_ = TEST_ACCOUNT_UID;
512     ohosAccountInfo.rawUid_ = TEST_RAW_UID;
513     ohosAccountInfo.status_ = TEST_ACCOUNT_STATUS;
514     ohosAccountInfo.nickname_ = TEST_ACCOUNT_NICKNAME;
515     ohosAccountInfo.avatar_ = TEST_AVATAR;
516     ohosAccountInfo.scalableData_.SetParam(KEY_ACCOUNT_INFO_SCALABLEDATA, 123);
517     EXPECT_TRUE(ohosAccountInfo.Marshalling(parcel));
518     AccountSA::OhosAccountInfo *ohosAccountInfo1 = ohosAccountInfo.Unmarshalling(parcel);
519     EXPECT_NE(ohosAccountInfo1, nullptr);
520 
521     EXPECT_EQ(ohosAccountInfo.name_, ohosAccountInfo1->name_);
522     EXPECT_EQ(ohosAccountInfo.uid_, ohosAccountInfo1->uid_);
523     EXPECT_EQ(ohosAccountInfo.rawUid_, ohosAccountInfo1->rawUid_);
524     EXPECT_EQ(ohosAccountInfo.status_, ohosAccountInfo1->status_);
525     EXPECT_EQ(ohosAccountInfo.nickname_, ohosAccountInfo1->nickname_);
526     EXPECT_EQ(ohosAccountInfo.avatar_, ohosAccountInfo1->avatar_);
527     EXPECT_EQ(ohosAccountInfo.scalableData_.GetStringParam(KEY_ACCOUNT_INFO_SCALABLEDATA),
528         ohosAccountInfo1->scalableData_.GetStringParam(KEY_ACCOUNT_INFO_SCALABLEDATA));
529 }
530 }  // namespace AccountTest
531 }  // namespace OHOS