1 /*
2 * Copyright (C) 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 "secure_user_info_test.h"
17
18 #include "iam_common_defines.h"
19 #include "secure_user_info_impl.h"
20
21 namespace OHOS {
22 namespace UserIam {
23 namespace UserAuth {
24 using namespace testing;
25 using namespace testing::ext;
26
SetUpTestCase()27 void SecureUserInfoTest::SetUpTestCase()
28 {
29 }
30
TearDownTestCase()31 void SecureUserInfoTest::TearDownTestCase()
32 {
33 }
34
SetUp()35 void SecureUserInfoTest::SetUp()
36 {
37 }
38
TearDown()39 void SecureUserInfoTest::TearDown()
40 {
41 }
42
43 HWTEST_F(SecureUserInfoTest, GetUserId, TestSize.Level0)
44 {
45 constexpr int32_t userId = 100;
46 constexpr uint64_t secUserId = 200;
47 std::vector<std::shared_ptr<EnrolledInfoInterface>> info = {nullptr};
48 SecureUserInfoImpl secureUserInfoImpl(userId, secUserId, info);
49 int32_t ret = secureUserInfoImpl.GetUserId();
50 EXPECT_EQ(ret, userId);
51 }
52
53 HWTEST_F(SecureUserInfoTest, GetSecUserId, TestSize.Level0)
54 {
55 constexpr int32_t userId = 100;
56 constexpr uint64_t secUserId = 200;
57 std::vector<std::shared_ptr<EnrolledInfoInterface>> info = {nullptr};
58 SecureUserInfoImpl secureUserInfoImpl(userId, secUserId, info);
59 uint64_t ret = secureUserInfoImpl.GetSecUserId();
60 EXPECT_EQ(ret, secUserId);
61 }
62
63 HWTEST_F(SecureUserInfoTest, GetEnrolledInfo, TestSize.Level0)
64 {
65 constexpr int32_t userId = 100;
66 constexpr uint64_t secUserId = 200;
67 std::vector<std::shared_ptr<EnrolledInfoInterface>> info = {nullptr};
68 SecureUserInfoImpl secureUserInfoImpl(userId, secUserId, info);
69 auto ret = secureUserInfoImpl.GetEnrolledInfo();
70 EXPECT_EQ(ret, info);
71 }
72 } // namespace UserAuth
73 } // namespace UserIam
74 } // namespace OHOS
75