• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <gtest/gtest.h>
17 
18 #include "account_command.h"
19 #include "account_command_util.h"
20 
21 using namespace testing::ext;
22 using namespace OHOS;
23 using namespace OHOS::AAFwk;
24 using namespace OHOS::AccountSA;
25 
26 class AccountCommandCreateModuleTest : public testing::Test {
27 public:
28     static void SetUpTestCase();
29     static void TearDownTestCase();
30     void SetUp() override;
31     void TearDown() override;
32 
33     std::string cmd_ = "create";
34 };
35 
SetUpTestCase()36 void AccountCommandCreateModuleTest::SetUpTestCase()
37 {}
38 
TearDownTestCase()39 void AccountCommandCreateModuleTest::TearDownTestCase()
40 {}
41 
SetUp()42 void AccountCommandCreateModuleTest::SetUp()
43 {}
44 
TearDown()45 void AccountCommandCreateModuleTest::TearDown()
46 {}
47 
48 /**
49  * @tc.name: Acm_Command_Create_0100
50  * @tc.desc: Verify the "acm create -n <local-account-name> -t <type>" command.
51  * @tc.type: FUNC
52  * @tc.require: SR000GGVFO
53  */
54 HWTEST_F(AccountCommandCreateModuleTest, Acm_Command_Create_0100, TestSize.Level1)
55 {
56     std::string commandResult = AccountCommandUtil::CreateOsAccount();
57     ASSERT_NE(commandResult.find(STRING_CREATE_OS_ACCOUNT_OK), std::string::npos);
58 
59     commandResult = AccountCommandUtil::DeleteLastOsAccount();
60     ASSERT_NE(commandResult.find(STRING_DELETE_OS_ACCOUNT_OK), std::string::npos);
61 }
62