1 /*
2 * Copyright (c) 2023 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 "os_account_wrapper_test.h"
17
18 #include <cstring>
19 #include <gtest/gtest.h>
20
21 #include "os_account_wrapper.h"
22
23 using namespace testing::ext;
24 namespace UnitTest::AssetOsAccountWrapperTest {
25 class AssetOsAccountWrapperTest : public testing::Test {
26 public:
27 static void SetUpTestCase(void);
28
29 static void TearDownTestCase(void);
30
31 void SetUp(void);
32
33 void TearDown(void);
34 };
35
SetUpTestCase(void)36 void AssetOsAccountWrapperTest::SetUpTestCase(void)
37 {
38 }
39
TearDownTestCase(void)40 void AssetOsAccountWrapperTest::TearDownTestCase(void)
41 {
42 }
43
SetUp(void)44 void AssetOsAccountWrapperTest::SetUp(void)
45 {
46 }
47
TearDown(void)48 void AssetOsAccountWrapperTest::TearDown(void)
49 {
50 }
51
52 /**
53 * @tc.name: AssetOsAccountWrapperTest.AssetOsAccountWrapperTest001
54 * @tc.desc: Test asset func GetOwnerInfo, expect ACCESS_TOKEN_ERROR
55 * @tc.type: FUNC
56 * @tc.result:0
57 */
58 HWTEST_F(AssetOsAccountWrapperTest, AssetOsAccountWrapperTest001, TestSize.Level0)
59 {
60 uint32_t userId = 1000;
61 uint32_t uid = 6226;
62 ASSERT_EQ(true, GetUserIdByUid(uid, &userId));
63 }
64
65 /**
66 * @tc.name: AssetOsAccountWrapperTest.AssetOsAccountWrapperTest002
67 * @tc.desc: Test asset func GetOwnerInfo, expect BMS_ERROR
68 * @tc.type: FUNC
69 * @tc.result:0
70 */
71 HWTEST_F(AssetOsAccountWrapperTest, AssetOsAccountWrapperTest002, TestSize.Level0)
72 {
73 uint32_t userId = 1000;
74 uint32_t uid = 100;
75 ASSERT_EQ(true, GetUserIdByUid(uid, &userId));
76 }
77 }