1 /*
2 * Copyright (c) 2021-2022 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 "user_auth_hdi.h"
17 #include "iam_hat_test.h"
18
19 using namespace std;
20 using namespace testing::ext;
21 using namespace OHOS::UserIam::Common;
22 using namespace OHOS::HDI::UserAuth::V1_0;
23
24 static const uint32_t MAX_FUZZ_STRUCT_LEN = 20;
25 static UserAuthInterfaceService g_service;
26 int32_t Expectedvalue = NULL;
27 static OHOS::Parcel parcel;
28
SetUpTestCase()29 void UserIamUserAuthTest::SetUpTestCase()
30 {
31 }
32
TearDownTestCase()33 void UserIamUserAuthTest::TearDownTestCase()
34 {
35 }
36
SetUp()37 void UserIamUserAuthTest::SetUp()
38 {
39 }
40
TearDown()41 void UserIamUserAuthTest::TearDown()
42 {
43 }
44
FillAuthTypeVector(Parcel & parcel,vector<AuthType> & vector)45 static void FillAuthTypeVector(Parcel &parcel, vector<AuthType> &vector)
46 {
47 uint32_t len = parcel.ReadInt32() % MAX_FUZZ_STRUCT_LEN;
48 vector.resize(len);
49 for (uint32_t i = 0; i < len; i++) {
50 vector[i] = static_cast<AuthType>(parcel.ReadInt32());
51 }
52 }
53
FillEnrollParam(Parcel & parcel,EnrollParam & enrollParam)54 static void FillEnrollParam(Parcel &parcel, EnrollParam &enrollParam)
55 {
56 enrollParam.authType = static_cast<AuthType>(parcel.ReadInt32());
57 enrollParam.executorSensorHint = parcel.ReadUint32();
58 }
59
FillExecutorRegisterInfo(Parcel & parcel,ExecutorRegisterInfo & executorRegisterInfo)60 static void FillExecutorRegisterInfo(Parcel &parcel, ExecutorRegisterInfo &executorRegisterInfo)
61 {
62 executorRegisterInfo.authType = static_cast<AuthType>(parcel.ReadInt32());
63 executorRegisterInfo.executorRole = static_cast<ExecutorRole>(parcel.ReadInt32());
64 executorRegisterInfo.executorSensorHint = parcel.ReadUint32();
65 executorRegisterInfo.executorMatcher = parcel.ReadUint32();
66 executorRegisterInfo.esl = static_cast<ExecutorSecureLevel>(parcel.ReadInt32());
67 FillTestUint8Vector(parcel, executorRegisterInfo.publicKey);
68 }
69
FillExecutorInfo(Parcel & parcel,ExecutorInfo & executorInfo)70 static void FillExecutorInfo(Parcel &parcel, ExecutorInfo &executorInfo)
71 {
72 executorInfo.executorIndex = parcel.ReadUint64();
73 FillExecutorRegisterInfo(parcel, executorInfo.info);
74 }
75
FillExecutorInfoVector(Parcel & parcel,vector<ExecutorInfo> & vector)76 static void FillExecutorInfoVector(Parcel &parcel, vector<ExecutorInfo> &vector)
77 {
78 uint32_t len = parcel.ReadInt32() % MAX_FUZZ_STRUCT_LEN;
79 vector.resize(len);
80 for (uint32_t i = 0; i < len; i++) {
81 FillExecutorInfo(parcel, vector[i]);
82 }
83 }
84
FillScheduleInfo(Parcel & parcel,ScheduleInfo & scheduleInfo)85 static void FillScheduleInfo(Parcel &parcel, ScheduleInfo &scheduleInfo)
86 {
87 scheduleInfo.scheduleId = parcel.ReadUint64();
88 FillTestUint64Vector(parcel, scheduleInfo.templateIds);
89 scheduleInfo.authType = static_cast<AuthType>(parcel.ReadInt32());
90 scheduleInfo.executorMatcher = parcel.ReadUint32();
91 scheduleInfo.scheduleMode = static_cast<ScheduleMode>(parcel.ReadInt32());
92 FillExecutorInfoVector(parcel, scheduleInfo.executors);
93 }
94
FillCredentialInfo(Parcel & parcel,CredentialInfo & credentialInfo)95 static void FillCredentialInfo(Parcel &parcel, CredentialInfo &credentialInfo)
96 {
97 credentialInfo.credentialId = parcel.ReadUint64();
98 credentialInfo.executorIndex = parcel.ReadUint64();
99 credentialInfo.templateId = parcel.ReadUint64();
100 credentialInfo.authType = static_cast<AuthType>(parcel.ReadInt32());
101 credentialInfo.executorMatcher = parcel.ReadUint32();
102 credentialInfo.executorSensorHint = parcel.ReadUint32();
103 }
104
FillEnrolledInfo(Parcel & parcel,EnrolledInfo & enrolledInfo)105 static void FillEnrolledInfo(Parcel &parcel, EnrolledInfo &enrolledInfo)
106 {
107 enrolledInfo.enrolledId = parcel.ReadUint64();
108 enrolledInfo.authType = static_cast<AuthType>(parcel.ReadInt32());
109 }
110
FillIdentifyResultInfo(Parcel & parcel,IdentifyResultInfo & identifyResultInfo)111 static void FillIdentifyResultInfo(Parcel &parcel, IdentifyResultInfo &identifyResultInfo)
112 {
113 identifyResultInfo.result = parcel.ReadInt32();
114 identifyResultInfo.userId = parcel.ReadInt32();
115 FillTestUint8Vector(parcel, identifyResultInfo.token);
116 }
117
FillExecutorSendMsg(Parcel & parcel,ExecutorSendMsg & executorSendMsg)118 static void FillExecutorSendMsg(Parcel &parcel, ExecutorSendMsg &executorSendMsg)
119 {
120 executorSendMsg.executorIndex = parcel.ReadUint32();
121 FillTestUint8Vector(parcel, executorSendMsg.msg);
122 }
123
FillAuthSolution(Parcel & parcel,AuthSolution & authSolution)124 static void FillAuthSolution(Parcel &parcel, AuthSolution &authSolution)
125 {
126 authSolution.userId = parcel.ReadInt32();
127 authSolution.authTrustLevel = parcel.ReadUint32();
128 authSolution.authType = static_cast<AuthType>(parcel.ReadInt32());
129 authSolution.executorSensorHint = parcel.ReadUint32();
130 FillTestUint8Vector(parcel, authSolution.challenge);
131 }
132
FillScheduleInfoVector(Parcel & parcel,vector<ScheduleInfo> & vector)133 static void FillScheduleInfoVector(Parcel &parcel, vector<ScheduleInfo> &vector)
134 {
135 uint32_t len = parcel.ReadInt32() % MAX_FUZZ_STRUCT_LEN;
136 vector.resize(len);
137 for (uint32_t i = 0; i < len; i++) {
138 FillScheduleInfo(parcel, vector[i]);
139 }
140 }
141
FillCredentialInfoVector(Parcel & parcel,vector<CredentialInfo> & vector)142 static void FillCredentialInfoVector(Parcel &parcel, vector<CredentialInfo> &vector)
143 {
144 uint32_t len = parcel.ReadInt32() % MAX_FUZZ_STRUCT_LEN;
145 vector.resize(len);
146 for (uint32_t i = 0; i < len; i++) {
147 FillCredentialInfo(parcel, vector[i]);
148 }
149 }
150
FillEnrolledInfoVector(Parcel & parcel,vector<EnrolledInfo> & vector)151 static void FillEnrolledInfoVector(Parcel &parcel, vector<EnrolledInfo> &vector)
152 {
153 uint32_t len = parcel.ReadInt32() % MAX_FUZZ_STRUCT_LEN;
154 vector.resize(len);
155 for (uint32_t i = 0; i < len; i++) {
156 FillEnrolledInfo(parcel, vector[i]);
157 }
158 }
159
FillExecutorSendMsgVector(Parcel & parcel,vector<ExecutorSendMsg> & vector)160 static void FillExecutorSendMsgVector(Parcel &parcel, vector<ExecutorSendMsg> &vector)
161 {
162 uint32_t len = parcel.ReadInt32() % MAX_FUZZ_STRUCT_LEN;
163 vector.resize(len);
164 for (uint32_t i = 0; i < len; i++) {
165 FillExecutorSendMsg(parcel, vector[i]);
166 }
167 }
168
FillAuthResultInfo(Parcel & parcel,AuthResultInfo & authResultInfo)169 static void FillAuthResultInfo(Parcel &parcel, AuthResultInfo &authResultInfo)
170 {
171 authResultInfo.result = parcel.ReadUint32();
172 authResultInfo.lockoutDuration = parcel.ReadInt32();
173 authResultInfo.remainAttempts = parcel.ReadInt32();
174 FillExecutorSendMsgVector(parcel, authResultInfo.msgs);
175 FillTestUint8Vector(parcel, authResultInfo.token);
176 }
177
178 /**
179 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0101
180 * @tc.name: Test Init
181 * @tc.size: MediumTest
182 * @tc.type: Function
183 * @tc.level: Level1
184 */
185 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0101, Function | MediumTest | Level1)
186 {
187 cout << "start Init" << endl;
188 int32_t ret = g_service.Init();
189 EXPECT_EQ(ret, 0);
190 }
191
192 /**
193 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0102
194 * @tc.name: Test AddExecutor
195 * @tc.size: MediumTest
196 * @tc.type: Function
197 * @tc.level: Level1
198 */
199 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0102, Function | MediumTest | Level1)
200 {
201 cout << "start AddExecutor" << endl;
202 ExecutorRegisterInfo info;
203 FillExecutorRegisterInfo(parcel, info);
204 uint64_t index = parcel.ReadUint64();
205 std::vector<uint8_t> publicKey;
206 FillTestUint8Vector(parcel, publicKey);
207 std::vector<uint64_t> templateIds;
208 FillTestUint64Vector(parcel, templateIds);
209 int32_t ret = g_service.AddExecutor(info, index, publicKey, templateIds);
210 cout << "ret is " << ret << endl;
211 ASSERT_EQ(ret != Expectedvalue, true);
212 }
213
214 /**
215 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0103
216 * @tc.name: Test GetCredential
217 * @tc.size: MediumTest
218 * @tc.type: Function
219 * @tc.level: Level1
220 */
221 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0103, Function | MediumTest | Level1)
222 {
223 cout << "start GetCredential" << endl;
224 int32_t userId = parcel.ReadInt32();
225 AuthType authType = static_cast<AuthType>(parcel.ReadInt32());
226 std::vector<CredentialInfo> infos;
227 FillCredentialInfoVector(parcel, infos);
228 int32_t ret = g_service.GetCredential(userId, authType, infos);
229 cout << "ret is " << ret << endl;
230 EXPECT_EQ(ret, 0);
231 }
232
233 /**
234 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0104
235 * @tc.name: Test GetUserInfo
236 * @tc.size: MediumTest
237 * @tc.type: Function
238 * @tc.level: Level1
239 */
240 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0104, Function | MediumTest | Level1)
241 {
242 cout << "start GetUserInfo" << endl;
243 int32_t userId = parcel.ReadInt32();
244 uint64_t secureUid = parcel.ReadUint64();
245 PinSubType pinSubType = static_cast<PinSubType>(parcel.ReadUint32());
246 std::vector<EnrolledInfo> infos;
247 FillEnrolledInfoVector(parcel, infos);
248 int32_t ret = g_service.GetUserInfo(userId, secureUid, pinSubType, infos);
249 cout << "ret is " << ret << endl;
250 ASSERT_EQ(ret != Expectedvalue, true);
251 }
252
253 /**
254 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0105
255 * @tc.name: Test DeleteUser
256 * @tc.size: MediumTest
257 * @tc.type: Function
258 * @tc.level: Level1
259 */
260 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0105, Function | MediumTest | Level1)
261 {
262 cout << "start DeleteUser" << endl;
263 int32_t userId = parcel.ReadInt32();
264 std::vector<uint8_t> authToken;
265 FillTestUint8Vector(parcel, authToken);
266 std::vector<CredentialInfo> deletedInfos;
267 FillCredentialInfoVector(parcel, deletedInfos);
268 int32_t ret = g_service.DeleteUser(userId, authToken, deletedInfos);
269 cout << "ret is " << ret << endl;
270 ASSERT_EQ(ret != Expectedvalue, true);
271 }
272
273 /**
274 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0106
275 * @tc.name: Test BeginIdentification
276 * @tc.size: MediumTest
277 * @tc.type: Function
278 * @tc.level: Level1
279 */
280 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0106, Function | MediumTest | Level1)
281 {
282 cout << "start BeginIdentification" << endl;
283 uint64_t contextId = parcel.ReadUint64();
284 AuthType authType = static_cast<AuthType>(parcel.ReadInt32());
285 std::vector<uint8_t> challenge;
286 FillTestUint8Vector(parcel, challenge);
287 uint32_t executorId = parcel.ReadUint32();
288 ScheduleInfo scheduleInfo;
289 FillScheduleInfo(parcel, scheduleInfo);
290 int32_t ret = g_service.BeginIdentification(contextId, authType, challenge, executorId, scheduleInfo);
291 cout << "ret is " << ret << endl;
292 ASSERT_EQ(ret != Expectedvalue, true);
293 }
294
295 /**
296 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0107
297 * @tc.name: Test DeleteExecutor
298 * @tc.size: MediumTest
299 * @tc.type: Function
300 * @tc.level: Level1
301 */
302 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0107, Function | MediumTest | Level1)
303 {
304 cout << "start DeleteExecutor" << endl;
305 uint64_t index = parcel.ReadUint64();
306 int32_t ret = g_service.DeleteExecutor(index);
307 cout << "ret is " << ret << endl;
308 ASSERT_EQ(ret != Expectedvalue, true);
309 }
310
311 /**
312 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0108
313 * @tc.name: Test OpenSession
314 * @tc.size: MediumTest
315 * @tc.type: Function
316 * @tc.level: Level1
317 */
318 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0108, Function | MediumTest | Level1)
319 {
320 cout << "start OpenSession" << endl;
321 int32_t userId = parcel.ReadInt32();
322 std::vector<uint8_t> challenge;
323 FillTestUint8Vector(parcel, challenge);
324 int32_t ret = g_service.OpenSession(userId, challenge);
325 cout << "ret is " << ret << endl;
326 EXPECT_EQ(ret, 0);
327 }
328
329 /**
330 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0109
331 * @tc.name: Test CloseSession
332 * @tc.size: MediumTest
333 * @tc.type: Function
334 * @tc.level: Level1
335 */
336 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0109, Function | MediumTest | Level1)
337 {
338 cout << "start CloseSession" << endl;
339 int32_t userId = parcel.ReadInt32();
340 int32_t ret = g_service.CloseSession(userId);
341 cout << "ret is " << ret << endl;
342 EXPECT_EQ(ret, 0);
343 }
344
345 /**
346 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0110
347 * @tc.name: Test BeginEnrollment
348 * @tc.size: MediumTest
349 * @tc.type: Function
350 * @tc.level: Level1
351 */
352 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0110, Function | MediumTest | Level1)
353 {
354 cout << "start BeginEnrollment" << endl;
355 int32_t userId = parcel.ReadInt32();
356 std::vector<uint8_t> authToken;
357 FillTestUint8Vector(parcel, authToken);
358 EnrollParam param;
359 FillEnrollParam(parcel, param);
360 ScheduleInfo info;
361 FillScheduleInfo(parcel, info);
362 int32_t ret = g_service.BeginEnrollment(userId, authToken, param, info);
363 cout << "ret is " << ret << endl;
364 ASSERT_EQ(ret != Expectedvalue, true);
365 }
366
367 /**
368 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0111
369 * @tc.name: Test UpdateEnrollmentResult
370 * @tc.size: MediumTest
371 * @tc.type: Function
372 * @tc.level: Level1
373 */
374 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0111, Function | MediumTest | Level1)
375 {
376 cout << "start UpdateEnrollmentResult" << endl;
377 int32_t userId = parcel.ReadInt32();
378 std::vector<uint8_t> scheduleResult;
379 FillTestUint8Vector(parcel, scheduleResult);
380 EnrollResultInfo info = {};
381 FillCredentialInfo(parcel, info.oldInfo);
382 info.credentialId = parcel.ReadUint64();
383 FillTestUint8Vector(parcel, info.rootSecret);
384 int32_t ret = g_service.UpdateEnrollmentResult(userId, scheduleResult, info);
385 cout << "ret is " << ret << endl;
386 ASSERT_EQ(ret != Expectedvalue, true);
387 }
388
389 /**
390 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0112
391 * @tc.name: Test CancelEnrollment
392 * @tc.size: MediumTest
393 * @tc.type: Function
394 * @tc.level: Level1
395 */
396 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0112, Function | MediumTest | Level1)
397 {
398 cout << "start CancelEnrollment" << endl;
399 int32_t userId = parcel.ReadInt32();
400 int32_t ret = g_service.CancelEnrollment(userId);
401 cout << "ret is " << ret << endl;
402 EXPECT_EQ(ret, 0);
403 }
404
405 /**
406 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0113
407 * @tc.name: Test DeleteCredential
408 * @tc.size: MediumTest
409 * @tc.type: Function
410 * @tc.level: Level1
411 */
412 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0113, Function | MediumTest | Level1)
413 {
414 cout << "start DeleteCredential" << endl;
415 int32_t userId = parcel.ReadInt32();
416 uint64_t credentialId = parcel.ReadUint64();
417 std::vector<uint8_t> authToken;
418 FillTestUint8Vector(parcel, authToken);
419 CredentialInfo info;
420 FillCredentialInfo(parcel, info);
421 int32_t ret = g_service.DeleteCredential(userId, credentialId, authToken, info);
422 cout << "ret is " << ret << endl;
423 ASSERT_EQ(ret != Expectedvalue, true);
424 }
425
426 /**
427 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0114
428 * @tc.name: Test EnforceDeleteUser
429 * @tc.size: MediumTest
430 * @tc.type: Function
431 * @tc.level: Level1
432 */
433 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0114, Function | MediumTest | Level1)
434 {
435 cout << "start EnforceDeleteUser" << endl;
436 int32_t userId = parcel.ReadInt32();
437 std::vector<CredentialInfo> deletedInfos;
438 FillCredentialInfoVector(parcel, deletedInfos);
439 int32_t ret = g_service.EnforceDeleteUser(userId, deletedInfos);
440 cout << "ret is " << ret << endl;
441 ASSERT_EQ(ret != Expectedvalue, true);
442 }
443
444 /**
445 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0115
446 * @tc.name: Test BeginAuthentication
447 * @tc.size: MediumTest
448 * @tc.type: Function
449 * @tc.level: Level1
450 */
451 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0115, Function | MediumTest | Level1)
452 {
453 cout << "start BeginAuthentication" << endl;
454 uint64_t contextId = parcel.ReadUint64();
455 AuthSolution param;
456 FillAuthSolution(parcel, param);
457 std::vector<ScheduleInfo> scheduleInfos;
458 FillScheduleInfoVector(parcel, scheduleInfos);
459 int32_t ret = g_service.BeginAuthentication(contextId, param, scheduleInfos);
460 cout << "ret is " << ret << endl;
461 ASSERT_EQ(ret != Expectedvalue, true);
462 }
463
464 /**
465 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0116
466 * @tc.name: Test UpdateAuthenticationResult
467 * @tc.size: MediumTest
468 * @tc.type: Function
469 * @tc.level: Level1
470 */
471 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0116, Function | MediumTest | Level1)
472 {
473 cout << "start UpdateAuthenticationResult" << endl;
474 uint64_t contextId = parcel.ReadUint64();
475 std::vector<uint8_t> scheduleResult;
476 FillTestUint8Vector(parcel, scheduleResult);
477 AuthResultInfo info;
478 FillAuthResultInfo(parcel, info);
479 int32_t ret = g_service.UpdateAuthenticationResult(contextId, scheduleResult, info);
480 cout << "ret is " << ret << endl;
481 ASSERT_EQ(ret != Expectedvalue, true);
482 }
483
484 /**
485 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0117
486 * @tc.name: Test CancelAuthentication
487 * @tc.size: MediumTest
488 * @tc.type: Function
489 * @tc.level: Level1
490 */
491 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0117, Function | MediumTest | Level1)
492 {
493 cout << "start CancelAuthentication" << endl;
494 uint64_t contextId = parcel.ReadUint64();
495 int32_t ret = g_service.CancelAuthentication(contextId);
496 cout << "ret is " << ret << endl;
497 ASSERT_EQ(ret != Expectedvalue, true);
498 }
499
500 /**
501 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0118
502 * @tc.name: Test UpdateIdentificationResult
503 * @tc.size: MediumTest
504 * @tc.type: Function
505 * @tc.level: Level1
506 */
507 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0118, Function | MediumTest | Level1)
508 {
509 cout << "start UpdateIdentificationResult" << endl;
510 uint64_t contextId = parcel.ReadUint64();
511 std::vector<uint8_t> scheduleResult;
512 FillTestUint8Vector(parcel, scheduleResult);
513 IdentifyResultInfo info;
514 FillIdentifyResultInfo(parcel, info);
515 int32_t ret = g_service.UpdateIdentificationResult(contextId, scheduleResult, info);
516 cout << "ret is " << ret << endl;
517 ASSERT_EQ(ret != Expectedvalue, true);
518 }
519
520 /**
521 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0119
522 * @tc.name: Test CancelIdentification
523 * @tc.size: MediumTest
524 * @tc.type: Function
525 * @tc.level: Level1
526 */
527 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0119, Function | MediumTest | Level1)
528 {
529 cout << "start CancelIdentification" << endl;
530 uint64_t contextId = parcel.ReadUint64();
531 int32_t ret = g_service.CancelIdentification(contextId);
532 cout << "ret is " << ret << endl;
533 ASSERT_EQ(ret != Expectedvalue, true);
534 }
535
536 /**
537 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0120
538 * @tc.name: Test GetAuthTrustLevel
539 * @tc.size: MediumTest
540 * @tc.type: Function
541 * @tc.level: Level1
542 */
543 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0120, Function | MediumTest | Level1)
544 {
545 cout << "start GetAuthTrustLevel" << endl;
546 int32_t userId = parcel.ReadInt32();
547 AuthType authType = static_cast<AuthType>(parcel.ReadInt32());
548 uint32_t authTrustLevel = parcel.ReadUint32();
549 int32_t ret = g_service.GetAuthTrustLevel(userId, authType, authTrustLevel);
550 cout << "ret is " << ret << endl;
551 ASSERT_EQ(ret != Expectedvalue, true);
552 }
553
554 /**
555 * @tc.number: Security_IAM_UserAuth_HDI_FUNC_0121
556 * @tc.name: Test GetValidSolution
557 * @tc.size: MediumTest
558 * @tc.type: Function
559 * @tc.level: Level1
560 */
561 HWTEST_F(UserIamUserAuthTest, Security_IAM_UserAuth_HDI_FUNC_0121, Function | MediumTest | Level1)
562 {
563 cout << "start GetValidSolution" << endl;
564 int32_t userId = parcel.ReadInt32();
565 std::vector<AuthType> authTypes;
566 FillAuthTypeVector(parcel, authTypes);
567 uint32_t authTrustLevel = parcel.ReadUint32();
568 std::vector<AuthType> validTypes;
569 FillAuthTypeVector(parcel, validTypes);
570 int32_t ret = g_service.GetValidSolution(userId, authTypes, authTrustLevel, validTypes);
571 cout << "ret is " << ret << endl;
572 EXPECT_EQ(ret, 0);
573 }