• 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 <cstring>
17 #include <gtest/gtest.h>
18 #include <securec.h>
19 
20 #include "lnn_decision_db_deps_mock.h"
21 #include "lnn_file_utils.h"
22 #include "softbus_adapter_file.h"
23 #include "softbus_error_code.h"
24 
25 namespace OHOS {
26 using namespace testing::ext;
27 using namespace testing;
28 
29 class LNNFileUtilsTest : public testing::Test {
30 public:
31     static void SetUpTestCase();
32     static void TearDownTestCase();
33     void SetUp();
34     void TearDown();
35 };
36 
SetUpTestCase()37 void LNNFileUtilsTest::SetUpTestCase() { }
38 
TearDownTestCase()39 void LNNFileUtilsTest::TearDownTestCase() { }
40 
SetUp()41 void LNNFileUtilsTest::SetUp() { }
42 
TearDown()43 void LNNFileUtilsTest::TearDown() { }
44 
45 /*
46  * @tc.name: LNN_REMOVE_STORAGE_CONFIG_PATH_TEST_001
47  * @tc.desc: LnnRemoveStorageConfigPathTest
48  * @tc.type: FUNC
49  * @tc.require:
50  */
51 HWTEST_F(LNNFileUtilsTest, LNN_REMOVE_STORAGE_CONFIG_PATH_TEST_001, TestSize.Level1)
52 {
53     DecisionDbDepsInterfaceMock decisionDbMock;
54     EXPECT_CALL(decisionDbMock, LnnGetFullStoragePath(_, _, _))
55         .WillOnce(Return(SOFTBUS_FILE_ERR)).WillRepeatedly(Return(SOFTBUS_OK));
56 
57     int32_t ret = LnnRemoveStorageConfigPath(LNN_FILE_ID_UUID);
58     EXPECT_TRUE(ret == SOFTBUS_FILE_ERR);
59     ret = LnnRemoveStorageConfigPath(LNN_FILE_ID_IRK_KEY);
60     EXPECT_TRUE(ret == SOFTBUS_OK);
61 }
62 } // namespace OHOS