From 395a8e3fff0122c117d7bc276625171bcf28976a Mon Sep 17 00:00:00 2001 From: 15829070344 <hehaitao5@huawei.com> Date: Tue, 25 Oct 2022 22:11:39 +0800 Subject: [PATCH] add account testcases Signed-off-by: 15829070344 <hehaitao5@huawei.com> --- account/OsAccountTest_js/src/main/config.json | 6 +- .../src/main/js/test/ActsDSGetSet.test.js | 297 ++ .../src/main/js/test/List.test.js | 2 + .../src/main/js/test/OsAccount.test.js | 137 +- account/appaccount/BUILD.gn | 4 + .../actsaccountoperatetest/BUILD.gn | 36 + .../actsaccountoperatetest/Test.json | 24 + .../signature/openharmony_sx.p7b | Bin 0 -> 3442 bytes .../src/main/config.json | 114 + .../src/main/js/MainAbility/app.js | 22 + .../src/main/js/MainAbility/i18n/en-US.json | 6 + .../src/main/js/MainAbility/i18n/zh-CN.json | 6 + .../main/js/MainAbility/pages/index/index.css | 24 + .../main/js/MainAbility/pages/index/index.hml | 20 + .../main/js/MainAbility/pages/index/index.js | 27 + .../src/main/js/TestAbility/app.js | 31 + .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../main/js/TestAbility/pages/index/index.css | 49 + .../main/js/TestAbility/pages/index/index.hml | 21 + .../main/js/TestAbility/pages/index/index.js | 26 + .../js/TestRunner/OpenHarmonyTestRunner.js | 59 + .../main/js/test/AccountCredential.test.js | 677 ++++ .../src/main/js/test/AccountManager.test.js | 95 + .../src/main/js/test/AuthToken.test.js | 3423 +++++++++++++++++ .../src/main/js/test/Authenticator.test.js | 725 ++++ .../src/main/js/test/ChangeOnOff.js | 450 +++ .../src/main/js/test/CreateAccount.test.js | 659 ++++ .../src/main/js/test/CustomData.test.js | 1195 ++++++ .../src/main/js/test/ErrCode.test.js | 3309 ++++++++++++++++ .../src/main/js/test/ErrPermission.test.js | 241 ++ .../src/main/js/test/List.test.js | 38 + .../src/main/js/test/RemoveAccount.test.js | 248 ++ .../src/main/js/test/SetAppAccess.test.js | 569 +++ .../main/resources/base/element/string.json | 28 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes account/appaccount/actsaccounttest/Test.json | 3 +- .../src/main/js/test/AddAccount.test.js | 7 +- .../src/main/js/test/AssociatedData.test.js | 1 - .../src/main/js/test/Authenticator.test.js | 108 +- .../src/main/js/test/OAuthToken.test.js | 98 +- .../actsaccounttest/src/main/js/test/OnOff.js | 6 +- .../main/ets/test/AuthTokenInfoTest.test.ets | 81 + .../entry/src/main/ets/test/List.test.ets | 2 + .../actsgetaccountsbyowner/BUILD.gn | 36 + .../actsgetaccountsbyowner/Test.json | 20 + .../signature/openharmony_sx.p7b | Bin 0 -> 3442 bytes .../src/main/config.json | 127 + .../src/main/js/MainAbility/app.js | 22 + .../src/main/js/MainAbility/i18n/en-US.json | 6 + .../src/main/js/MainAbility/i18n/zh-CN.json | 6 + .../main/js/MainAbility/pages/index/index.css | 24 + .../main/js/MainAbility/pages/index/index.hml | 19 + .../main/js/MainAbility/pages/index/index.js | 30 + .../src/main/js/TestAbility/app.js | 31 + .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../main/js/TestAbility/pages/index/index.css | 50 + .../main/js/TestAbility/pages/index/index.hml | 21 + .../main/js/TestAbility/pages/index/index.js | 26 + .../js/TestRunner/OpenHarmonyTestRunner.js | 59 + .../main/js/test/Getaccountsbyowner.test.js | 647 ++++ .../src/main/js/test/List.test.js | 19 + .../main/resources/base/element/string.json | 28 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../appaccount/actsgetallaccounts/Test.json | 4 +- .../actsgetallaccounts/src/main/config.json | 6 +- .../src/main/js/test/Getallaccounts.test.js | 36 +- .../actssetcheckdatasyncenable/BUILD.gn | 36 + .../actssetcheckdatasyncenable/Test.json | 19 + .../signature/openharmony_sx.p7b | Bin 0 -> 3442 bytes .../src/main/config.json | 131 + .../src/main/js/MainAbility/app.js | 22 + .../src/main/js/MainAbility/i18n/en-US.json | 6 + .../src/main/js/MainAbility/i18n/zh-CN.json | 6 + .../main/js/MainAbility/pages/index/index.css | 24 + .../main/js/MainAbility/pages/index/index.hml | 19 + .../main/js/MainAbility/pages/index/index.js | 32 + .../src/main/js/TestAbility/app.js | 31 + .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../main/js/TestAbility/pages/index/index.css | 50 + .../main/js/TestAbility/pages/index/index.hml | 21 + .../main/js/TestAbility/pages/index/index.js | 26 + .../js/TestRunner/OpenHarmonyTestRunner.js | 59 + .../src/main/js/test/List.test.js | 19 + .../src/main/js/test/Syncenable.test.js | 575 +++ .../main/resources/base/element/string.json | 28 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes account/appaccount/getallaccounts/BUILD.gn | 24 + .../getallaccountsnoparameter/BUILD.gn | 36 + .../getallaccountsnoparameter/Test.json | 20 + .../signature/openharmony_sx.p7b | Bin 0 -> 3442 bytes .../src/main/config.json | 127 + .../src/main/js/MainAbility/app.js | 22 + .../src/main/js/MainAbility/i18n/en-US.json | 6 + .../src/main/js/MainAbility/i18n/zh-CN.json | 6 + .../main/js/MainAbility/pages/index/index.css | 24 + .../main/js/MainAbility/pages/index/index.hml | 19 + .../main/js/MainAbility/pages/index/index.js | 31 + .../src/main/js/TestAbility/app.js | 31 + .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../main/js/TestAbility/pages/index/index.css | 37 + .../main/js/TestAbility/pages/index/index.hml | 21 + .../main/js/TestAbility/pages/index/index.js | 26 + .../js/TestRunner/OpenHarmonyTestRunner.js | 59 + .../src/main/js/test/Getallaccounts.test.js | 600 +++ .../src/main/js/test/List.test.js | 19 + .../main/resources/base/element/string.json | 28 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../getmultipleaccounts/BUILD.gn | 36 + .../getmultipleaccounts/Test.json | 21 + .../signature/openharmony_sx.p7b | Bin 0 -> 3442 bytes .../getmultipleaccounts/src/main/config.json | 127 + .../src/main/js/MainAbility/app.js | 22 + .../src/main/js/MainAbility/i18n/en-US.json | 6 + .../src/main/js/MainAbility/i18n/zh-CN.json | 6 + .../main/js/MainAbility/pages/index/index.css | 24 + .../main/js/MainAbility/pages/index/index.hml | 19 + .../main/js/MainAbility/pages/index/index.js | 30 + .../src/main/js/TestAbility/app.js | 31 + .../src/main/js/TestAbility/i18n/en-US.json | 8 + .../src/main/js/TestAbility/i18n/zh-CN.json | 8 + .../main/js/TestAbility/pages/index/index.css | 37 + .../main/js/TestAbility/pages/index/index.hml | 21 + .../main/js/TestAbility/pages/index/index.js | 26 + .../js/TestRunner/OpenHarmonyTestRunner.js | 59 + .../main/js/test/Getmultipleaccounts.test.js | 130 + .../src/main/js/test/List.test.js | 19 + .../main/resources/base/element/string.json | 28 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../src/main/js/default/pages/index/index.js | 47 +- .../src/main/js/default/pages/index/index.js | 27 +- .../main/js/MainAbility/pages/index/index.js | 39 +- .../src/main/js/ServiceAbility/service.js | 158 +- .../entry/src/main/config.json | 2 +- .../src/main/js/default/pages/index/index.js | 23 +- .../src/main/js/default/pages/index/index.js | 8 +- .../src/main/js/default/pages/index/index.js | 8 +- .../src/main/js/default/pages/index/index.js | 174 +- .../src/main/js/default/pages/index/index.js | 10 +- .../src/main/js/test/List.test.js | 4 + .../src/main/js/test/OsAccountCheck.test.js | 520 +++ .../src/main/js/test/OsAccountQuery.test.js | 698 ++++ 145 files changed, 18530 insertions(+), 241 deletions(-) create mode 100644 account/OsAccountTest_js/src/main/js/test/ActsDSGetSet.test.js create mode 100644 account/appaccount/actsaccountoperatetest/BUILD.gn create mode 100644 account/appaccount/actsaccountoperatetest/Test.json create mode 100644 account/appaccount/actsaccountoperatetest/signature/openharmony_sx.p7b create mode 100644 account/appaccount/actsaccountoperatetest/src/main/config.json create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/app.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/i18n/en-US.json create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/i18n/zh-CN.json create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/pages/index/index.css create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/pages/index/index.hml create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/pages/index/index.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/app.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/i18n/en-US.json create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/pages/index/index.css create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/pages/index/index.hml create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/pages/index/index.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/test/AccountCredential.test.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/test/AccountManager.test.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/test/AuthToken.test.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/test/Authenticator.test.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/test/ChangeOnOff.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/test/CreateAccount.test.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/test/CustomData.test.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/test/ErrCode.test.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/test/ErrPermission.test.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/test/List.test.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/test/RemoveAccount.test.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/js/test/SetAppAccess.test.js create mode 100644 account/appaccount/actsaccountoperatetest/src/main/resources/base/element/string.json create mode 100644 account/appaccount/actsaccountoperatetest/src/main/resources/base/media/icon.png create mode 100644 account/appaccount/actsaccounttstest/entry/src/main/ets/test/AuthTokenInfoTest.test.ets create mode 100644 account/appaccount/actsgetaccountsbyowner/BUILD.gn create mode 100644 account/appaccount/actsgetaccountsbyowner/Test.json create mode 100644 account/appaccount/actsgetaccountsbyowner/signature/openharmony_sx.p7b create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/config.json create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/app.js create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/i18n/en-US.json create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/i18n/zh-CN.json create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/pages/index/index.css create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/pages/index/index.hml create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/pages/index/index.js create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/app.js create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/i18n/en-US.json create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/pages/index/index.css create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/pages/index/index.hml create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/pages/index/index.js create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/test/Getaccountsbyowner.test.js create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/js/test/List.test.js create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/resources/base/element/string.json create mode 100644 account/appaccount/actsgetaccountsbyowner/src/main/resources/base/media/icon.png create mode 100644 account/appaccount/actssetcheckdatasyncenable/BUILD.gn create mode 100644 account/appaccount/actssetcheckdatasyncenable/Test.json create mode 100644 account/appaccount/actssetcheckdatasyncenable/signature/openharmony_sx.p7b create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/config.json create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/app.js create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/i18n/en-US.json create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/i18n/zh-CN.json create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/pages/index/index.css create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/pages/index/index.hml create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/pages/index/index.js create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/app.js create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/i18n/en-US.json create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/pages/index/index.css create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/pages/index/index.hml create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/pages/index/index.js create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/test/List.test.js create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/js/test/Syncenable.test.js create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/resources/base/element/string.json create mode 100644 account/appaccount/actssetcheckdatasyncenable/src/main/resources/base/media/icon.png create mode 100644 account/appaccount/getallaccounts/BUILD.gn create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/BUILD.gn create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/Test.json create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/signature/openharmony_sx.p7b create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/config.json create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/app.js create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/i18n/en-US.json create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/i18n/zh-CN.json create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/pages/index/index.css create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/pages/index/index.hml create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/pages/index/index.js create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/app.js create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/i18n/en-US.json create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/pages/index/index.css create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/pages/index/index.hml create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/pages/index/index.js create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/test/Getallaccounts.test.js create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/test/List.test.js create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/resources/base/element/string.json create mode 100644 account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/resources/base/media/icon.png create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/BUILD.gn create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/Test.json create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/signature/openharmony_sx.p7b create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/config.json create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/app.js create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/i18n/en-US.json create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/i18n/zh-CN.json create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/pages/index/index.css create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/pages/index/index.hml create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/pages/index/index.js create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/app.js create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/i18n/en-US.json create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/i18n/zh-CN.json create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/pages/index/index.css create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/pages/index/index.hml create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/pages/index/index.js create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestRunner/OpenHarmonyTestRunner.js create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/test/Getmultipleaccounts.test.js create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/test/List.test.js create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/resources/base/element/string.json create mode 100644 account/appaccount/getallaccounts/getmultipleaccounts/src/main/resources/base/media/icon.png create mode 100644 account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountCheck.test.js create mode 100644 account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountQuery.test.js diff --git a/account/OsAccountTest_js/src/main/config.json b/account/OsAccountTest_js/src/main/config.json index fd7e2fd62..bd9e2e067 100644 --- a/account/OsAccountTest_js/src/main/config.json +++ b/account/OsAccountTest_js/src/main/config.json @@ -18,7 +18,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ - "default", + "default", "phone" ], "distro": { @@ -37,6 +37,10 @@ { "name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS", "reason": "ceshi" + }, + { + "name": "ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS", + "reason": "ceshi" } ], "abilities": [ diff --git a/account/OsAccountTest_js/src/main/js/test/ActsDSGetSet.test.js b/account/OsAccountTest_js/src/main/js/test/ActsDSGetSet.test.js new file mode 100644 index 000000000..7758e1912 --- /dev/null +++ b/account/OsAccountTest_js/src/main/js/test/ActsDSGetSet.test.js @@ -0,0 +1,297 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// @ts-nocheck +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, done } from '@ohos/hypium' + +import account from '@ohos.account.distributedAccount' +const LOGININFO = { + name: 'ZhangSan', + id: '12345', + event: "Ohos.account.event.LOGIN" +} +const LOGOUTINFO = { + name: 'ZhangSan', + id: '12345', + event: "Ohos.account.event.LOGOUT" +} +export default function ActsDAGetSetTest() { + describe('ActsDAGetSetTest', function () { + beforeEach(function () { + }) + afterEach(function () { + }) + + /** + * @tc.number ActsDistributedAccountDeviceId_0100 + * @tc.name Test query the distribruted id by callback. + * @tc.desc Test distributedAccount.getOsAccountDistributedInfo API functionality by callback. + */ + it('ActsDistributedAccountDeviceId_0100', 0, async function(done){ + console.log("====>test query distribtued id start"); + const distributedId = '5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5'; //'12345'sha256的值 + const accountAbility = account.getDistributedAccountAbility(); + accountAbility.setOsAccountDistributedInfo(LOGININFO, (err)=>{ + console.log("====>set distributedInfo err:" + JSON.stringify(err)); + accountAbility.getOsAccountDistributedInfo((err, distributedInfo)=>{ + console.log("====>get distributedInfo err:" + JSON.stringify(err)); + console.log("====>get distributedInfo:" + JSON.stringify(distributedInfo)); + expect(distributedInfo.name).assertEqual('ZhangSan'); + expect(distributedInfo.id).assertEqual(distributedId); + accountAbility.setOsAccountDistributedInfo(LOGOUTINFO, (err)=>{ + console.debug('====>ActsDistributedAccountDeviceId_0100 logout_result:'+ JSON.stringify(err)) + expect(err).assertEqual(null) + console.log("====>test query distribtued id end"); + done(); + }) + }) + }) + }) + + /** + * @tc.number SUB_Account_distributedAccount_JS_API_0100 + * @tc.name Test distributedAccount.getDistributedAccountAbility. + * @tc.desc Test distributedAccount.getDistributedAccountAbility API functionality. + */ + it('account_getDistributedAccountAbility_test', 0, async function (done) { + var ret = false; + const accountAbility = account.getDistributedAccountAbility() + console.debug("====>account_getDistributedAccountAbility_test result:" + JSON.stringify(accountAbility)) + if(accountAbility !== null){ + ret = true; + } + expect(ret).assertTrue() + done(); + }) + + /** + * @tc.number SUB_Account_distributedAccount_JS_API_0200 + * @tc.name Test distributedAccount.getOsAccountDistributedInfo. + * @tc.desc Test distributedAccount.getOsAccountDistributedInfo API functionality. + */ + it('account_getOsAccountDistributedInfo_test001', 0, async function (done) { + let accountAbility = account.getDistributedAccountAbility() + accountAbility.getOsAccountDistributedInfo().then(function (data) { + console.debug('====>account_getOsAccountDistributedInfo_test001 data:' + JSON.stringify(data)) + expect(data.name).assertEqual('ohosAnonymousName') + expect(data.id).assertEqual('ohosAnonymousUid') + done(); + }); + }) + + /** + * @tc.number SUB_Account_distributedAccount_JS_API_0300 + * @tc.name Test distributedAccount.getOsAccountDistributedInfo by callback. + * @tc.desc Test distributedAccount.getOsAccountDistributedInfo API functionality by callback. + */ + it('account_getOsAccountDistributedInfo_test002', 0, async function (done) { + let accountAbility = account.getDistributedAccountAbility() + accountAbility.getOsAccountDistributedInfo(function (err, data) { + console.debug('====>account_getOsAccountDistributedInfo_test002 err:' + JSON.stringify(err)) + console.debug('====>account_getOsAccountDistributedInfo_test002 data:' + JSON.stringify(data)) + expect(err).assertEqual(null) + expect(data.name).assertEqual('ohosAnonymousName') + expect(data.id).assertEqual('ohosAnonymousUid') + done(); + }); + }) + + /** + * @tc.number SUB_Account_distributedAccount_JS_API_0400 + * @tc.name Test distributedAccount.setOsAccountDistributedInfo. + * @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality. + */ + it('account_setOsAccountDistributedInfo_test001', 0, async function (done) { + const accountAbility = account.getDistributedAccountAbility() + let obj = { + id: '12345', + name: 'ZhangSan', + event: 'Ohos.account.event.LOGIN', + scalableData:{} + }; + accountAbility.setOsAccountDistributedInfo(obj).then(function () { + accountAbility.getOsAccountDistributedInfo(function (data) { + console.debug('====>account_setOsAccountDistributedInfo_test001 data:' + JSON.stringify(data)) + expect(data.name).assertEqual('ZhangSan') + expect(data.id).assertEqual('12345') + let obj = { + id: '12345', + name: 'ZhangSan', + event: 'Ohos.account.event.LOGOUT' + }; + accountAbility.setOsAccountDistributedInfo(obj).then(function (err) { + expect(err).assertEqual(null) + }); + }); + }); + accountAbility.getOsAccountDistributedInfo(function (data) { + console.debug('====>account_setOsAccountDistributedInfo_test001 get data:' + JSON.stringify(data)) + expect(data).assertEqual(null) + done(); + }) + }) + + /** + * @tc.number SUB_Account_distributedAccount_JS_API_0500 + * @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback. + * @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback. + */ + it('account_setOsAccountDistributedInfo_test002', 0, async function (done) { + var accountAbility = account.getDistributedAccountAbility() + let obj = { + id: '12345', + name: 'ZhangSan', + event: 'Ohos.account.event.LOGIN', + scalableData:{} + }; + accountAbility.setOsAccountDistributedInfo(obj, function () { + accountAbility.getOsAccountDistributedInfo(function (err, data) { + console.debug("====>account_setOsAccountDistributedInfo_test002 data:" + JSON.stringify(data)) + expect(data.name).assertEqual('ZhangSan') + expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5') + let obj = { + id: '12345', + name: 'ZhangSan', + event: 'Ohos.account.event.LOGOUT' + }; + accountAbility.setOsAccountDistributedInfo(obj).then(function (data) { + expect(data).assertEqual(null) + done(); + }); + }); + }); + }) + + /** + * @tc.number SUB_Account_distributedAccount_JS_API_0300 + * @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback. + * @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback. + */ + it('account_setOsAccountDistributedInfo_test003', 0, function () { + const accountAbility = account.getDistributedAccountAbility() + let obj = { + id: '12345', + name: 'ZhangSan', + event: 'Ohos.account.event.TOKEN_INVALID', + scalableData:{} + }; + accountAbility.setOsAccountDistributedInfo(obj, function (result) { + console.debug("====>account_setOsAccountDistributedInfo_test003 update_err:" + JSON.stringify(result)) + accountAbility.getOsAccountDistributedInfo(obj).then(function (data) { + console.debug("====>account_setOsAccountDistributedInfo_test003 data:" + JSON.stringify(data)) + expect(data.name).assertNull() + done(); + }) + }); + }) + + /** + * @tc.number SUB_Account_distributedAccount_JS_API_0500 + * @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback. + * @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback. + */ + it('account_setOsAccountDistributedInfo_test004', 0, function () { + const accountAbility = account.getDistributedAccountAbility() + let obj = { + id: '12345', + name: 'ZhangSan', + event: 'Ohos.account.event.LOGIN', + scalableData:{} + }; + accountAbility.setOsAccountDistributedInfo(obj, function (err) { + console.debug("====>account_setOsAccountDistributedInfo_test004 update_err:" + JSON.stringify(err)) + accountAbility.getOsAccountDistributedInfo(function (err, data) { + console.debug("====>account_setOsAccountDistributedInfo_test004 query_err:" + JSON.stringify(err)) + console.debug("====>account_setOsAccountDistributedInfo_test004 query_data:" + JSON.stringify(data)) + expect(data.name).assertEqual('ZhangSan') + expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5') + let obj = { + id: '12345', + name: 'ZhangSan', + event: 'Ohos.account.event.LOGOFF' + }; + accountAbility.setOsAccountDistributedInfo(obj).then(function (result) { + expect(err).assert(null) + done(); + }); + }); + }); + }) + + /** + * @tc.number SUB_Account_distributedAccount_JS_API_0600 + * @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback. + * @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback. + */ + it('account_setOsAccountDistributedInfo_test005', 0, function () { + const accountAbility = account.getDistributedAccountAbility() + let obj = { + id: '12345', + name: 'ZhangSan', + event: 'Ohos.account.event.LOGIN', + scalableData:{age:'12'} + }; + accountAbility.setOsAccountDistributedInfo(obj, function (err) { + console.debug("====>account_setOsAccountDistributedInfo_test005 update_err:" + JSON.stringify(err)) + accountAbility.getOsAccountDistributedInfo(function (err, data) { + console.debug("====>account_setOsAccountDistributedInfo_test005 query_err:" + JSON.stringify(err)) + console.debug("====>account_setOsAccountDistributedInfo_test005 query_data:" + JSON.stringify(data)) + expect(data.scalableData.age).assertEqual('12') + let obj = { + id: '12345', + name: 'ZhangSan', + event: 'Ohos.account.event.LOGOFF' + }; + accountAbility.setOsAccountDistributedInfo(obj).then(function (result) { + expect(err).assert(null) + done(); + }); + }); + }); + }) + + /** + * @tc.number SUB_Account_distributedAccount_JS_API_0700 + * @tc.name Test distributedAccount.setOsAccountDistributedInfo by callback. + * @tc.desc Test distributedAccount.setOsAccountDistributedInfo API functionality by callback. + */ + it('account_setOsAccountDistributedInfo_test006', 0, function () { + const accountAbility = account.getDistributedAccountAbility() + let obj = { + id: '12345', + name: 'ZhangSan', + event: 'Ohos.account.event.LOGIN', + scalableData:{age:'12'} + }; + accountAbility.setOsAccountDistributedInfo(obj, function (err) { + console.debug("====>account_setOsAccountDistributedInfo_test006 update_err:" + JSON.stringify(err)) + accountAbility.getOsAccountDistributedInfo(function (err, data) { + console.debug("====>account_setOsAccountDistributedInfo_test006 query_err:" + JSON.stringify(err)) + console.debug("====>account_setOsAccountDistributedInfo_test006 query_data:" + JSON.stringify(data)) + expect(data.scalableData.age).assertEqual('12') + let obj = { + id: '12345', + name: 'ZhangSan', + event: 'Ohos.account.event.LOGOFF' + }; + accountAbility.setOsAccountDistributedInfo(obj).then(function (result) { + expect(err).assert(null) + done(); + }); + }); + }); + }) + }) +} diff --git a/account/OsAccountTest_js/src/main/js/test/List.test.js b/account/OsAccountTest_js/src/main/js/test/List.test.js index 90369e959..f536b6e8b 100755 --- a/account/OsAccountTest_js/src/main/js/test/List.test.js +++ b/account/OsAccountTest_js/src/main/js/test/List.test.js @@ -13,7 +13,9 @@ * limitations under the License. */ import AccountTest from './OsAccount.test.js' +import ActsDAGetSetTest from './ActsDSGetSet.test.js' export default function testsuite() { AccountTest() + ActsDAGetSetTest() } \ No newline at end of file diff --git a/account/OsAccountTest_js/src/main/js/test/OsAccount.test.js b/account/OsAccountTest_js/src/main/js/test/OsAccount.test.js index 72b910a12..d94d89f05 100755 --- a/account/OsAccountTest_js/src/main/js/test/OsAccount.test.js +++ b/account/OsAccountTest_js/src/main/js/test/OsAccount.test.js @@ -14,9 +14,19 @@ */ // @ts-nocheck -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, done } from '@ohos/hypium' import account from '@ohos.account.distributedAccount' +const LOGININFO = { + name: 'ZhangSan', + id: '12345', + event: "Ohos.account.event.LOGIN" +} +const LOGOUTINFO = { + name: 'ZhangSan', + id: '12345', + event: "Ohos.account.event.LOGOUT" +} export default function AccountTest() { describe('AccountTest', function () { beforeEach(function () { @@ -29,24 +39,25 @@ export default function AccountTest() { * @tc.name Test query the distribruted id by callback. * @tc.desc Test distributedAccount.queryOsAccountDistributedInfo API functionality by callback. */ - it('ActsDistributedAccountDeviceId_0100', 0, async function(done){ - console.log("test query distribtued id start"); - const distributedId = '5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5'; + it('ActsDistributedAccountDeviceId_0100', 0, async function(done){ + console.log("====>test query distribtued id start"); + const distributedId = '5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5'; //'12345'sha256的值 const accountAbility = account.getDistributedAccountAbility(); - accountAbility.updateOsAccountDistributedInfo( - { - name: 'ZhangSan', - id: '12345', - event: "Ohos.account.event.LOGIN" - }, (err)=>{ - console.log("update distributedInfo err:" + JSON.stringify(err)); + accountAbility.updateOsAccountDistributedInfo(LOGININFO, (err)=>{ + console.log("====>update distributedInfo err:" + JSON.stringify(err)); accountAbility.queryOsAccountDistributedInfo((err, distributedInfo)=>{ - console.log("query distributedInfo err:" + JSON.stringify(err)); - console.log("query distributedInfo:" + JSON.stringify(distributedInfo)); + console.log("====>query distributedInfo err:" + JSON.stringify(err)); + console.log("====>query distributedInfo:" + JSON.stringify(distributedInfo)); expect(distributedInfo.name).assertEqual('ZhangSan'); expect(distributedInfo.id).assertEqual(distributedId); - console.log("test query distribtued id end"); - done(); + console.debug('success') + accountAbility.updateOsAccountDistributedInfo(LOGOUTINFO, (err)=>{ + console.debug('====>ActsDistributedAccountDeviceId_0100 logout_result:'+ JSON.stringify(err)) + expect(err).assertEqual(undefined) + console.log("====>test query distribtued id end"); + done(); + }) + }) }) }) @@ -56,13 +67,15 @@ export default function AccountTest() { * @tc.name Test distributedAccount.getDistributedAccountAbility. * @tc.desc Test distributedAccount.getDistributedAccountAbility API functionality. */ - it('account_getDistributedAccountAbility_test', 0, function () { + it('account_getDistributedAccountAbility_test', 0, async function (done) { var ret = false; const accountAbility = account.getDistributedAccountAbility() + console.debug("====>account_getDistributedAccountAbility_test result:" + JSON.stringify(accountAbility)) if(accountAbility !== null){ ret = true; } expect(ret).assertTrue() + done(); }) /** @@ -70,10 +83,13 @@ export default function AccountTest() { * @tc.name Test distributedAccount.queryOsAccountDistributedInfo. * @tc.desc Test distributedAccount.queryOsAccountDistributedInfo API functionality. */ - it('account_queryOsAccountDistributedInfo_test001', 0, function () { - const accountAbility = account.getDistributedAccountAbility() + it('account_queryOsAccountDistributedInfo_test001', 0, async function (done) { + let accountAbility = account.getDistributedAccountAbility() accountAbility.queryOsAccountDistributedInfo().then(function (data) { - expect(data.name).assertEqual('anonymous') + console.debug('====>account_queryOsAccountDistributedInfo_test001 data:' + JSON.stringify(data)) + expect(data.name).assertEqual('ohosAnonymousName') + expect(data.id).assertEqual('ohosAnonymousUid') + done(); }); }) @@ -82,10 +98,15 @@ export default function AccountTest() { * @tc.name Test distributedAccount.queryOsAccountDistributedInfo by callback. * @tc.desc Test distributedAccount.queryOsAccountDistributedInfo API functionality by callback. */ - it('account_queryOsAccountDistributedInfo_test002', 0, function () { - const accountAbility = account.getDistributedAccountAbility() - accountAbility.queryOsAccountDistributedInfo(function (data) { - expect(data.name).assertEqual('anonymous') + it('account_queryOsAccountDistributedInfo_test002', 0, async function (done) { + let accountAbility = account.getDistributedAccountAbility() + accountAbility.queryOsAccountDistributedInfo(function (err, data) { + console.debug('====>account_queryOsAccountDistributedInfo_test002 err:' + JSON.stringify(err)) + console.debug('====>account_queryOsAccountDistributedInfo_test002 data:' + JSON.stringify(data)) + expect(err).assertEqual(undefined) + expect(data.name).assertEqual('ohosAnonymousName') + expect(data.id).assertEqual('ohosAnonymousUid') + done(); }); }) @@ -94,18 +115,18 @@ export default function AccountTest() { * @tc.name Test distributedAccount.updateOsAccountDistributedInfo. * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality. */ - it('account_updateOsAccountDistributedInfo_test001', 0, function () { + it('account_updateOsAccountDistributedInfo_test001', 0, async function (done) { const accountAbility = account.getDistributedAccountAbility() - let data = null + let data = null let obj = { id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN', scalableData:data }; - accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) { - expect(result).assertTrue() + accountAbility.updateOsAccountDistributedInfo(obj).then(function () { accountAbility.queryOsAccountDistributedInfo(function (data) { + console.debug('====>account_updateOsAccountDistributedInfo_test001 data:' + JSON.stringify(data)) expect(data.name).assertEqual('ZhangSan') expect(data.id).assertEqual('12345') let obj = { @@ -113,13 +134,15 @@ export default function AccountTest() { name: 'ZhangSan', event: 'Ohos.account.event.LOGOUT' }; - accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) { - expect(result).assertTrue() + accountAbility.updateOsAccountDistributedInfo(obj).then(function (err) { + expect(err).assertEqual(undefined) }); }); }); accountAbility.queryOsAccountDistributedInfo(function (data) { - execpt(data).assertNull() + + expect(data).assertEqual(undefined) + done(); }) }) @@ -128,34 +151,32 @@ export default function AccountTest() { * @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback. * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback. */ - it('account_updateOsAccountDistributedInfo_test002', 0, function () { - let data = null - const accountAbility = account.getDistributedAccountAbility() + it('account_updateOsAccountDistributedInfo_test002', 0, async function (done) { + var accountAbility = account.getDistributedAccountAbility() let obj = { id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN', - scalableData:data + scalableData:{} }; - accountAbility.updateOsAccountDistributedInfo(obj, function (result) { - expect(result).assertTrue() - accountAbility.queryOsAccountDistributedInfo(function (data) { + accountAbility.updateOsAccountDistributedInfo(obj, function () { + accountAbility.queryOsAccountDistributedInfo(function (err, data) { + console.debug("====>account_updateOsAccountDistributedInfo_test002 data:" + JSON.stringify(data)) expect(data.name).assertEqual('ZhangSan') - expect(data.id).assertEqual('12345') - const accountAbility = account.getDistributedAccountAbility() + expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5') let obj = { id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGOUT' - }; - accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) { - expect(result).assertTrue() + accountAbility.updateOsAccountDistributedInfo(obj).then(function (data) { + expect(data).assertEqual(undefined) + done(); }); }); }); }) - + /** * @tc.number SUB_Account_distributedAccount_JS_API_0300 * @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback. @@ -163,7 +184,7 @@ export default function AccountTest() { */ it('account_updateOsAccountDistributedInfo_test003', 0, function () { const accountAbility = account.getDistributedAccountAbility() - let data = null + let data = null let obj = { id: '12345', name: 'ZhangSan', @@ -171,13 +192,15 @@ export default function AccountTest() { scalableData:data }; accountAbility.updateOsAccountDistributedInfo(obj, function (result) { - expect(result).assertTrue() + console.debug("====>account_updateOsAccountDistributedInfo_test003 update_err:" + JSON.stringify(result)) accountAbility.queryOsAccountDistributedInfo(obj).then(function (data) { - except(data.name).assertNull() + console.debug("====>account_updateOsAccountDistributedInfo_test003 data:" + JSON.stringify(data)) + expect(data.name).assertNull() + done(); }) }); }) - + /** * @tc.number SUB_Account_distributedAccount_JS_API_0500 * @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback. @@ -185,27 +208,27 @@ export default function AccountTest() { */ it('account_updateOsAccountDistributedInfo_test004', 0, function () { const accountAbility = account.getDistributedAccountAbility() - let data = null let obj = { id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGIN', - scalableData:data + scalableData:{} }; - accountAbility.updateOsAccountDistributedInfo(obj, function (result) { - expect(result).assertTrue() - accountAbility.queryOsAccountDistributedInfo(function (data) { + accountAbility.updateOsAccountDistributedInfo(obj, function (err) { + console.debug("====>account_updateOsAccountDistributedInfo_test004 update_err:" + JSON.stringify(err)) + accountAbility.queryOsAccountDistributedInfo(function (err, data) { + console.debug("====>account_updateOsAccountDistributedInfo_test004 query_err:" + JSON.stringify(err)) + console.debug("====>account_updateOsAccountDistributedInfo_test004 query_data:" + JSON.stringify(data)) expect(data.name).assertEqual('ZhangSan') - expect(data.id).assertEqual('12345') - const accountAbility = account.getDistributedAccountAbility() + expect(data.id).assertEqual('5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5') let obj = { id: '12345', name: 'ZhangSan', event: 'Ohos.account.event.LOGOFF' - }; - accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) { - expect(result).assertNull() + accountAbility.updateOsAccountDistributedInfo(obj).then(function (err) { + expect(err).assert(undefined) + done(); }); }); }); diff --git a/account/appaccount/BUILD.gn b/account/appaccount/BUILD.gn index c5a5c0d20..da882415b 100644 --- a/account/appaccount/BUILD.gn +++ b/account/appaccount/BUILD.gn @@ -17,11 +17,15 @@ group("appaccount_hap") { testonly = true if (is_standard_system) { deps = [ + "actsaccountoperatetest:ActsAccountOperateTest", "actsaccounttest:ActsAccountTest", "actsaccounttstest:ActsAccountTsTest", + "actsgetaccountsbyowner:ActsGetAccountsByOwnerTest", "actsgetallaccounts:ActsGetAllAccountsTest", + "actssetcheckdatasyncenable:ActsSetCheckDataSyncEnableTest", "actssetchecksyncenable:ActsSetCheckSyncEnableTest", "getallaccessibleaccounts:accessibleaccounts", + "getallaccounts:getallaccounts", "sceneProject:appaccount_scene", ] } diff --git a/account/appaccount/actsaccountoperatetest/BUILD.gn b/account/appaccount/actsaccountoperatetest/BUILD.gn new file mode 100644 index 000000000..7d6557649 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAccountOperateTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAccountOperateTest" + subsystem_name = "account" + part_name = "os_account" +} +ohos_js_assets("hjs_demo_js_assets") { + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" +} + +ohos_resources("hjs_demo_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/account/appaccount/actsaccountoperatetest/Test.json b/account/appaccount/actsaccountoperatetest/Test.json new file mode 100644 index 000000000..c6afc90a1 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/Test.json @@ -0,0 +1,24 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "3000000", + "bundle-name": "com.example.actsaccountoperatetest", + "package-name": "com.example.actsaccountoperatetest", + "shell-timeout": "3000000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAccountOperateTest.hap", + "ActsAccountSceneAppAccess.hap", + "ActsAccountSceneOnOff.hap", + "ActsAccountOauthtoken.hap", + "ActsAccountAuthenticator.hap", + "ActsAccountTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/account/appaccount/actsaccountoperatetest/signature/openharmony_sx.p7b b/account/appaccount/actsaccountoperatetest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6 GIT binary patch literal 3442 zcmcgvYj6|S6}BF>F-F+L*anwiBOa!J?7OmLOQwYEN~;%M$tz2?WlYUVT0LxOwU$<1 zS(Haa;)Zu=rr?H0Y#s&@105h3XNE^Z10^9aB$Vk;3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oP5C6 zu=&u(-?F=3+PLLX^`Uk9@;gSZIX~)1Y4^m}md%hyYj?I!kZis9K|na!Ys+Ug@xhdL zru;InpmTDvdF+lgeQm3OVQ#bfyD)l#-qEyWb065)Xj<QVX;=2enH}e}<606q9uXXm zZVd8hB6(uYa3s&MdPBqrk{3yb@+fXTA4Plyg(hwN^7NMd+48+BKipCGx0~?PeBt$+ zx9)z*ELZK@o%GG#JNY>uU3x?G-jR|WOX%tqr<eSMKG4*0_^cUJ9lE@6dU5%?UHjkP zl(Tu~-4!d+?_Ow~wBp{<g@<P5-n(_CckTBQ>vjhqhKbWtIr4vS?5W~5?1m9|5&+2u z{wqIMEdMQYXX)?mm3r#-oG#va{aE_xOBvS}yV6ZJbk=JtmW}sx>HmH4R#)aHw=Rw0 z#Ol<D0K2C&*lzBcCb|D^b>{~gHl)Aro86NYoABWEtHw3K8*7Q{w2fKg{!sST?8^mE zj0bZho5Q^hK*Mt><KT@t^dZvb1>+t)L{bD0H}=Exg$E`)GEx$uH11O5u0)^&a(S_= zqy`i|9u-1jVcuFgr(k5xqD<o)ap%leTc`f@<eg%?EUR~iyN`C<JKhRLKDx>ILM=e~ zc{#;vD-tsmmGjTOa;B*7yD=xXwyzeC*e}ny+-|#O-3sw1C7i80M~^ssbgpv!d$W#+ YX9HpW+h1JFRc8v8e%3PML|^*<0J%6(*8l(j literal 0 HcmV?d00001 diff --git a/account/appaccount/actsaccountoperatetest/src/main/config.json b/account/appaccount/actsaccountoperatetest/src/main/config.json new file mode 100644 index 000000000..90decaf4c --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/config.json @@ -0,0 +1,114 @@ +{ + "app": { + "bundleName": "com.example.actsaccountoperatetest", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsaccountoperatetest", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "reqPermissions": [ + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO", + "reason":"need use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } + } +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/app.js b/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/app.js new file mode 100644 index 000000000..2a68c1992 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/i18n/en-US.json b/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 000000000..e63c70d97 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/i18n/zh-CN.json b/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 000000000..de6ee5748 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/pages/index/index.css b/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 000000000..2334ecfa2 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/pages/index/index.hml b/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 000000000..f7fa13538 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,20 @@ +<!-- + Copyright (c) 2021 Huawei Device Co., Ltd. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<div class="container" onswipe="touchMove"> + <text class="title"> + {{title}} + </text> +</div> diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/pages/index/index.js b/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 000000000..6b8ed88c0 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + onInit() { + this.title = "ActsAccountOpertaeTest"; + }, + onShow() { + console.info('onShow finish') + }, + onReady() { + }, +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/app.js b/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/i18n/en-US.json b/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/i18n/zh-CN.json b/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/pages/index/index.css b/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..d63576316 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/pages/index/index.hml b/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ +<!-- + Copyright (c) 2021 Huawei Device Co., Ltd. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<div class="container" onswipe="touchMove"> + <text class="title"> + {{ $t('strings.hello') }} {{title}} + </text> + <input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input> +</div> diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/pages/index/index.js b/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/account/appaccount/actsaccountoperatetest/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/AccountCredential.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/AccountCredential.test.js new file mode 100644 index 000000000..934129765 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/AccountCredential.test.js @@ -0,0 +1,677 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import account from '@ohos.account.appAccount' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +const TIMEOUT = 5000; +const EACHTIMEOUT = 500; +export default function ActsAppAccountCredential() { + describe('ActsAppAccountCredential', function () { + function sleep(delay) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) + } + + beforeAll(async function (done) { + console.debug("====>beforeAll start===="); + await sleep(TIMEOUT); + console.debug("====>beforeAll end===="); + done(); + }) + + beforeEach(async function (done) { + console.debug("====>beforeEach enter===="); + await sleep(EACHTIMEOUT); + done(); + }) + + /* + * @tc.number : ActsAppAccountCredential_0100 + * @tc.name : The correct calls setAssociatedData and getCredential get the credential + * @tc.desc : The setCredential setting credential is called when the forwarding parameters + * are correct, and then getCredential is called for the credential(callback) + */ + it('ActsAppAccountCredential_0100', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_0100", (err)=>{ + console.debug("====>add account ActsAppAccountCredential_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setCredential("account_name_0100", "credentialType1", "credential1",(err)=>{ + console.debug("====>ActsAppAccountCredential_0100 setCredential:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getCredential("account_name_0100", "credentialType1", (err,data)=>{ + console.debug("====>getCredential 0100 err:" + JSON.stringify(err)); + console.debug("====>getCredential 0100 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual("credential1"); + appAccountManager.removeAccount("account_name_0100", (err)=>{ + console.debug("====>delete Account 0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAppAccountCredential_0100 end===="); + done(); + }); + }); + }); + }); + }); + + /* + * @tc.number : ActsAppAccountCredential_0200 + * @tc.name : The correct calls setCredential and getCredential get the credential + * @tc.desc : The setAssociatedData setting credential is called when the forwarding parameters + * are correct, and then getCredential is called for the credential(promise) + */ + it('ActsAppAccountCredential_0200', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add accountActsAppAccountCredential_0200 start===="); + await appAccountManager.createAccount("account_name_0200"); + console.debug("====>setCredential ActsAppAccountCredential_0200 start===="); + try{ + await appAccountManager.setCredential("account_name_0200", "credentialType2", "credential2"); + } + catch(err){ + console.error("setCredential ActsAppAccountCredential_0200 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getCredential ActsAppAccountCredential_0200 start===="); + try{ + var data = await appAccountManager.getCredential("account_name_0200", "credentialType2"); + } + catch(err){ + console.error("getCredential ActsAppAccountCredential_0200 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getCredential ActsAppAccountCredential_0200 data:" + JSON.stringify(data)); + expect(data).assertEqual("credential2"); + console.debug("====>delete account ActsAppAccountCredential_0200 start===="); + appAccountManager.removeAccount("account_name_0200") + console.debug("====>ActsAppAccountCredential_0200 end===="); + done(); + }); + + /* + * @tc.number : ActsAppAccountCredential_0300 + * @tc.name : Whether getAssociatedData can get the correct value when calling setCredential two times + * @tc.desc : When the first setCredential is called and the second setCredential + * is called,the setting of the credential is different if the call getCredential + * can get the second credential(callback) + */ + it('ActsAppAccountCredential_0300', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_0300",(err)=>{ + console.debug("====>add account ActsAppAccountCredential_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setCredential("account_name_0300", "credentialType3", "credential3",(err)=>{ + console.debug("====>setCredential first time 0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setCredential("account_name_0300", "credentialType3", "newcredential3",(err)=>{ + console.debug("====>setCredential second time 0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getCredential("account_name_0300", "credentialType3", (err, data)=>{ + console.debug("====>getCredential 0300 err:" + JSON.stringify(err)); + console.debug("====>getCredential 0300 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual("newcredential3"); + appAccountManager.removeAccount("account_name_0300", (err)=>{ + console.debug("====>delete Account 0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAppAccountCredential_0300 end===="); + done(); + }); + }); + }); + }); + }); + }); + + /* + * @tc.number : ActsAppAccountCredential_0400 + * @tc.name : Whether getAssociatedData can get the correct value when calling setCredential two times + * @tc.desc : When the first setCredential is called and the second setCredential + * is called,the setting of the credential is different if the call getCredential + * can get the second credential(promise) + */ + it('ActsAppAccountCredential_0400', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_0400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAppAccountCredential_0400 start===="); + await appAccountManager.createAccount("account_name_0400"); + try{ + await appAccountManager.setCredential("account_name_0400", "credentialType4", "credential4"); + await appAccountManager.setCredential("account_name_0400", "credentialType4", "newcredential4") + } + catch(err){ + console.error("setCredential ActsAppAccountCredential_0400 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + var data = await appAccountManager.getCredential("account_name_0400", "credentialType4"); + } + catch(err){ + console.error("getCredential ActsAppAccountCredential_0400 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAppAccountCredential_0400 getCredential data:" + JSON.stringify(data)); + expect(data).assertEqual("newcredential4"); + console.debug("====>delete account ActsAppAccountCredential_0400 start===="); + appAccountManager.removeAccount("account_name_0400") + console.debug("====>ActsAppAccountCredential_0400 end===="); + done(); + }); + + /* + * @tc.number : ActsAppAccountCredential_0500 + * @tc.name : setAssociatedData and getAssociatedData are called when the argument is null + * @tc.desc : Call setAssociatedData and then getAssociatedData when the incoming credential is null(callback) + */ + it('ActsAppAccountCredential_0500', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_0500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_0500",(err)=>{ + console.debug("====>add account ActsAppAccountCredential_0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setCredential("account_name_0500", "credentialType5", "", (err)=>{ + console.debug("====>setCredential ActsAppAccountCredential_0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getCredential("account_name_0500", "credentialType5", (err,data)=>{ + console.debug("====>getCredential ActsAppAccountCredential_0500 err:" + JSON.stringify(err)); + console.debug("====>getCredential ActsAppAccountCredential_0500 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual(""); + appAccountManager.removeAccount("account_name_0500", (err)=>{ + console.debug("====>delete Account ActsAppAccountCredential_0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAppAccountCredential_0500 end===="); + done(); + }); + }); + }); + }); + }); + + /* + * @tc.number : ActsAppAccountCredential_0600 + * @tc.name : setAssociatedData and getAssociatedData are called when the argument is null + * @tc.desc : Call setAssociatedData and then getAssociatedData when the incoming credential is null(promise) + */ + it('ActsAppAccountCredential_0600', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_0600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAppAccountCredential_0600 start===="); + await appAccountManager.createAccount("account_name_0600"); + console.debug("====>setCredential ActsAppAccountCredential_0600 start===="); + await appAccountManager.setCredential("account_name_0600", "credentialType6", ""); + console.debug("====>getCredential ActsAppAccountCredential_0600 start===="); + var data = await appAccountManager.getCredential("account_name_0600", "credentialType6"); + console.debug("====>getCredential ActsAppAccountCredential_0600 data" + JSON.stringify(data)); + expect(data).assertEqual(""); + console.debug("====>delete account ActsAppAccountCredential_0600 start===="); + await appAccountManager.removeAccount("account_name_0600"); + console.debug("====>ActsAppAccountCredential_0600 end===="); + done(); + }); + + /* + * @tc.number : ActsAppAccountCredential_0700 + * @tc.name : setAssociatedData setting value is called when the argument is wrong + * @tc.desc : Call setAssociatedData setting credential when the incoming parameter type is null(callback) + */ + it('ActsAppAccountCredential_0700', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_0700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_0700", (err)=>{ + console.debug("====>add account ActsAppAccountCredential_0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setCredential("account_name_0700", "", "credential7", (err)=>{ + console.debug("====>setCredential ActsAppAccountCredential_0700 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + appAccountManager.removeAccount("account_name_0700", (err)=>{ + console.debug("====>delete Account ActsAppAccountCredential_0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAppAccountCredential_0700 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAppAccountCredential_0800 + * @tc.name : setAssociatedData setting value is called when the argument is wrong + * @tc.desc : Call setAssociatedData setting credential when the incoming parameter type is null(promise) + */ + it('ActsAppAccountCredential_0800', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_0800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ccountActsAppAccountCredential_0800 start===="); + await appAccountManager.createAccount("account_name_0800"); + try{ + await appAccountManager.setCredential("account_name_0800", "", "credential8"); + } + catch(err){ + console.debug("====>setCredential ActsAppAccountCredential_0800 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>delete account ActsAppAccountCredential_0800 start===="); + appAccountManager.removeAccount("account_name_0800"); + console.debug("====>ActsAppAccountCredential_0800 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAppAccountCredential_0900 + * @tc.name : getCredential getting value is called when the argument is wrong + * @tc.desc : Call getCredential getting credential when the incoming parameter type is wrong(callback) + */ + it('ActsAppAccountCredential_0900', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_0900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_0900", (err)=>{ + console.debug("====>add account ActsAppAccountCredential_0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getCredential("account_name_0900", "", (err)=>{ + console.debug("====>getCredential ActsAppAccountCredential_0900 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + appAccountManager.removeAccount("account_name_0900", (err)=>{ + console.debug("====>delete Account ActsAppAccountCredential_0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAppAccountCredential_0900 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAppAccountCredential_1000 + * @tc.name : getCredential getting value is called when the argument is wrong + * @tc.desc : Call getCredential getting credential when the incoming parameter type is wrong(promise) + */ + it('ActsAppAccountCredential_1000', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_1000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAppAccountCredential_1000 start===="); + await appAccountManager.createAccount("account_name_1000"); + try{ + await appAccountManager.getCredential("account_name_1000",""); + } + catch(err){ + console.debug("====>getCredential ActsAppAccountCredential_1000 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>delete account ActsAppAccountCredential_1000 start===="); + await appAccountManager.removeAccount("account_name_1000"); + console.debug("====>ActsAppAccountCredential_1000 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAppAccountCredential_1100 + * @tc.name : setAssociatedData setting credential is called when the argument is sapce + * @tc.desc : Call setAssociatedData setting credential when the incoming parameter type is space + * then use getCredential getting the credential(callback) + */ + it('ActsAppAccountCredential_1100', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_1100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_1100",(err)=>{ + console.debug("====>add account ActsAppAccountCredential_1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setCredential("account_name_1100", " ", "credential11",(err)=>{ + console.debug("====>setCredential ActsAppAccountCredential_1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getCredential("account_name_1100", " ", (err, data)=>{ + console.debug("====>getCredential 1100 err:" + JSON.stringify(err)); + console.debug("====>getCredential 1100 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual("credential11"); + appAccountManager.removeAccount("account_name_1100", (err)=>{ + console.debug("====>delete Account 1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAppAccountCredential_1100 end===="); + done(); + }); + }); + }); + }); + }); + + /* + * @tc.number : ActsAppAccountCredential_1200 + * @tc.name : setAssociatedData setting credential is called when the argument is sapce + * @tc.desc : Call setAssociatedData setting credential when the incoming parameter type is space + * then use getCredential getting the credential(promise) + */ + it('ActsAppAccountCredential_1200', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_1200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAppAccountCredential_1200 start===="); + await appAccountManager.createAccount("account_name_1200"); + console.debug("====>setCredential ActsAppAccountCredential_1200 start===="); + await appAccountManager.setCredential("account_name_1200", " ", "credential12"); + console.debug("====>getCredential ActsAppAccountCredential_1200 start===="); + var data = await appAccountManager.getCredential("account_name_1200", " "); + console.debug("====>getCredential ActsAppAccountCredential_1200 data" + JSON.stringify(data)); + expect(data).assertEqual("credential12"); + console.debug("====>delete account ActsAppAccountCredential_1200 start===="); + await appAccountManager.removeAccount("account_name_1200"); + console.debug("====>ActsAppAccountCredential_1200 end===="); + done(); + }); + + /* + * @tc.number : ActsAppAccountCredential_1300 + * @tc.name : setAssociatedData setting credential is called when the argument is wrong + * @tc.desc : Call setAssociatedData setting credential when the incoming parameter name is null(callback) + */ + it('ActsAppAccountCredential_1300', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_1300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_1300",(err)=>{ + console.debug("====>add account ActsAppAccountCredential_1300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setCredential("", "credentialType13", "credential13", (err)=>{ + console.debug("====>setCredential ActsAppAccountCredential_1300 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + appAccountManager.removeAccount("account_name_1300", (err)=>{ + console.debug("====>delete Account ActsAppAccountCredential_1300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAppAccountCredential_1300 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAppAccountCredential_1400 + * @tc.name : setAssociatedData setting credential is called when the argument is wrong + * @tc.desc : Call setAssociatedData setting credential when the incoming parameter name is null(promise) + */ + it('ActsAppAccountCredential_1400', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_1400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAppAccountCredential_1400 start===="); + await appAccountManager.createAccount("account_name_1400"); + try{ + await appAccountManager.setCredential("", "credentialType14", "credential14"); + } + catch(err){ + console.debug("====>setCredential ActsAppAccountCredential_1400 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>delete account ActsAppAccountCredential_1400 start===="); + await appAccountManager.removeAccount("account_name_1400"); + console.debug("====>ActsAppAccountCredential_1400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAppAccountCredential_1500 + * @tc.name : Get it directly without setting credential callback + * @tc.desc : Call getCredential directly to get credential without calling setCredential + */ + it('ActsAppAccountCredential_1500', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_1500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_1500", (err)=>{ + console.debug("====>add account ActsAppAccountCredential_1500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getCredential("account_name_1500", "credentialType15", (err)=>{ + console.debug("====>getCredential ActsAppAccountCredential_1500 err:" + JSON.stringify(err)); + expect(err.code == 12300019).assertEqual(true); + appAccountManager.removeAccount("account_name_1500", (err)=>{ + console.debug("====>delete Account ActsAppAccountCredential_1500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAppAccountCredential_1500 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAppAccountCredential_1600 + * @tc.name : Get it directly without setting credential promise + * @tc.desc : Call getCredential directly to get credential without calling setCredential + */ + it('ActsAppAccountCredential_1600', 0, async function (done) { + console.debug("cActsAppAccountCredential_1600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAppAccountCredential_1600 start===="); + await appAccountManager.createAccount("account_name_1600"); + try{ + await appAccountManager.getCredential("account_name_1600", "credentialType16"); + } + catch(err){ + console.debug("====>getCredential ActsAppAccountCredential_1600 err:" + JSON.stringify(err)); + expect(err.code == 12300019).assertEqual(true); + console.debug("====>delete account ActsAppAccountCredential_1600 start===="); + await appAccountManager.removeAccount("account_name_1600"); + console.debug("====>ActsAppAccountCredential_1600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAppAccountCredential_1700 + * @tc.name : setCredential setting credential is called when the argument is wrong callback + * @tc.desc : Call setCredential setting credential when the incoming parameter credential is wrong + */ + it('ActsAppAccountCredential_1700', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_1700 start===="); + var CREDENTIALOVERSIZE = "K" + for(var i = 0;i < 256;i++) + CREDENTIALOVERSIZE = CREDENTIALOVERSIZE + "K!@#"; + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_1700", (err)=>{ + console.debug("====>add account ActsAppAccountCredential_1700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setCredential("account_name_1700", "credentialType17", CREDENTIALOVERSIZE, (err)=>{ + console.debug("====>CREDENTIALOVERSIZE.length:" + JSON.stringify(CREDENTIALOVERSIZE.length)); + expect(CREDENTIALOVERSIZE.length).assertEqual(1025); + console.debug("====>setCredential ActsAppAccountCredential_1700 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + appAccountManager.removeAccount("account_name_1700", (err)=>{ + console.debug("====>delete Account ActsAppAccountCredential_1700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAppAccountCredential_1700 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAppAccountCredential_1800 + * @tc.name : setCredential setting credential is called when the argument is wrong promise + * @tc.desc : Call setCredential setting credential when the incoming parameter credential is wrong + */ + it('ActsAppAccountCredential_1800', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_1800 start===="); + var bigStr = "K" + for(var i = 0;i < 256;i++) + bigStr = bigStr + "K!@#"; + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAppAccountCredential_1800 start===="); + await appAccountManager.createAccount("account_name_1800"); + try{ + await appAccountManager.setCredential("account_name_1800", "credentialType18", bigStr); + } + catch(err){ + console.debug("====>bigStr.length:" + JSON.stringify(bigStr.length)); + expect(bigStr.length).assertEqual(1025); + console.debug("====>setCredential ActsAppAccountCredential_1800 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>delete account ActsAppAccountCredential_1800 start===="); + await appAccountManager.removeAccount("account_name_1800"); + console.debug("====>ActsAppAccountCredential_1800 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAppAccountCredential_1900 + * @tc.name : setCredential setting credential is called when the argument is wrong + * @tc.desc : Call setCredential setting type when the incoming parameter credential is wrong(callback) + */ + it('ActsAppAccountCredential_1900', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_1900 start===="); + var CREDENTIALTYPEOVERSIZE = "K" + for(var i = 0;i < 256;i++) + CREDENTIALTYPEOVERSIZE = CREDENTIALTYPEOVERSIZE + "K!@#"; + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_1900", (err)=>{ + console.debug("====>add account ActsAppAccountCredential_1900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setCredential("account_name_1900", CREDENTIALTYPEOVERSIZE, "credential19", (err)=>{ + console.debug("====>CREDENTIALTYPEOVERSIZE.length:" + JSON.stringify(CREDENTIALTYPEOVERSIZE.length)); + expect(CREDENTIALTYPEOVERSIZE.length).assertEqual(1025); + console.debug("====>setCredential ActsAppAccountCredential_1900 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + appAccountManager.removeAccount("account_name_1900", (err)=>{ + console.debug("====>delete Account ActsAppAccountCredential_1900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAppAccountCredential_1900 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAppAccountCredential_2000 + * @tc.name : setCredential setting credential is called when the argument is wrong + * @tc.desc : Call setCredential setting type when the incoming parameter credential is wrong(promise) + */ + it('ActsAppAccountCredential_2000', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_2000 start===="); + var CREDENTIALTYPEOVERSIZE = "K" + for(var i = 0;i < 256;i++) + CREDENTIALTYPEOVERSIZE=CREDENTIALTYPEOVERSIZE+"K!@#"; + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAppAccountCredential_2000 start===="); + await appAccountManager.createAccount("account_name_2000"); + try{ + await appAccountManager.setCredential("account_name_2000", CREDENTIALTYPEOVERSIZE , "credential20"); + } + catch(err){ + console.debug("====>CREDENTIALTYPEOVERSIZE.length:" + JSON.stringify(CREDENTIALTYPEOVERSIZE.length)); + expect(CREDENTIALTYPEOVERSIZE.length).assertEqual(1025); + console.debug("====>setCredential ActsAppAccountCredential_2000 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>delete account ActsAppAccountCredential_2000 start===="); + await appAccountManager.removeAccount("account_name_2000"); + console.debug("====>ActsAppAccountCredential_2000 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAppAccountCredential_2100 + * @tc.name : setCredential setting credential is called when the argument is wrong + * @tc.desc : Call setCredential setting name when the incoming parameter name is wrong(callback) + */ + it('ActsAppAccountCredential_2100', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_2100 start===="); + var NAMEOVERSIZE = "n" + for(var i = 0;i < 256;i++) + NAMEOVERSIZE = NAMEOVERSIZE + "name"; + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_2100", (err)=>{ + console.debug("====>add account ActsAppAccountCredential_2100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setCredential(NAMEOVERSIZE, "credentialType21", "credential21", (err)=>{ + console.debug("====>setCredential ActsAppAccountCredential_2100 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + appAccountManager.removeAccount("account_name_2100", (err)=>{ + console.debug("====>delete Account ActsAppAccountCredential_2100 err:" + JSON.stringify(err)); + console.debug("====>ActsAppAccountCredential_2100 end===="); + expect(err).assertEqual(null); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAppAccountCredential_2200 + * @tc.name : setCredential setting credential is called when the argument is wrong + * @tc.desc : Call setCredential setting name when the incoming parameter name is wrong(promise) + */ + it('ActsAppAccountCredential_2200', 0, async function (done) { + console.debug("====>ActsAppAccountCredential_2200 start===="); + var NAMEOVERSIZE ="n" + for(var i=0;i<256;i++) + NAMEOVERSIZE=NAMEOVERSIZE+"name"; + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAppAccountCredential_2200 start===="); + try{ + await appAccountManager.createAccount("account_name_2200"); + } + catch(err){ + console.debug("====>add account ActsAppAccountCredential_2200 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>setCredential ActsAppAccountCredential_2200 start===="); + try{ + await appAccountManager.setCredential(NAMEOVERSIZE, "credentialType22", "credential22"); + } + catch(err){ + console.debug("====>setCredential ActsAppAccountCredential_2200 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>delete account ActsAppAccountCredential_2200 start===="); + await appAccountManager.removeAccount("account_name_2200"); + console.debug("====>ActsAppAccountCredential_2200 end===="); + done(); + } + }); + }) +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/AccountManager.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/AccountManager.test.js new file mode 100644 index 000000000..cd5d68676 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/AccountManager.test.js @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import account from '@ohos.account.appAccount' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +const TIMEOUT = 5000; +export default function ActsAccountManager() { + describe('ActsAccountManager', function () { + function sleep(delay) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) + } + + beforeAll(async function (done) { + console.debug("====>beforeAll start===="); + await sleep(TIMEOUT); + console.debug("====>beforeAll end===="); + done(); + }); + + /* + * @tc.number : ActsAccountManager_0100 + * @tc.name : createAppAccountManager + * @tc.desc : Create two application account module objects, one object adds an application account, + * the other object deletes the application account + */ + it('ActsAccountManager_0100', 0, async function (done) { + console.debug("====>ActsAccountManager_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + var appAccountManagerTwo = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("creatappaccount_name_first", (err)=>{ + console.debug("====>add account ActsAccountManager_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManagerTwo.removeAccount("creatappaccount_name_first", (err)=>{ + console.debug("====>delete Account ActsAccountManager_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountManager_0100 end===="); + done(); + }); + }); + }); + + /* + * @tc.number : ActsAccountManager_0200 + * @tc.name : createAppAccountManager + * @tc.desc : Create two application account module objects, one object adds application accounts and + * sets additional information, and the other object can obtain additional information of + * the application account + */ + it('ActsAccountManager_0200', 0, async function (done) { + console.debug("====>ActsAccountManager_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + var appAccountManagerTwo = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("creatappaccount_name_second", (err)=>{ + console.debug("====>add account ActsAccountManager_0200 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManagerTwo.setAccountExtraInfo("creatappaccount_name_second", "creatappaccount_extra", (err)=>{ + console.debug("====>setAccountExtraInfo err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAccountExtraInfo("creatappaccount_name_second", (err, data)=>{ + console.debug("====>getAccountExtraInfo err:" + JSON.stringify(err)); + console.debug("====>getAccountExtraInfo data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual("creatappaccount_extra"); + appAccountManagerTwo.removeAccount("creatappaccount_name_second", (err)=>{ + console.debug("====>delete Account err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountManager_0200 end===="); + done(); + }); + }); + }); + }); + }); + }) +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/AuthToken.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/AuthToken.test.js new file mode 100644 index 000000000..e3f456992 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/AuthToken.test.js @@ -0,0 +1,3423 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import account from '@ohos.account.appAccount' +import resmgr from '@ohos.resourceManager' +import featureAbility from '@ohos.ability.featureAbility' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + + +const TIMEOUT = 1000; +const EACHTIMEOUT = 500; +const LENGTHLIMIT = 512; +const TOKENLENGTHLIMIT = 1024; +const AUTHTYPELENGTHLIMIT = 1024; +const OWNERLENGTHLIMIT = 1024; + +const OWNERSELF = "com.example.actsaccountoperatetest"; +export default function ActsAccountAuthToken() { + describe('ActsAccountAuthToken', function () { + function sleep(delay) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) + } + + beforeAll(async function (done) { + console.debug("====>beforeAll start===="); + await sleep(TIMEOUT); + console.debug("====>beforeAll end===="); + done(); + }); + + beforeEach(async function (done) { + console.debug("====>beforeAll enter===="); + await sleep(EACHTIMEOUT); + done(); + }); + + /* + * @tc.number : testGetEntriesString101 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + + + it('ActsAccountAuthToken_9100', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_9100 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_tokenTest_name",(err,)=>{ + console.debug("====>ActsAccountAuthToken_9100 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_tokenTest_name","authType1","test_token1",(err)=>{ + console.debug("====>ActsAccountAuthToken_9100 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_tokenTest_name","authType1","test_token2",(err)=>{ + console.debug("====>ActsAccountAuthToken_9100 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthTokenVisibility("account_tokenTest_name","authType1","other_app_bundleName",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_9100 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_tokenTest_name","authType2","test_token2",(err)=>{ + console.debug("====>ActsAccountAuthToken_9100 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAuthTokens("account_tokenTest_name", OWNERSELF,(err,ArrayData)=>{ + console.debug("====>ActsAccountAuthToken_9100 getAllAuthTokens err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_9100 getAllAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(err).assertEqual(null); + expect(ArrayData.length).assertEqual(2); + appAccountManager.deleteAuthToken("account_tokenTest_name",OWNERSELF,"authType1","test_token2",(err)=>{ + console.debug("====>ActsAccountAuthToken_9100 deleteAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAuthTokens("account_tokenTest_name", OWNERSELF,(err,ArrayData)=>{ + console.debug("====>ActsAccountAuthToken_9100 getAllAuthTokens err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_9100 getAllAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(err).assertEqual(null); + expect(ArrayData.length).assertEqual(2); + appAccountManager.removeAccount("account_tokenTest_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_9100 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_9100 end===="); + done(); + appAccountManager.getAuthToken("account_tokenTest_name",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_9100 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_9100 getAuthToken data:" + data); + expect(err.code==12300003).assertEqual(true); + console.debug("====>ActsAccountAuthToken_9100 end===="); + done(); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_9000', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_9000 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_tokenTest_name",(err,)=>{ + console.debug("====>ActsAccountAuthToken_9000 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_tokenTest_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_9000 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_tokenTest_name",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_9000 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_9000 getAuthToken data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("test_token"); + appAccountManager.setAuthTokenVisibility("account_tokenTest_name","authType","other_app_bundleName",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_9000 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthList("account_tokenTest_name","authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_9000 getAuthList err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_9000 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(1); + expect(dataArray[0]).assertEqual("other_app_bundleName"); + appAccountManager.deleteAuthToken("account_tokenTest_name",OWNERSELF,"authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_9000 deleteAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAuthTokens("account_tokenTest_name", OWNERSELF,(err,ArrayData)=>{ + console.debug("====>ActsAccountAuthToken_9000 getAllAuthTokens err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_9000 getAllAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(err).assertEqual(null); + expect(ArrayData.length).assertEqual(1); + expect(ArrayData[0].authType).assertEqual("authType"); + expect(ArrayData[0].token).assertEqual(""); + appAccountManager.setAuthTokenVisibility("account_tokenTest_name","authType",OWNERSELF,false,(err)=>{ + console.debug("====>ActsAccountAuthToken_9000 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_tokenTest_name",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_9000 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_9000 getAuthToken data:" + data); + expect(err.code!=0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.removeAccount("account_tokenTest_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_9000 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_9000 end===="); + done(); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + + + + it('ActsAccountAuthToken_7100', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_7100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_7100 createAccount start===="); + appAccountManager.createAccount("account_tokenTest_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_7100 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_tokenTest_name","authType1","test_token1",(err)=>{ + console.debug("====>ActsAccountAuthToken_7100 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_tokenTest_name","authType1","test_token2",(err)=>{ + console.debug("====>ActsAccountAuthToken_7100 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_tokenTest_name","authType2","test_token2",(err)=>{ + console.debug("====>ActsAccountAuthToken_7100 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAuthTokens("account_tokenTest_name", OWNERSELF,(err,ArrayData)=>{ + console.debug("====>ActsAccountAuthToken_7100 getAllAuthTokens err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_7100 getAllAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(err).assertEqual(null); + expect(ArrayData.length).assertEqual(2); + expect(ArrayData[0].authType).assertEqual("authType1"); + expect(ArrayData[0].token).assertEqual("test_token2"); + expect(ArrayData[1].authType).assertEqual("authType2"); + expect(ArrayData[1].token).assertEqual("test_token2"); + appAccountManager.deleteAuthToken("account_tokenTest_name",OWNERSELF,"authType1","test_token2",(err)=>{ + console.debug("====>ActsAccountAuthToken_7100 deleteAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAuthTokens("account_tokenTest_name", OWNERSELF,(err,ArrayData)=>{ + console.debug("====>ActsAccountAuthToken_7100 getAllAuthTokens err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_7100 getAllAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(err).assertEqual(null); + expect(ArrayData.length).assertEqual(1); + expect(ArrayData[0].authType).assertEqual("authType2"); + expect(ArrayData[0].token).assertEqual("test_token2"); + appAccountManager.removeAccount("account_tokenTest_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_7100 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_tokenTest_name",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_7100 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_7100 getAuthToken data:" + data); + expect(err.code!=0).assertEqual(true); + expect(data).assertEqual(null); + console.debug("====>ActsAccountAuthToken_7100 end===="); + done(); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_7200', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_7200 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_tokenTest_name",(err,)=>{ + console.debug("====>ActsAccountAuthToken_7200 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_tokenTest_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_7200 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_tokenTest_name",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_7200 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_7200 getAuthToken data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("test_token"); + appAccountManager.getAuthList("account_tokenTest_name","authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_7200 getAuthList err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_7200 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(0); + appAccountManager.removeAccount("account_tokenTest_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_7200 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_7200 end===="); + done(); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_7300', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_7300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_7300 createAccount start===="); + appAccountManager.createAccount("account_tokenTest_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_7300 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_tokenTest_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_7300 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_tokenTest_name",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_7300 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_7300 getAuthToken data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("test_token"); + appAccountManager.checkAuthTokenVisibility("account_tokenTest_name","authType",OWNERSELF,(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_7300 checkAuthTokenVisibility err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_7300 checkAuthTokenVisibility stateBack:" + stateBack); + expect(err).assertEqual(null); + expect(stateBack).assertEqual(true); + appAccountManager.setAuthTokenVisibility("account_tokenTest_name","authType",OWNERSELF,false,(err)=>{ + console.debug("====>ActsAccountAuthToken_7300 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAuthTokenVisibility("account_tokenTest_name","authType",OWNERSELF,(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_7300 checkAuthTokenVisibility err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_7300 checkAuthTokenVisibility stateBack:" + stateBack); + expect(err).assertEqual(null); + expect(stateBack).assertEqual(true); + appAccountManager.deleteAuthToken("account_tokenTest_name",OWNERSELF,"authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_7300 deleteAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("account_tokenTest_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_7300 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_7300 end===="); + done(); + }); + }); + }); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_7400', 0, async function (done) { + var limitAuthType = ''; + for(var i = 0;i < AUTHTYPELENGTHLIMIT + 1; i++){ + limitAuthType += 'c'; + } + console.debug("====>ActsAccountAuthToken_7400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_7400 createAccount start===="); + appAccountManager.createAccount("account_callback_authType_limit",(err)=>{ + console.debug("====>ActsAccountAuthToken_7400 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_authType_limit","authType","callback_authType_limit_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_7400 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.deleteAuthToken("account_callback_authType_limit",OWNERSELF,limitAuthType,"callback_authType_limit_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_7400 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + appAccountManager.removeAccount("account_callback_authType_limit",(err)=>{ + console.debug("====>ActsAccountAuthToken_7400 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_7400 end===="); + done(); + }); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_7500', 0, async function (done) { + var limitAuthType = ''; + for(var i = 0;i < AUTHTYPELENGTHLIMIT + 1; i++){ + limitAuthType += 'c'; + } + console.debug("====>ActsAccountAuthToken_7500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_7500 createAccount start===="); + await appAccountManager.createAccount("account_promise_authType_limit"); + console.debug("====>ActsAccountAuthToken_7500 getAuthToken start===="); + try{ + await appAccountManager.deleteAuthToken("account_promise_authType_limit",OWNERSELF,limitAuthType,"promise_authType_limit_token"); + } + catch(err){ + console.debug("====>ActsAccountAuthToken_7500 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_7500 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_authType_limit"); + console.debug("====>ActsAccountAuthToken_7500 end===="); + done(); + } + }); + + + + it('ActsAccountAuthToken_7600', 0, async function (done) { + var limitAuthType = ''; + for(var i = 0;i < AUTHTYPELENGTHLIMIT; i++){ + limitAuthType += 'c'; + } + console.debug("====>ActsAccountAuthToken_7600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_7600 createAccount start===="); + appAccountManager.createAccount("account_callback_authType_limit",(err)=>{ + console.debug("====>ActsAccountAuthToken_7600 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_authType_limit",limitAuthType,"callback_authType_limit_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_7600 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.deleteAuthToken("account_callback_authType_limit",OWNERSELF,limitAuthType,"callback_authType_limit_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_7600 getAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("account_callback_authType_limit",(err)=>{ + console.debug("====>ActsAccountAuthToken_7600 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_7600 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_7700', 0, async function (done) { + var limitAuthType = ''; + for(var i = 0;i < AUTHTYPELENGTHLIMIT; i++){ + limitAuthType += 'c'; + } + console.debug("====>ActsAccountAuthToken_7700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_7700 createAccount start===="); + await appAccountManager.createAccount("account_promise_authType_limit") + console.debug("====>ActsAccountAuthToken_7700 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_authType_limit",limitAuthType,"promise_authType_limit_token"); + console.debug("====>ActsAccountAuthToken_7700 deleteAuthToken start===="); + await appAccountManager.deleteAuthToken("account_promise_authType_limit",OWNERSELF,limitAuthType,"promise_authType_limit_token") + console.debug("====>ActsAccountAuthToken_7700 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_authType_limit") + console.debug("====>ActsAccountAuthToken_7700 end===="); + done(); + + }); + + + + it('ActsAccountAuthToken_7800', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_7800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_7800 createAccount start===="); + appAccountManager.createAccount("account_callback_empty_authType",(err)=>{ + console.debug("====>ActsAccountAuthToken_7800 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_empty_authType","authType","callback_empty_authType_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_7800 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.deleteAuthToken("account_callback_empty_authType",OWNERSELF,"","callback_empty_authType_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_7800 deleteAuthToken err:" + JSON.stringify(err)); + expect(err.code == 12400004).assertEqual(true); + appAccountManager.getAuthToken("account_callback_empty_authType",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_7800 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_7800 getAuthToken data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("callback_empty_authType_token"); + appAccountManager.removeAccount("account_callback_empty_authType",(err)=>{ + console.debug("====>ActsAccountAuthToken_7800 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_7800 end===="); + done(); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_7900', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_7900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_7900 createAccount start===="); + await appAccountManager.createAccount("account_promise_empty_authType"); + console.debug("====>ActsAccountAuthToken_7900 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_empty_authType","authType","promise_empty_authType_token"); + console.debug("====>ActsAccountAuthToken_7900 deleteAuthToken start===="); + try{ + await appAccountManager.deleteAuthToken("account_promise_empty_authType",OWNERSELF,"","promise_empty_authType_token"); + }catch(err){ + console.debug('====>ActsAccountAuthToken_7900 deleteAuthToken err:' + JSON.stringify(err)) + expect(err.code == 12400004).assertEqual(true); + console.debug("====>ActsAccountAuthToken_7900 getAuthToken start===="); + var data = await appAccountManager.getAuthToken("account_promise_empty_authType",OWNERSELF,"authType"); + expect(data).assertEqual("promise_empty_authType_token"); + console.debug("====>ActsAccountAuthToken_7900 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_empty_authType"); + console.debug("====>ActsAccountAuthToken_7900 end===="); + done(); + } + }); + + + it('ActsAccountAuthToken_8000', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_8000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_8000 createAccount start===="); + appAccountManager.createAccount("account_callback_setSameAuthType",(err)=>{ + console.debug("====>ActsAccountAuthToken_8000 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_setSameAuthType","authType","callback_setSameAuthType_token1",(err)=>{ + console.debug("====>ActsAccountAuthToken_8000 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_setSameAuthType","authType","callback_setSameAuthType_token2",(err)=>{ + console.debug("====>ActsAccountAuthToken_8000 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_setSameAuthType",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_8000 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_8000 getAuthToken data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("callback_setSameAuthType_token2"); + appAccountManager.deleteAuthToken("account_callback_setSameAuthType",OWNERSELF,"authType","callback_setSameAuthType_token1",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_8000 deleteAuthToken err:" + JSON.stringify(err)); + expect(err.code == 12400004).assertEqual(true); + appAccountManager.removeAccount("account_callback_setSameAuthType",(err)=>{ + console.debug("====>ActsAccountAuthToken_8000 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_8000 end===="); + done(); + }); + }); + }); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_8100', 0, async function (done) { + var limitName = ''; + for(var i = 0;i < LENGTHLIMIT + 1; i++){ + limitName += 'c'; + } + console.debug("====>ActsAccountAuthToken_8100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_8100 getAllAuthTokens start===="); + appAccountManager.getAllAuthTokens(limitName, OWNERSELF).then((ArrayData)=>{ + console.debug("====>ActsAccountAuthToken_8100 getAllAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(ArrayData.length).assertEqual(0); + console.debug("====>ActsAccountAuthToken_8100 ===="); + done(); + }).catch((err)=>{ + expect(err.code!=0).assertEqual(true); + done(); + }) + }); + + it('ActsAccountAuthToken_8200', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_8200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_8200 getAllAuthTokens start===="); + appAccountManager.getAllAuthTokens("", OWNERSELF,(err,ArrayData)=>{ + console.debug("====>ActsAccountAuthToken_8200 getAllAuthTokens err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_8200 getAllAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_8200 ===="); + done(); + }); + }); + + it('ActsAccountAuthToken_8300', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_8300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_8300 getAllAuthTokens start===="); + appAccountManager.getAllAuthTokens("acount_no_setToken", OWNERSELF,(err,ArrayData)=>{ + console.debug("====>ActsAccountAuthToken_8300 getAllAuthTokens err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_8300 getAllAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(err.code!=0).assertEqual(true); + expect(ArrayData).assertEqual(null); + console.debug("====>ActsAccountAuthToken_8300 end===="); + done(); + }); + }); + + + + it('ActsAccountAuthToken_8400', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_8400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_8400 createAccount start===="); + appAccountManager.createAccount("acount_no_setToken",(err)=>{ + console.debug("====>ActsAccountAuthToken_8400 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAuthTokens("acount_no_setToken", OWNERSELF,(err,ArrayData)=>{ + console.debug("====>ActsAccountAuthToken_8400 getAllAuthTokens err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_8400 getAllAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(err).assertEqual(null); + expect(ArrayData.length).assertEqual(0); + appAccountManager.removeAccount("acount_no_setToken",(err)=>{ + console.debug("====>ActsAccountAuthToken_8400 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_8400 end===="); + done(); + }); + }); + }); + }); + + + + it('ActsAccountAuthToken_8500', 0, async function (done) { + var limitName = ''; + for(var i = 0;i < LENGTHLIMIT; i++){ + limitName += 'c'; + } + console.debug("====>ActsAccountAuthToken_8500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_8500 createAccount start===="); + appAccountManager.createAccount(limitName,(err)=>{ + console.debug("====>ActsAccountAuthToken_8500 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken(limitName,"authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_8500 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAuthTokens(limitName, OWNERSELF,(err,ArrayData)=>{ + console.debug("====>ActsAccountAuthToken_8500 getAllAuthTokens err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_8500 getAllAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(err).assertEqual(null); + expect(ArrayData.length).assertEqual(1); + expect(ArrayData[0].authType).assertEqual("authType"); + expect(ArrayData[0].token).assertEqual("test_token"); + appAccountManager.removeAccount(limitName,(err)=>{ + console.debug("====>ActsAccountAuthToken_8500 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_8500 end===="); + done(); + }); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_8600', 0, async function (done) { + var limitOwner = ''; + for(var i = 0;i < OWNERLENGTHLIMIT + 1; i++){ + limitOwner += 'c'; + } + console.debug("====>ActsAccountAuthToken_8600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_8600 createAccount start===="); + appAccountManager.createAccount("account_callback_getAllAuthTokens_test",(err)=>{ + console.debug("====>ActsAccountAuthToken_8600 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAuthTokens("account_callback_getAllAuthTokens_test",limitOwner,(err,ArrayData)=>{ + console.debug("====>ActsAccountAuthToken_8600 getAllAuthTokens err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_8600 getAllAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(err.code!=0).assertEqual(true); + expect(ArrayData).assertEqual(null); + appAccountManager.removeAccount("account_callback_getAllAuthTokens_test",(err)=>{ + console.debug("====>ActsAccountAuthToken_8600 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_8600 end===="); + done(); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_8700', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_8700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_8700 createAccount start===="); + appAccountManager.createAccount("account_callback_getAllAuthTokens_test",(err)=>{ + console.debug("====>ActsAccountAuthToken_8700 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAuthTokens("account_callback_getAllAuthTokens_test","",(err,ArrayData)=>{ + console.debug("====>ActsAccountAuthToken_8700 getAllAuthTokens err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_8700 getAllAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(err.code!=0).assertEqual(true); + expect(ArrayData).assertEqual(null); + appAccountManager.removeAccount("account_callback_getAllAuthTokens_test",(err)=>{ + console.debug("====>ActsAccountAuthToken_8700 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_8700 end===="); + done(); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_8800', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_8800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_8800 createAccount start===="); + appAccountManager.createAccount("account_callback_getAllAuthTokens_test",(err)=>{ + console.debug("====>ActsAccountAuthToken_8800 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAuthTokens("account_callback_getAllAuthTokens_test","invalid_owner",(err,ArrayData)=>{ + console.debug("====>ActsAccountAuthToken_8800 getAllAuthTokens err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_8800 getAllAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(err.code!=0).assertEqual(true); + expect(ArrayData).assertEqual(null); + appAccountManager.removeAccount("account_callback_getAllAuthTokens_test",(err)=>{ + console.debug("====>ActsAccountAuthToken_8800 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_8800 end===="); + done(); + }); + }); + }); + }); + + it('ActsAccountAuthToken_8900', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_8900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_8900 createAccount start===="); + appAccountManager.createAccount("account_callback_getAllAuthTokens_test",(err)=>{ + console.debug("====>ActsAccountAuthToken_8900 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAuthTokens("account_callback_getAllAuthTokens_test"," ",(err,ArrayData)=>{ + console.debug("====>ActsAccountAuthToken_8900 getAllAuthTokens err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_8900 getAllAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(err.code!=0).assertEqual(true); + expect(ArrayData).assertEqual(null); + appAccountManager.removeAccount("account_callback_getAllAuthTokens_test",(err)=>{ + console.debug("====>ActsAccountAuthToken_8900 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_8900 end===="); + done(); + }); + }); + }); + }); + + + + + it('ActsAccountAuthToken_0100', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_0100 createAccount start===="); + appAccountManager.createAccount("account_callback_normal",(err)=>{ + console.debug("====>ActsAccountAuthToken_0100 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_normal","authType","callback_normal_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_0100 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_normal",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_0100 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_0100 getAuthToken data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("callback_normal_token"); + appAccountManager.checkAuthTokenVisibility("account_callback_normal","authType",OWNERSELF,(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_0100 checkAuthTokenVisibility err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_0100 checkAuthTokenVisibility stateBack:" + stateBack); + expect(err).assertEqual(null); + expect(stateBack).assertEqual(true); + appAccountManager.deleteAuthToken("account_callback_normal",OWNERSELF,"authType","callback_normal_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_0100 deleteAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("account_callback_normal",(err)=>{ + console.debug("====>ActsAccountAuthToken_0100 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_0100 end===="); + done(); + }); + }); + }); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_0200', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_0200 createAccount start===="); + await appAccountManager.createAccount("account_promise_normal"); + console.debug("====>ActsAccountAuthToken_0200 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_normal","authType","promise_normal_token"); + console.debug("====>ActsAccountAuthToken_0200 getAuthToken start===="); + var data1 = await appAccountManager.getAuthToken("account_promise_normal",OWNERSELF,"authType"); + console.debug("====>getAuthToken ActsAccountAuthToken_0200 data:" + data1); + expect(data1).assertEqual("promise_normal_token"); + console.debug("====>ActsAccountAuthToken_0200 checkAuthTokenVisibility start===="); + var state = await appAccountManager.checkAuthTokenVisibility("account_promise_normal","authType",OWNERSELF); + console.debug("====>checkAuthTokenVisibility ActsAccountAuthToken_0200 state:" + state); + expect(state).assertEqual(true); + console.debug("====>ActsAccountAuthToken_0200 deleteAuthToken start===="); + await appAccountManager.deleteAuthToken("account_promise_normal",OWNERSELF,"authType","promise_normal_token"); + console.debug("====>ActsAccountAuthToken_0200 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_normal"); + console.debug("====>ActsAccountAuthToken_0200 end===="); + done(); + }); + + + + + it('ActsAccountAuthToken_0300', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_0300 getAuthToken start===="); + appAccountManager.createAccount("account_callback_noSetToken",(err)=>{ + console.debug("====>ActsAccountAuthToken_0300 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_noSetToken",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_0300 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_0300 getAuthToken data:" + data); + expect(err.code!=0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.removeAccount("account_callback_noSetToken",(err)=>{ + console.debug("====>ActsAccountAuthToken_0300 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_0300 end===="); + done(); + }); + }); + }); + }); + + it('ActsAccountAuthToken_0400', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_0400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_0400 createAccount start===="); + await appAccountManager.createAccount("account_promise_noSetToken"); + console.debug("====>ActsAccountAuthToken_0400 getAuthToken start===="); + try{ + await appAccountManager.getAuthToken("account_promise_noSetToken",OWNERSELF,"authType"); + } + catch(err){ + console.debug("====>ActsAccountAuthToken_0400 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_0400 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_noSetToken"); + console.debug("====>ActsAccountAuthToken_0400 end===="); + done(); + } + }); + + + it('ActsAccountAuthToken_0500', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_0500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_0500 getAuthToken start===="); + appAccountManager.getAuthToken("noAdd_account_callback",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_0500 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_0500 getAuthToken data:" + data); + expect(err.code!=0).assertEqual(true); + expect(data).assertEqual(null); + done(); + }); + }); + + it('ActsAccountAuthToken_0600', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_0600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_0600 getAuthToken start===="); + try{ + await appAccountManager.getAuthToken("noAdd_account_promise",OWNERSELF,"authType"); + } + catch(err){ + console.debug("====>ActsAccountAuthToken_0600 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_0600 end===="); + done(); + } + }); + + + it('ActsAccountAuthToken_0700', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_0700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_0700 createAccount start===="); + appAccountManager.createAccount("account_callback_setSameAuthType",(err)=>{ + console.debug("====>ActsAccountAuthToken_0700 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_setSameAuthType","authType","callback_setSameAuthType_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_0700 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_setSameAuthType","authType","callback_setSameAuthType_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_0700 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_setSameAuthType",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_0700 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_0700 getAuthToken data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("callback_setSameAuthType_token"); + appAccountManager.setAuthToken("account_callback_setSameAuthType","authType","callback_setSameAuthType_DiffToken",(err)=>{ + console.debug("====>ActsAccountAuthToken_0700 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_setSameAuthType",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_0700 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_0700 getAuthToken data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("callback_setSameAuthType_DiffToken"); + appAccountManager.removeAccount("account_callback_setSameAuthType",(err)=>{ + console.debug("====>ActsAccountAuthToken_0700 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_0700 end===="); + done(); + }); + }); + }); + }); + }); + }); + }); + }); + + + + + it('ActsAccountAuthToken_0800', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_0800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_0800 createAccount start===="); + await appAccountManager.createAccount("account_promise_setSameAuthType"); + console.debug("====>ActsAccountAuthToken_0800 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_setSameAuthType","authType","promise_setSameAuthType_token"); + console.debug("====>ActsAccountAuthToken_0800 repeat setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_setSameAuthType","authType","promise_setSameAuthType_token"); + var data1 = await appAccountManager.getAuthToken("account_promise_setSameAuthType",OWNERSELF,"authType"); + console.debug("====>getAuthToken ActsAccountAuthToken_0800 data:" + data1); + expect(data1).assertEqual("promise_setSameAuthType_token"); + console.debug("====>ActsAccountAuthToken_0800 repeat set diffToken setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_setSameAuthType","authType","promise_setSameAuthType_DiffToken"); + var data2 = await appAccountManager.getAuthToken("account_promise_setSameAuthType",OWNERSELF,"authType"); + console.debug("====>getAuthToken ActsAccountAuthToken_0800 data:" + data2); + expect(data2).assertEqual("promise_setSameAuthType_DiffToken"); + console.debug("====>ActsAccountAuthToken_0800 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_setSameAuthType"); + console.debug("====>ActsAccountAuthToken_0800 end===="); + done(); + }); + + + + it('ActsAccountAuthToken_0900', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_0900 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_callback_setDiff", (err)=>{ + console.debug("====>createAccount ActsAccountAuthToken_0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_setDiff","authType1","callback_setDiff_token1",(err)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_setDiff","authType2","callback_setDiff_token2",(err)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_setDiff",OWNERSELF,"authType1", (err, data)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_0900 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken ActsAccountAuthToken_0900 data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("callback_setDiff_token1"); + appAccountManager.getAuthToken("account_callback_setDiff",OWNERSELF,"authType2", (err, data)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_0900 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken ActsAccountAuthToken_0900 data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("callback_setDiff_token2"); + appAccountManager.removeAccount("account_callback_setDiff", (err)=>{ + console.debug("====>removeAccount ActsAccountAuthToken_0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_0900 end===="); + done(); + }); + }); + }); + }); + }); + }); + }); + + + + it('ActsAccountAuthToken_1000', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_1000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_1000 createAccount start===="); + await appAccountManager.createAccount("account_promise_setDiff"); + console.debug("====>setAuthToken ActsAccountAuthToken_1000 start===="); + await appAccountManager.setAuthToken("account_promise_setDiff","aythType1","promise_setDiff_token1"); + console.debug("====>setAuthToken ActsAccountAuthToken_1000 start===="); + await appAccountManager.setAuthToken("account_promise_setDiff","aythType2","promise_setDiff_token2"); + + console.debug("====>getAuthToken ActsAccountAuthToken_1000 start===="); + var data1 = await appAccountManager.getAuthToken("account_promise_setDiff",OWNERSELF,"aythType1"); + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1000 data:" + data1); + expect(data1).assertEqual("promise_setDiff_token1"); + console.debug("====>getAuthToken ActsAccountAuthToken_1000 start===="); + var data2 = await appAccountManager.getAuthToken("account_promise_setDiff",OWNERSELF,"aythType2"); + console.debug("====>getAuthToken getNew ActsAccountAuthToken_1000 data:" + data2); + expect(data2).assertEqual("promise_setDiff_token2"); + + console.debug("====>deleteAuthToken ActsAccountAuthToken_1000 start===="); + await appAccountManager.deleteAuthToken("account_promise_setDiff",OWNERSELF,"aythType1","promise_setDiff_token1"); + console.debug("====>deleteAuthToken ActsAccountAuthToken_1000 start===="); + await appAccountManager.deleteAuthToken("account_promise_setDiff",OWNERSELF,"aythType2","promise_setDiff_token2"); + console.debug("====>ActsAccountAuthToken_1000 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_setDiff"); + console.debug("====>ActsAccountAuthToken_1000 end===="); + done(); + }); + + + + it('ActsAccountAuthToken_1100', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_1100 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_callback_setDeleteGet", (err)=>{ + console.debug("====>createAccount ActsAccountAuthToken_1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_setDeleteGet","old_authType","callback_setDeleteGet_token",(err)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_setDeleteGet","new_authType","callback_setDeleteGet_token",(err)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_setDeleteGet",OWNERSELF,"old_authType", (err, data)=>{ + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1100 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1100 data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("callback_setDeleteGet_token"); + appAccountManager.getAuthToken("account_callback_setDeleteGet",OWNERSELF,"new_authType", (err, data)=>{ + console.debug("====>getAuthToken getNew ActsAccountAuthToken_1100 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken getNew ActsAccountAuthToken_1100 data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("callback_setDeleteGet_token"); + appAccountManager.deleteAuthToken("account_callback_setDeleteGet",OWNERSELF,"old_authType","callback_setDeleteGet_token",(err)=>{ + console.debug("====>deleteAuthToken deleteOld ActsAccountAuthToken_1100 err:" + JSON.stringify(err)); + appAccountManager.getAuthToken("account_callback_setDeleteGet",OWNERSELF,"old_authType", (err, data)=>{ + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1100 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1100 data:" + data); + expect(err.code!=0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.getAuthToken("account_callback_setDeleteGet",OWNERSELF,"new_authType", (err, data)=>{ + console.debug("====>getAuthToken getNew ActsAccountAuthToken_1100 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken getNew ActsAccountAuthToken_1100 data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("callback_setDeleteGet_token"); + appAccountManager.deleteAuthToken("account_callback_setDeleteGet",OWNERSELF,"new_authType","callback_setDeleteGet_token",(err)=>{ + console.debug("====>deleteAuthToken deleteNew ActsAccountAuthToken_1100 err:" + JSON.stringify(err)); + appAccountManager.getAuthToken("account_callback_setDeleteGet",OWNERSELF,"old_authType", (err, data)=>{ + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1100 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1100 data:" + data); + expect(err.code!=0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.getAuthToken("account_callback_setDeleteGet",OWNERSELF,"new_authType", (err, data)=>{ + console.debug("====>getAuthToken getNew ActsAccountAuthToken_1100 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken getNew ActsAccountAuthToken_1100 data:" + data); + expect(err.code!=0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.removeAccount("account_callback_setDeleteGet", (err)=>{ + console.debug("====>removeAccount ActsAccountAuthToken_1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_1100 end===="); + done(); + }); + }); + }) + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_1200', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_1200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_1200 createAccount start===="); + await appAccountManager.createAccount("account_promise_setDeleteGet"); + + console.debug("====>setAuthToken setOld ActsAccountAuthToken_1200 start===="); + await appAccountManager.setAuthToken("account_promise_setDeleteGet","old_authType","promise_setDeleteGet_token"); + console.debug("====>setAuthToken setNew ActsAccountAuthToken_1200 start===="); + await appAccountManager.setAuthToken("account_promise_setDeleteGet","new_authType","promise_setDeleteGet_token"); + + console.debug("====>getAuthToken ActsAccountAuthToken_1200 start===="); + var data1BeforeDel = await appAccountManager.getAuthToken("account_promise_setDeleteGet",OWNERSELF,"old_authType"); + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1200 data1BeforeDel:" + data1BeforeDel); + expect(data1BeforeDel).assertEqual("promise_setDeleteGet_token"); + console.debug("====>getAuthToken ActsAccountAuthToken_1200 start===="); + var data2BeforeDel = await appAccountManager.getAuthToken("account_promise_setDeleteGet",OWNERSELF,"new_authType"); + console.debug("====>getAuthToken getNew ActsAccountAuthToken_1200 data2BeforeDel:" + data2BeforeDel); + expect(data2BeforeDel).assertEqual("promise_setDeleteGet_token"); + + console.debug("====>deleteAuthToken deleteOld ActsAccountAuthToken_1200 start===="); + try{ + await appAccountManager.deleteAuthToken("account_promise_setDeleteGet",OWNERSELF,"old_authType","promise_setDeleteGet_token"); + } + catch(err){ + console.debug("====>deleteAuthToken ActsAccountAuthToken_1200 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + } + + console.debug("====>getAuthToken ActsAccountAuthToken_1200 start===="); + try{ + var data1AfterDel = await appAccountManager.getAuthToken("account_promise_setDeleteGet",OWNERSELF,"old_authType",); + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1200 data1_AfterDel:" + data1AfterDel); + expect().assertFail(); + } + catch(err){ + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1200 err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + } + console.debug("====>getAuthToken ActsAccountAuthToken_1200 start===="); + try{ + var data2AfterDel = await appAccountManager.getAuthToken("account_promise_setDeleteGet",OWNERSELF,"new_authType",); + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1200 data2_AfterDel:" + data2AfterDel); + expect(data2AfterDel).assertEqual("promise_setDeleteGet_token"); + } + catch(err){ + console.debug("====>getAuthToken getNew ActsAccountAuthToken_1200 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + } + console.debug("====>deleteAuthToken deleteNew ActsAccountAuthToken_1200 start===="); + try{ + await appAccountManager.deleteAuthToken("account_promise_setDeleteGet",OWNERSELF,"new_authType","promise_setDeleteGet_token"); + } + catch(err){ + console.debug("====>deleteAuthToken ActsAccountAuthToken_1200 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + } + + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1200 start===="); + try{ + var data1AgainDel = await appAccountManager.getAuthToken("account_promise_setDeleteGet",OWNERSELF,"old_authType",); + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1200 data1_AgainDel:" + data1AgainDel); + expect().assertFail(); + } + catch(err){ + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1200 err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + } + console.debug("====>getAuthToken getNew ActsAccountAuthToken_1200 start===="); + try{ + var data2AgainDel = await appAccountManager.getAuthToken("account_promise_setDeleteGet",OWNERSELF,"new_authType",); + console.debug("====>getAuthToken getOld ActsAccountAuthToken_1200 data2_AgainDel:" + data2AgainDel); + expect().assertFail(); + } + catch(err){ + console.debug("====>getAuthToken getNew ActsAccountAuthToken_1200 err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + } + await appAccountManager.removeAccount("account_promise_setDeleteGet"); + console.debug("====>ActsAccountAuthToken_1200 end===="); + done(); + + }); + + + it('ActsAccountAuthToken_1300', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_1300 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_callback_setDeleteGet", (err)=>{ + console.debug("====>createAccount ActsAccountAuthToken_1300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_setDeleteGet","authType","account_callback_setDeleteGet_token",(err)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_1300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.deleteAuthToken("account_callback_setDeleteGet",OWNERSELF,"authType","account_callback_setDeleteGet_token",(err)=>{ + console.debug("====>deleteAuthToken ActsAccountAuthToken_1300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_setDeleteGet",OWNERSELF,"authType", (err, data)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_1300 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken ActsAccountAuthToken_1300 data:" + data); + expect(err.code != 0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.removeAccount("account_callback_setDeleteGet", (err)=>{ + console.debug("====>removeAccount ActsAccountAuthToken_1300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_1300 end===="); + done(); + }); + }); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_1400', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_1400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_1400 createAccount start===="); + await appAccountManager.createAccount("account_promise_setDeleteGet"); + console.debug("====>setAuthToken ActsAccountAuthToken_1400 start===="); + await appAccountManager.setAuthToken("account_promise_setDeleteGet","authType","promise_setDeleteGet_token"); + console.debug("====>deleteAuthToken ActsAccountAuthToken_1400 start===="); + await appAccountManager.deleteAuthToken("account_promise_setDeleteGet",OWNERSELF,"authType","promise_setDeleteGet_token"); + console.debug("====>getAuthToken ActsAccountAuthToken_1400 start===="); + try{ + var data = await appAccountManager.getAuthToken("account_promise_setDeleteGet",OWNERSELF,"authType"); + } + catch(err){ + console.debug("====>getAuthToken ActsAccountAuthToken_1400 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>getAuthToken ActsAccountAuthToken_1400 data:" + data); + console.debug("====>ActsAccountAuthToken_1400 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_setDeleteGet"); + console.debug("====>ActsAccountAuthToken_1400 end===="); + done(); + } + }); + + + it('ActsAccountAuthToken_1500', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_1500 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.setAuthToken("account_callback_accountNotExit","authType","account_callback_accountNotExit_token", (err)=>{ + console.debug("====>setAuthToken ActsAccountAuthToken_1500 err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_1500 end===="); + done(); + }); + }); + + it('ActsAccountAuthToken_1600', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_1600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>setAuthToken ActsAccountAuthToken_1600 start===="); + try{ + await appAccountManager.setAuthToken("account_promise_accountNotExit","authType","account_promise_accountNotExit_token"); + } + catch(err){ + console.debug("====>setAuthToken ActsAccountAuthToken_1600 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_1600 end===="); + done(); + } + }); + + + + it('ActsAccountAuthToken_1700', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_1700 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.deleteAuthToken("account_callback_accountNotExit",OWNERSELF,"authType","account_callback_accountNotExit_token", (err)=>{ + console.debug("====>deleteAuthToken ActsAccountAuthToken_1700 err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_1700 end===="); + done(); + }); + }); + + it('ActsAccountAuthToken_1800', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_1800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>deleteAuthToken ActsAccountAuthToken_1800 start===="); + try{ + await appAccountManager.deleteAuthToken("account_promise_accountNotExit",OWNERSELF,"authType","account_promise_accountNotExit_token"); + } + catch(err){ + console.debug("====>deleteAuthToken ActsAccountAuthToken_1800 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_1800 end===="); + done(); + } + }); + + + + it('ActsAccountAuthToken_1900', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_1900 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_callback_repeatDelete", (err)=>{ + console.debug("====>createAccount ActsAccountAuthToken_1900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.deleteAuthToken("account_callback_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token",(err)=>{ + console.debug("====>deleteAuthToken ActsAccountAuthToken_1900 err:" + JSON.stringify(err)); + appAccountManager.getAuthToken("account_callback_repeatDelete",OWNERSELF,"authType", (err, data)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_1900 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken ActsAccountAuthToken_1900 data:" + data); + expect(err.code != 0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.removeAccount("account_callback_repeatDelete", (err)=>{ + console.debug("====>removeAccount ActsAccountAuthToken_1900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_1900 end===="); + done(); + }); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_2000', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_2000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_2000 createAccount start===="); + await appAccountManager.createAccount("account_promise_noExitToken"); + console.debug("====>deleteAuthToken ActsAccountAuthToken_2000 start===="); + await appAccountManager.deleteAuthToken("account_promise_noExitToken",OWNERSELF,"aythType","test_token").catch((err)=>{ + console.debug("====>deleteAuthToken ActsAccountAuthToken_2000 err:" + JSON.stringify(err)); + }); + console.debug("====>getAuthToken ActsAccountAuthToken_2000 start===="); + try{ + var data = await appAccountManager.getAuthToken("account_promise_noExitToken",OWNERSELF,"authType"); + } + catch(err){ + console.debug("====>getAuthToken ActsAccountAuthToken_2000 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_2000 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_noExitToken"); + console.debug("====>ActsAccountAuthToken_2000 end===="); + done(); + } + }); + + + it('ActsAccountAuthToken_2100', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_2100 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_callback_repeatDelete", (err)=>{ + console.debug("====>createAccount ActsAccountAuthToken_2100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_repeatDelete","authType","",(err)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_2100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.deleteAuthToken("account_callback_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token",(err)=>{ + console.debug("====>deleteAuthToken first ActsAccountAuthToken_2100 err:" + JSON.stringify(err)); + appAccountManager.getAuthToken("account_callback_repeatDelete",OWNERSELF,"authType", (err, data)=>{ + console.debug("====>getAuthToken first ActsAccountAuthToken_2100 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken first ActsAccountAuthToken_2100 data:" + data); + expect(err.code != 0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.deleteAuthToken("account_callback_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token",(err)=>{ + console.debug("====>deleteAuthToken second ActsAccountAuthToken_2100 err:" + JSON.stringify(err)); + appAccountManager.getAuthToken("account_callback_repeatDelete",OWNERSELF,"authType", (err, data)=>{ + console.debug("====>getAuthToken second ActsAccountAuthToken_2100 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken second ActsAccountAuthToken_2100 data:" + data); + expect(err.code != 0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.removeAccount("account_callback_repeatDelete", (err)=>{ + console.debug("====>removeAccount ActsAccountAuthToken_2100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_2100 end===="); + done(); + }); + }); + }); + }); + }); + }); + }); + }); + + + + it('ActsAccountAuthToken_2200', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_2200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_2200 createAccount start===="); + await appAccountManager.createAccount("account_promise_repeatDelete"); + console.debug("====>setAuthToken ActsAccountAuthToken_2200 start===="); + await appAccountManager.setAuthToken("account_promise_repeatDelete","aythType","promise_repeatDelete_token"); + console.debug("====>deleteAuthToken first ActsAccountAuthToken_2200 start===="); + await appAccountManager.deleteAuthToken("account_promise_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token"); + try{ + console.debug("====>deleteAuthToken second ActsAccountAuthToken_2200 start===="); + await appAccountManager.deleteAuthToken("account_promise_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token"); + expect().assertFail() + }catch(err){ + expect(err.code == 12400004).assertEqual(true); + console.debug("====>deleteAuthToken second ActsAccountAuthToken_2200 err:" + JSON.stringify(err)); + } + try{ + console.debug("====>getAuthToken ActsAccountAuthToken_2200 start===="); + var data = await appAccountManager.getAuthToken("account_promise_repeatDelete",OWNERSELF,"authType"); + expect().assertFail() + } + catch(err){ + console.debug("====>getAuthToken ActsAccountAuthToken_2200 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_2200 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_repeatDelete"); + console.debug("====>ActsAccountAuthToken_2200 end===="); + done(); + } + }); + + + it('ActsAccountAuthToken_2300', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_2300 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_callback_setEmptyToken", (err)=>{ + console.debug("====>createAccount ActsAccountAuthToken_2300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_setEmptyToken","authType","",(err)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_2300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_setEmptyToken",OWNERSELF,"authType", (err, data)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_2300 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken ActsAccountAuthToken_2300 data:" + data); + expect(err.code != 0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.removeAccount("account_callback_setEmptyToken", (err)=>{ + console.debug("====>removeAccount ActsAccountAuthToken_2300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_2300 end===="); + done(); + }); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_2400', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_2400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_2400 createAccount start===="); + await appAccountManager.createAccount("account_promise_setEmptyToken"); + console.debug("====>setAuthToken ActsAccountAuthToken_2400 start===="); + await appAccountManager.setAuthToken("account_promise_setEmptyToken","aythType",""); + console.debug("====>getAuthToken ActsAccountAuthToken_2400 start===="); + try{ + await appAccountManager.getAuthToken("account_promise_setEmptyToken","authType",limitToken); + } + catch(err){ + console.debug("====>getAuthToken ActsAccountAuthToken_2400 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_2400 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_setEmptyToken"); + console.debug("====>ActsAccountAuthToken_2400 end===="); + done(); + } + }); + + + + it('ActsAccountAuthToken_2500', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_2500 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_callback_spaceToken", (err)=>{ + console.debug("====>createAccount ActsAccountAuthToken_2500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_spaceToken","authType"," ",(err)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_2500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_spaceToken",OWNERSELF,"authType", (err, data)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_2500 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken ActsAccountAuthToken_2500 data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual(" "); + appAccountManager.removeAccount("account_callback_spaceToken", (err)=>{ + console.debug("====>removeAccount ActsAccountAuthToken_2500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_2500 end===="); + done(); + }); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_2600', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_2600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_2600 createAccount start===="); + await appAccountManager.createAccount("account_promise_spaceToken"); + console.debug("====>setAuthToken ActsAccountAuthToken_2600 start===="); + await appAccountManager.setAuthToken("account_promise_spaceToken","aythType"," "); + console.debug("====>getAuthToken ActsAccountAuthToken_2600 start===="); + var data = await appAccountManager.getAuthToken("account_promise_spaceToken",OWNERSELF,"aythType"); + expect(data).assertEqual(" "); + console.debug("====>ActsAccountAuthToken_2600 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_spaceToken"); + console.debug("====>ActsAccountAuthToken_2600 end===="); + done(); + }); + + + + it('ActsAccountAuthToken_2700', 0, async function(done) { + var limitToken = ''; + for (let i = 0; i < TOKENLENGTHLIMIT + 1; i++) { + limitToken += 't'; + } + console.debug("====>ActsAccountAuthToken_2700 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_callback_exceed_limitToken", (err)=>{ + console.debug("====>createAccount ActsAccountAuthToken_2700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_exceed_limitToken","authType",limitToken,(err)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_2700 err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + appAccountManager.removeAccount("account_callback_exceed_limitToken", (err)=>{ + console.debug("====>removeAccount ActsAccountAuthToken_2700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_2700 end===="); + done(); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_2800', 0, async function(done) { + var limitToken = ''; + for (let i = 0; i < TOKENLENGTHLIMIT + 1; i++) { + limitToken += 't'; + } + console.debug("====>ActsAccountAuthToken_2800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_2800 createAccount start===="); + await appAccountManager.createAccount("account_promise_exceed_limitToken"); + console.debug("====>setAuthToken ActsAccountAuthToken_2800 start===="); + try{ + await appAccountManager.setAuthToken("account_promise_exceed_limitToken","authType",limitToken); + } + catch(err){ + console.debug("====>setAuthToken ActsAccountAuthToken_2800 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_2800 removeAccount start===="); + appAccountManager.removeAccount("account_promise_exceed_limitToken"); + console.debug("====>ActsAccountAuthToken_2800 end===="); + done(); + } + }); + + + it('ActsAccountAuthToken_2900', 0, async function(done) { + var limitToken = ''; + for (let i = 0; i < TOKENLENGTHLIMIT; i++) { + limitToken += 't'; + } + console.debug("====>ActsAccountAuthToken_2900 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_callback_limitToken", (err)=>{ + console.debug("====>createAccount ActsAccountAuthToken_2900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_limitToken","authType",limitToken,(err)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_2900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_limitToken",OWNERSELF,"authType", (err, data)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_2900 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken ActsAccountAuthToken_2900 data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual(limitToken); + appAccountManager.removeAccount("account_callback_limitToken", (err)=>{ + console.debug("====>removeAccount ActsAccountAuthToken_2900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_2900 end===="); + done(); + }); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_3000', 0, async function(done) { + var limitToken = ''; + for (let i = 0; i < TOKENLENGTHLIMIT; i++) { + limitToken += 't'; + } + console.debug("====>ActsAccountAuthToken_3000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_3000 createAccount start===="); + await appAccountManager.createAccount("account_promise_limitToken"); + console.debug("====>setAuthToken ActsAccountAuthToken_3000 start===="); + await appAccountManager.setAuthToken("account_promise_limitToken","authType",limitToken); + console.debug("====>getAuthToken ActsAccountAuthToken_3000 start===="); + var data = await appAccountManager.getAuthToken("account_promise_limitToken",OWNERSELF,"authType"); + expect(data).assertEqual(limitToken); + console.debug("====>ActsAccountAuthToken_3000 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_limitToken"); + console.debug("====>ActsAccountAuthToken_3000 end===="); + done(); + }); + + + it('ActsAccountAuthToken_3100', 0, async function(done) { + var limitAuthType = ''; + for (let i = 0; i < AUTHTYPELENGTHLIMIT + 1; i++) { + limitAuthType += 't'; + } + console.debug("====>ActsAccountAuthToken_3100 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_callback_limitAuthType", (err)=>{ + console.debug("====>createAccount ActsAccountAuthToken_3100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_limitAuthType",limitAuthType,"account_callback_limitAuthType_token",(err, data)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_3100 err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + appAccountManager.removeAccount("account_callback_limitAuthType", (err)=>{ + console.debug("====>removeAccount ActsAccountAuthToken_3100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_3100 end===="); + done(); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_3200', 0, async function(done) { + var limitAuthType = ''; + for (let i = 0; i < AUTHTYPELENGTHLIMIT + 1; i++) { + limitAuthType += 't'; + } + console.debug("====>ActsAccountAuthToken_3400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_3400 createAccount start===="); + await appAccountManager.createAccount("account_promise_exceed_limitAuthType"); + console.debug("====>setAuthToken ActsAccountAuthToken_3400 start===="); + try{ + await appAccountManager.setAuthToken("account_promise_exceed_limitAuthType",limitAuthType,"account_promise_limitAuthType_token"); + } + catch(err){ + console.debug("====>setAuthToken ActsAccountAuthToken_3400 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_3400 removeAccount start===="); + appAccountManager.removeAccount("account_promise_exceed_limitAuthType"); + console.debug("====>ActsAccountAuthToken_3400 end===="); + done(); + } + }); + + + + it('ActsAccountAuthToken_3300', 0, async function(done) { + var limitAuthType = ''; + for (let i = 0; i < AUTHTYPELENGTHLIMIT + 1; i++) { + limitAuthType += 't'; + } + console.debug("====>ActsAccountAuthToken_3300 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_callback_limitAuthType", (err)=>{ + console.debug("====>createAccount ActsAccountAuthToken_3300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_limitAuthType","com.example.actsaccounttest",limitAuthType, (err, data)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_3300 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken ActsAccountAuthToken_3300 data:" + data); + expect(err.code!=0).assertEqual(true); + appAccountManager.removeAccount("account_callback_limitAuthType", (err)=>{ + console.debug("====>removeAccount ActsAccountAuthToken_3300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_3300 end===="); + done(); + }); + }); + }); + }); + + it('ActsAccountAuthToken_3400', 0, async function(done) { + var limitAuthType = ''; + for (let i = 0; i < AUTHTYPELENGTHLIMIT + 1; i++) { + limitAuthType += 't'; + } + console.debug("====>ActsAccountAuthToken_3400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_3400 createAccount start===="); + await appAccountManager.createAccount("account_promise_limitAuthType"); + console.debug("====>getAuthToken ActsAccountAuthToken_3400 start===="); + try{ + await appAccountManager.getAuthToken("account_promise_limitAuthType",OWNERSELF,limitAuthType); + } + catch(err){ + console.debug("====>getAuthToken ActsAccountAuthToken_3400 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_3400 removeAccount start===="); + appAccountManager.removeAccount("account_promise_limitAuthType"); + console.debug("====>ActsAccountAuthToken_3400 end===="); + done(); + } + }); + + + + /* + * @tc.number : ActsAccountAuthToken_2700 + * @tc.name : Test auth token in callback form + * @tc.desc : 设置一个authType长度刚好为é™åˆ¶é•¿åº¦çš„token 查询 + */ + it('ActsAccountAuthToken_3500', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_3500 start===="); + var limitAuthType = ''; + for (let i = 0; i < AUTHTYPELENGTHLIMIT; i++) { + limitAuthType += 't'; + } + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_3500 create finish===="); + appAccountManager.createAccount("account_callback_limitAuthType", (err)=>{ + console.debug("====>add account ActsAccountAuthToken_3500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_limitAuthType",limitAuthType,"account_callback_limitAuthType_token", (err)=>{ + console.debug("====>setAuthToken ActsAccountAuthToken_3500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_limitAuthType","com.example.actsaccountoperatetest",limitAuthType, (err, data)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_3500 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken ActsAccountAuthToken_3500 data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("account_callback_limitAuthType_token"); + appAccountManager.removeAccount("account_callback_limitAuthType", (err)=>{ + console.debug("====>delete Account ActsAccountAuthToken_3500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_3500 end===="); + done(); + }); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountAuthToken_2800 + * @tc.name : Test auth token in promise form + * @tc.desc : 设置一个authType长度刚好为é™åˆ¶é•¿åº¦çš„token + */ + + /* + * @tc.number : ActsAccountAuthToken_2900 + * @tc.name : Test auth token in callback form + * @tc.desc : Clear token parameter name is an empty string + */ + //测试 åˆ é™¤ä¸€ä¸ªè´¦å·å为空的token callbackæ–¹å¼ + it('ActsAccountAuthToken_4100', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_4100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_4100 create finish===="); + appAccountManager.deleteAuthToken(" ","com.example.actsaccounttest","authType","account_notExist_token", (err)=>{ + console.debug("====>clearauthToken ActsAccountAuthToken_4100 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_4100 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsAccountAuthToken_3000 + * @tc.name : Test auth token in promise form + * @tc.desc : Clear token parameter name is an empty string + */ + //测试 åˆ é™¤ä¸€ä¸ªè´¦å·å为空的token promiseæ–¹å¼ + it('ActsAccountAuthToken_4200', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_4200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_4200 create finish===="); + console.debug("====>clearauthToken ActsAccountAuthToken_4200 start===="); + try{ + await appAccountManager.deleteAuthToken("","com.example.actsaccounttest","authType","account_notExist_token"); + } + catch(err){ + console.debug("====>deleteAuthToken ActsAccountAuthToken_4200 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_4200 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountAuthToken_3100 + * @tc.name : Test auth token in callback form + * @tc.desc : The clear token parameter name is a space string + */ + it('ActsAccountAuthToken_4300', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_4300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_4300 create finish===="); + appAccountManager.deleteAuthToken(" ","com.example.actsaccounttest","authType","account_notExist_token", (err)=>{ + console.debug("====>clearauthToken ActsAccountAuthToken_4300 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_4300 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsAccountAuthToken_3200 + * @tc.name : Test auth token in promise form + * @tc.desc : The clear token parameter name is a space string + */ + it('ActsAccountAuthToken_4400', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_4400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_4400 create finish===="); + console.debug("====>clearauthToken ActsAccountAuthToken_4400 start===="); + try{ + await appAccountManager.deleteAuthToken(" ","com.example.actsaccounttest","authType","account_notExist_token"); + } + catch(err){ + console.debug("====>deleteAuthToken ActsAccountAuthToken_4400 err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_4400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountAuthToken_3300 + * @tc.name : Test auth token in callback form + * @tc.desc : Clear the token parameter name exceeds the length limit of 1024 characters + */ + it('ActsAccountAuthToken_4500', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_4500 start===="); + var nameLimit = ''; + for (let i = 0; i < LENGTHLIMIT + 1; i++) { + nameLimit += 't'; + } + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_4500 create finish===="); + appAccountManager.deleteAuthToken(nameLimit,"com.example.actsaccounttest","authType","account_notExist_token", (err)=>{ + console.debug("====>clearauthToken ActsAccountAuthToken_4500 err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_4500 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsAccountAuthToken_3400 + * @tc.name : Test auth token in promise form + * @tc.desc : Clear the token parameter name exceeds the length limit of 1024 characters + */ + it('ActsAccountAuthToken_4600', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_4600 start===="); + var nameLimit = ''; + for (let i = 0; i < LENGTHLIMIT + 1; i++) { + nameLimit += 't'; + } + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_4600 create finish===="); + console.debug("====>deleteAuthToken ActsAccountAuthToken_4600 start===="); + try{ + await appAccountManager.deleteAuthToken(nameLimit,"com.example.actsaccounttest","authType","account_notExist_token"); + } + catch(err){ + console.debug("====>deleteAuthToken ActsAccountAuthToken_4600 err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_4600 end===="); + done(); + } + }); + + //æŸ¥è¯¢æ— æ•ˆåŒ…åowner(为其他å—符串时)账å·çš„token callbackæ–¹å¼ + it('ActsAccountAuthToken_4700', 0, async function(done) { + console.debug("====>ActsAccountAuthToken_4700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_4700 create finish===="); + appAccountManager.createAccount("account_callback_invalid_owner", (err)=>{ + console.debug("====>add account ActsAccountAuthToken_4700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_invalid_owner","invalid_owner","authType", (err, data)=>{ + console.debug("====>getAuthToken ActsAccountAuthToken_4700 err:" + JSON.stringify(err)); + console.debug("====>getAuthToken ActsAccountAuthToken_4700 data:" + data); + expect(err.code!=0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.removeAccount("account_callback_invalid_owner", (err)=>{ + console.debug("====>delete account ActsAccountAuthToken_4700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_4700 end===="); + done(); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_3600', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_3600 start===="); + var limitAuthType = ''; + for (var i = 0; i < AUTHTYPELENGTHLIMIT; i++) { + limitAuthType += 't'; + } + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_3600 createAccount start===="); + await appAccountManager.createAccount("account_promise_limitAuthType"); + console.debug("====>ActsAccountAuthToken_3600 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_limitAuthType",limitAuthType,"account_promise_limitAuthType_token"); + console.debug("====>ActsAccountAuthToken_3600 getAuthToken start===="); + var data = await appAccountManager.getAuthToken("account_promise_limitAuthType",OWNERSELF,limitAuthType); + expect(data).assertEqual("account_promise_limitAuthType_token"); + console.debug("====>ActsAccountAuthToken_3600 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_limitAuthType"); + console.debug("====>ActsAccountAuthToken_3600 end===="); + done(); + }); + + + it('ActsAccountAuthToken_3700', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_3700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_3700 createAccount start===="); + appAccountManager.createAccount("account_callback_authType_empty",(err)=>{ + console.debug("====>ActsAccountAuthToken_3700 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_authType_empty","","account_callback_authType_empty_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_3700 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_authType_empty",OWNERSELF,"",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_3700 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_3700 getAuthToken data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("account_callback_authType_empty_token"); + appAccountManager.removeAccount("account_callback_authType_empty",(err)=>{ + console.debug("====>ActsAccountAuthToken_3700 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_3700 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_3800', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_3800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_3800 createAccount start===="); + await appAccountManager.createAccount("account_promise_authType_empty"); + console.debug("====>ActsAccountAuthToken_3800 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_authType_empty","","account_promise_authType_empty_token"); + console.debug("====>ActsAccountAuthToken_3800 getAuthToken start===="); + var data = await appAccountManager.getAuthToken("account_promise_authType_empty",OWNERSELF,""); + expect(data).assertEqual("account_promise_authType_empty_token"); + console.debug("====>ActsAccountAuthToken_3800 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_authType_empty"); + console.debug("====>ActsAccountAuthToken_3800 end===="); + done(); + }); + + it('ActsAccountAuthToken_3900', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_3900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_3900 createAccount start===="); + appAccountManager.createAccount("account_callback_authType_space",(err)=>{ + console.debug("====>ActsAccountAuthToken_3900 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_authType_space"," ","account_callback_authType_space_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_3900 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_authType_space",OWNERSELF," ",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_3900 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_3900 getAuthToken data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("account_callback_authType_space_token"); + appAccountManager.removeAccount("account_callback_authType_space",(err)=>{ + console.debug("====>ActsAccountAuthToken_3900 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_3900 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_4000', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_4000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_4000 createAccount start===="); + await appAccountManager.createAccount("account_promise_authType_space"); + console.debug("====>ActsAccountAuthToken_4000 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_authType_space"," ","account_promise_authType_space_token"); + console.debug("====>ActsAccountAuthToken_4000 getAuthToken start===="); + var data = await appAccountManager.getAuthToken("account_promise_authType_space",OWNERSELF," "); + expect(data).assertEqual("account_promise_authType_space_token"); + console.debug("====>ActsAccountAuthToken_4000 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_authType_space"); + console.debug("====>ActsAccountAuthToken_4000 end===="); + done(); + }); + + + it('ActsAccountAuthToken_4800', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_4800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_4800 createAccount start===="); + await appAccountManager.createAccount("account_promise_invalid_owner"); + console.debug("====>ActsAccountAuthToken_4800 getAuthToken start===="); + try{ + var data = await appAccountManager.getAuthToken("account_promise_invalid_owner","invalid_owner","authType"); + } + catch(err){ + console.debug("====>ActsAccountAuthToken_4800 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_4800 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_invalid_owner"); + console.debug("====>ActsAccountAuthToken_4800 end===="); + done(); + } + }); + + it('ActsAccountAuthToken_4900', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_4900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_4900 createAccount start===="); + appAccountManager.createAccount("account_callback_owner_empty",(err)=>{ + console.debug("====>ActsAccountAuthToken_4900 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_owner_empty","","authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_4900 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_4900 getAuthToken data:" + data); + expect(err.code!=0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.removeAccount("account_callback_owner_empty",(err)=>{ + console.debug("====>ActsAccountAuthToken_4900 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_4900 end===="); + done(); + }); + }); + }); + }); + + it('ActsAccountAuthToken_5000', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_5000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_5000 createAccount start===="); + await appAccountManager.createAccount("account_promise_owner_empty"); + console.debug("====>ActsAccountAuthToken_5000 getAuthToken start===="); + try{ + var data = await appAccountManager.getAuthToken("account_promise_owner_empty","","authType"); + } + catch(err){ + console.debug("====>ActsAccountAuthToken_5000 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_5000 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_owner_empty"); + console.debug("====>ActsAccountAuthToken_5000 end===="); + done(); + } + }); + + it('ActsAccountAuthToken_5100', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_5100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_5100 createAccount start===="); + appAccountManager.createAccount("account_callback_owner_space",(err)=>{ + console.debug("====>ActsAccountAuthToken_5100 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_owner_space"," ","authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_5100 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_5100 getAuthToken data:" + data); + expect(err.code!=0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.removeAccount("account_callback_owner_space",(err)=>{ + console.debug("====>ActsAccountAuthToken_5100 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_5100 end===="); + done(); + }); + }); + }); + }); + + it('ActsAccountAuthToken_5200', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_5200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_5200 createAccount start===="); + await appAccountManager.createAccount("account_callback_owner_space"); + console.debug("====>ActsAccountAuthToken_5200 getAuthToken start===="); + try{ + var data = await appAccountManager.getAuthToken("account_callback_owner_space"," ","authType"); + } + catch(err){ + console.debug("====>ActsAccountAuthToken_5200 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_5200 removeAccount start===="); + await appAccountManager.removeAccount("account_callback_owner_space"); + console.debug("====>ActsAccountAuthToken_5200 end===="); + done(); + } + }); + + it('ActsAccountAuthToken_5300', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_5300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_5300 createAccount start===="); + appAccountManager.createAccount("account_callback_authType_invalid",(err)=>{ + console.debug("====>ActsAccountAuthToken_5300 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_authType_invalid","authType","account_callback_authType_invalid_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_5300 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_authType_invalid",OWNERSELF,"invalid_authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_5300 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_5300 getAuthToken data:" + data); + expect(err.code!=0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.removeAccount("account_callback_authType_invalid",(err)=>{ + console.debug("====>ActsAccountAuthToken_5300 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_5300 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_5400', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_5400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_5400 createAccount start===="); + await appAccountManager.createAccount("account_promise_authType_invalid"); + console.debug("====>ActsAccountAuthToken_5400 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_authType_invalid","authType","account_promise_authType_invalid_token"); + console.debug("====>ActsAccountAuthToken_5400 getAuthToken start===="); + try{ + var data = await appAccountManager.getAuthToken("account_promise_authType_invalid",OWNERSELF,"invalid_authType"); + } + catch(err){ + console.debug("====>ActsAccountAuthToken_5400 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_5400 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_authType_invalid"); + console.debug("====>ActsAccountAuthToken_5400 end===="); + done(); + } + }); + + it('ActsAccountAuthToken_5500', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_5500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_5500 createAccount start===="); + appAccountManager.createAccount("account_callback_authType_empty",(err)=>{ + console.debug("====>ActsAccountAuthToken_5500 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_authType_empty","authType","account_callback_authType_empty_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_5500 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_authType_empty",OWNERSELF,"",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_5500 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_5500 getAuthToken data:" + data); + expect(err.code!=0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.removeAccount("account_callback_authType_empty",(err)=>{ + console.debug("====>ActsAccountAuthToken_5500 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_5500 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_5600', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_5600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_5600 createAccount start===="); + await appAccountManager.createAccount("account_promise_authType_empty"); + console.debug("====>ActsAccountAuthToken_5600 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_authType_empty","authType","account_promise_authType_empty_token"); + console.debug("====>ActsAccountAuthToken_5600 getAuthToken start===="); + try{ + var data = await appAccountManager.getAuthToken("account_promise_authType_empty",OWNERSELF,""); + } + catch(err){ + console.debug("====>ActsAccountAuthToken_5600 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_5600 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_authType_empty"); + console.debug("====>ActsAccountAuthToken_5600 end===="); + done(); + } + }); + + it('ActsAccountAuthToken_5700', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_5700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_5700 createAccount start===="); + appAccountManager.createAccount("account_callback_authType_space",(err)=>{ + console.debug("====>ActsAccountAuthToken_5700 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_authType_space","authType","account_callback_authType_space_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_5700 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_callback_authType_space",OWNERSELF," ",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_5700 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_5700 getAuthToken data:" + data); + expect(err.code!=0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.removeAccount("account_callback_authType_space",(err)=>{ + console.debug("====>ActsAccountAuthToken_5700 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_5700 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_5800', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_5800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_5800 createAccount start===="); + await appAccountManager.createAccount("account_promise_authType_space"); + console.debug("====>ActsAccountAuthToken_5800 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_authType_space","authType","account_promise_authType_space_token"); + console.debug("====>ActsAccountAuthToken_5800 getAuthToken start===="); + try{ + var data = await appAccountManager.getAuthToken("account_promise_authType_space",OWNERSELF," "); + } + catch(err){ + console.debug("====>ActsAccountAuthToken_5800 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_5800 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_authType_space"); + console.debug("====>ActsAccountAuthToken_5800 end===="); + done(); + } + }); + + it('ActsAccountAuthToken_5900', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_5900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_5900 createAccount start===="); + appAccountManager.createAccount("account_callback_owner_invalid",(err)=>{ + console.debug("====>ActsAccountAuthToken_5900 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_owner_invalid","authType","account_callback_owner_invalid_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_5900 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.deleteAuthToken("account_callback_owner_invalid","invalid_owner","authType","account_callback_owner_invalid_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_5900 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + appAccountManager.removeAccount("account_callback_owner_invalid",(err)=>{ + console.debug("====>ActsAccountAuthToken_5900 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_5900 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_6000', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_6000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_6000 createAccount start===="); + await appAccountManager.createAccount("account_promise_owner_invalid"); + console.debug("====>ActsAccountAuthToken_6000 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_owner_invalid","authType","account_promise_owner_invalid_token"); + console.debug("====>ActsAccountAuthToken_6000 getAuthToken start===="); + try{ + await appAccountManager.deleteAuthToken("account_promise_owner_invalid","invalid_owner","authType","account_promise_owner_invalid_token"); + } + catch(err){ + console.debug("====>ActsAccountAuthToken_6000 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_6000 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_owner_invalid"); + console.debug("====>ActsAccountAuthToken_6000 end===="); + done(); + } + }); + + it('ActsAccountAuthToken_6100', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_6100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_6100 createAccount start===="); + appAccountManager.createAccount("account_callback_owner_empty",(err)=>{ + console.debug("====>ActsAccountAuthToken_6100 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_owner_empty","authType","account_callback_owner_empty_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_6100 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.deleteAuthToken("account_callback_owner_empty","","authType","account_callback_owner_empty_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_6100 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + appAccountManager.removeAccount("account_callback_owner_empty",(err)=>{ + console.debug("====>ActsAccountAuthToken_6100 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_6100 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_6200', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_6200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_6200 createAccount start===="); + await appAccountManager.createAccount("account_promise_owner_empty"); + console.debug("====>ActsAccountAuthToken_6200 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_owner_empty","authType","account_promise_owner_empty_token"); + console.debug("====>ActsAccountAuthToken_6200 getAuthToken start===="); + try{ + await appAccountManager.deleteAuthToken("account_promise_owner_empty","","authType","account_promise_owner_empty_token"); + } + catch(err){ + console.debug("====>ActsAccountAuthToken_6200 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_6200 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_owner_empty"); + console.debug("====>ActsAccountAuthToken_6200 end===="); + done(); + } + }); + + it('ActsAccountAuthToken_6300', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_6300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_6300 createAccount start===="); + appAccountManager.createAccount("account_callback_owner_space",(err)=>{ + console.debug("====>ActsAccountAuthToken_6300 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_owner_space","authType","account_callback_owner_space_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_6300 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.deleteAuthToken("account_callback_owner_space"," ","authType","account_callback_owner_space_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_6300 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + appAccountManager.removeAccount("account_callback_owner_space",(err)=>{ + console.debug("====>ActsAccountAuthToken_6300 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_6300 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_6400', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_6400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_6400 createAccount start===="); + await appAccountManager.createAccount("account_promise_owner_space"); + console.debug("====>ActsAccountAuthToken_6400 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_owner_space","authType","account_promise_owner_space_token"); + console.debug("====>ActsAccountAuthToken_6400 getAuthToken start===="); + try{ + await appAccountManager.deleteAuthToken("account_promise_owner_space"," ","authType","account_promise_owner_space_token"); + } + catch(err){ + console.debug("====>ActsAccountAuthToken_6400 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_6400 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_owner_space"); + console.debug("====>ActsAccountAuthToken_6400 end===="); + done(); + } + }); + + it('ActsAccountAuthToken_6500', 0, async function (done) { + var limitToken = ''; + for(var i = 0;i < TOKENLENGTHLIMIT + 1; i++){ + limitToken += 'c'; + } + console.debug("====>ActsAccountAuthToken_6500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_6500 createAccount start===="); + appAccountManager.createAccount("account_callback_token_exceedLimit",(err)=>{ + console.debug("====>ActsAccountAuthToken_6500 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.deleteAuthToken("account_callback_token_exceedLimit",OWNERSELF,"authType",limitToken,(err)=>{ + console.debug("====>ActsAccountAuthToken_6500 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + appAccountManager.removeAccount("account_callback_token_exceedLimit",(err)=>{ + console.debug("====>ActsAccountAuthToken_6500 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_6500 end===="); + done(); + }); + }); + }); + }); + + it('ActsAccountAuthToken_6600', 0, async function (done) { + var limitToken = ''; + for(var i = 0;i < TOKENLENGTHLIMIT + 1; i++){ + limitToken += 'c'; + } + console.debug("====>ActsAccountAuthToken_6600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_6600 createAccount start===="); + await appAccountManager.createAccount("account_promise_token_exceedLimit"); + console.debug("====>ActsAccountAuthToken_6600 deleteAuthToken start===="); + try{ + await appAccountManager.deleteAuthToken("account_promise_token_exceedLimit",OWNERSELF,"authType",limitToken); + } + catch(err){ + console.debug("====>ActsAccountAuthToken_6600 getAuthToken err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_6600 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_token_exceedLimit"); + console.debug("====>ActsAccountAuthToken_6600 end===="); + done(); + } + }); + + it('ActsAccountAuthToken_6700', 0, async function (done) { + var limitToken = ''; + for(var i = 0;i < TOKENLENGTHLIMIT; i++){ + limitToken += 'c'; + } + console.debug("====>ActsAccountAuthToken_6700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_6700 createAccount start===="); + appAccountManager.createAccount("account_callback_token_limit",(err)=>{ + console.debug("====>ActsAccountAuthToken_6700 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_token_limit","authType",limitToken,(err)=>{ + console.debug("====>ActsAccountAuthToken_6700 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.deleteAuthToken("account_callback_token_limit",OWNERSELF,"authType",limitToken,(err)=>{ + console.debug("====>ActsAccountAuthToken_6700 getAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("account_callback_token_limit",(err)=>{ + console.debug("====>ActsAccountAuthToken_6700 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_6700 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_6800', 0, async function (done) { + var limitToken = ''; + for(var i = 0;i < TOKENLENGTHLIMIT; i++){ + limitToken += 'c'; + } + console.debug("====>ActsAccountAuthToken_6800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_6800 createAccount start===="); + await appAccountManager.createAccount("account_promise_token_limit"); + console.debug("====>ActsAccountAuthToken_6800 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_token_limit","authType",limitToken); + console.debug("====>ActsAccountAuthToken_6800 deleteAuthToken start===="); + await appAccountManager.deleteAuthToken("account_promise_token_limit",OWNERSELF,"authType",limitToken); + console.debug("====>ActsAccountAuthToken_6800 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_token_limit"); + console.debug("====>ActsAccountAuthToken_6800 end===="); + done(); + }); + + it('ActsAccountAuthToken_6900', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_6900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_6900 createAccount start===="); + appAccountManager.createAccount("account_callback_delete_space",(err)=>{ + console.debug("====>ActsAccountAuthToken_6900 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_callback_delete_space","authType","account_callback_delete_space_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_6900 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.deleteAuthToken("account_callback_delete_space", OWNERSELF,"authType", "",(err)=>{ + console.debug("====>ActsAccountAuthToken_6900 deleteAuthToken err:" + JSON.stringify(err)); + expect(err.code == 12400004).assertEqual(true) + appAccountManager.getAuthToken("account_callback_delete_space", OWNERSELF, "authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_6900 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_6900 getAuthToken data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("account_callback_delete_space_token"); + appAccountManager.removeAccount("account_callback_delete_space",(err)=>{ + console.debug("====>ActsAccountAuthToken_6900 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_6900 end===="); + done(); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_7000', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_7000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountAuthToken_7000 createAccount start===="); + await appAccountManager.createAccount("account_promise_delete_space"); + console.debug("====>ActsAccountAuthToken_7000 setAuthToken start===="); + await appAccountManager.setAuthToken("account_promise_delete_space","authType","account_promise_delete_space_token"); + console.debug("====>ActsAccountAuthToken_7000 deleteAuthToken start===="); + try{ + await appAccountManager.deleteAuthToken("account_promise_delete_space",OWNERSELF,"authType",""); + expect().assertFail(); + done(); + }catch(err){ + expect(err.code == 12400004).assertEqual(true) + console.debug("====>ActsAccountAuthToken_7000 getAuthToken start===="); + var data = await appAccountManager.getAuthToken("account_promise_delete_space",OWNERSELF,"authType"); + expect(data).assertEqual("account_promise_delete_space_token"); + console.debug("====>ActsAccountAuthToken_7000 removeAccount start===="); + await appAccountManager.removeAccount("account_promise_delete_space"); + console.debug("====>ActsAccountAuthToken_7000 end===="); + done(); + } + + + }); + + it('ActsAccountAuthToken_9200', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_9200 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.getAuthCallback("test_sessionId").then(()=>{ + expect().assertFail(); + done(); + }) + .catch((err)=>{ + console.debug("====>ActsAccountAuthToken_9200 getAuthCalback err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true) + done(); + }) + }); + + it('ActsAccountAuthToken_9300', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_9300 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.getAuthCallback("").then(()=>{ + expect().assertFail(); + done(); + }) + .catch((err)=>{ + console.debug("====>ActsAccountAuthToken_9300 getAuthCalback err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true) + done(); + }) + }); + + it('ActsAccountAuthToken_9400', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_9400 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.getAuthCallback(" ").then(()=>{ + expect().assertFail(); + done(); + }) + .catch((err)=>{ + console.debug("====>ActsAccountAuthToken_9400 getAuthCalback err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true) + done(); + }) + }); + + it('ActsAccountAuthToken_9500', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_9500 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.queryAuthenticatorInfo(OWNERSELF,(err)=>{ + console.debug("====>ActsAccountAuthToken_9500 queryAuthenticatorInfo err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + done(); + }); + }); + + it('ActsAccountAuthToken_9600', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_9600 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.queryAuthenticatorInfo("",(err)=>{ + console.debug("====>ActsAccountAuthToken_9600 queryAuthenticatorInfo err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + done(); + }); + }); + + it('ActsAccountAuthToken_9700', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_9700 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.queryAuthenticatorInfo(" ",(err)=>{ + console.debug("====>ActsAccountAuthToken_9700 queryAuthenticatorInfo err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + done(); + }); + }); + + it('ActsAccountAuthToken_9800', 0, async function (done) { + var limiOwner = ''; + for(var i = 0;i < OWNERLENGTHLIMIT + 1; i++){ + limiOwner += 't'; + } + console.debug("====>ActsAccountAuthToken_9800 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.queryAuthenticatorInfo(limiOwner,(err)=>{ + console.debug("====>ActsAccountAuthToken_9800 queryAuthenticatorInfo err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + done(); + }); + }); + + it('ActsAccountAuthToken_9900', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_9900 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_setAuthTokenVisibility_name",(err,)=>{ + console.debug("====>ActsAccountAuthToken_9900 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthTokenVisibility("account_setAuthTokenVisibility_name","authType","test_BundleName",true).then(()=>{ + appAccountManager.getAuthToken("account_setAuthTokenVisibility_name",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_9900 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_9900 getAuthToken data:" + data); + expect(err.code!=0).assertEqual(true); + appAccountManager.getAuthList("account_setAuthTokenVisibility_name","authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_9900 getAuthList err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_9900 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(1); + expect(dataArray[0]).assertEqual("test_BundleName"); + appAccountManager.removeAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_9900 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_9900 end===="); + done(); + }); + }); + }); + }).catch((err)=>{ + expect(err).assertEqual(null); + done(); + }) + }); + }); + + it('ActsAccountAuthToken_10000', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_10000 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_setAuthTokenVisibility_name",(err,)=>{ + console.debug("====>ActsAccountAuthToken_10000 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_setAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_10000 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + try{ + appAccountManager.setAuthTokenVisibility("account_setAuthTokenVisibility_name","authType","test_BundleName","true",(err)=>{ + expect().assertFail(); + done(); + }); + }catch(err){ + expect(err.code == 401).assertEqual(true); + console.debug("====>ActsAccountAuthToken_10000 setAuthTokenVisibility err:" + JSON.stringify(err)); + appAccountManager.removeAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10000 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10000 end===="); + done(); + }); + } + + }); + }); + }); + + it('ActsAccountAuthToken_10100', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_10100 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10100 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_setAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_10100 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + try{ + appAccountManager.setAuthTokenVisibility("account_setAuthTokenVisibility_name","authType","test_BundleName","invalid_string",(err)=>{ + console.debug("====>ActsAccountAuthToken_10100 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }); + }catch(err){ + console.debug("====>ActsAccountAuthToken_10100 setAuthTokenVisibility throw_err:" + JSON.stringify(err)); + expect(err.code == 401).assertEqual(true); + appAccountManager.getAuthList("account_setAuthTokenVisibility_name","authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_10100 getAuthList err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10100 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(0); + appAccountManager.removeAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10100 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10100 end===="); + done(); + }); + }); + } + }); + }); + }); + + it('ActsAccountAuthToken_10200', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_10200 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10200 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_setAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_10200 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthTokenVisibility("account_setAuthTokenVisibility_name","authType","",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_10200 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err.code==12300002).assertEqual(true); + appAccountManager.removeAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10200 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10200 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_10300', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_10300 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10300 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_setAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_10300 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthTokenVisibility("account_setAuthTokenVisibility_name","authType"," ",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_10300 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthList("account_setAuthTokenVisibility_name","authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_10300 getAuthList err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10300 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(1); + expect(dataArray[0]).assertEqual(" "); + appAccountManager.removeAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10300 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10300 end===="); + done(); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_10400', 0, async function (done) { + var limitBundleName = ''; + for(var i = 0;i < OWNERLENGTHLIMIT + 1; i++){ + limitBundleName += 't'; + } + console.debug("====>ActsAccountAuthToken_10400 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10400 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_setAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_10400 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthTokenVisibility("account_setAuthTokenVisibility_name","authType",limitBundleName,true,(err)=>{ + console.debug("====>ActsAccountAuthToken_10400 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + appAccountManager.removeAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10400 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10400 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_10500', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_10500 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10500 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_setAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_10500 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthTokenVisibility("account_setAuthTokenVisibility_name","","test_bundleName",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_10500 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthList("account_setAuthTokenVisibility_name","",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_10500 getAuthList err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10500 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(1); + expect(dataArray[0]).assertEqual("test_bundleName"); + appAccountManager.getAuthList("account_setAuthTokenVisibility_name","authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_10500 getAuthList authType:\"authType\" err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10500 getAuthList authType:\"authType\" dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(0); + appAccountManager.removeAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10500 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10500 end===="); + done(); + }); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_10600', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_10600 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10600 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_setAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_10600 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthTokenVisibility("account_setAuthTokenVisibility_name"," ","test_bundleName",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_10600 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthList("account_setAuthTokenVisibility_name"," ",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_10600 getAuthList err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10600 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(1); + expect(dataArray[0]).assertEqual("test_bundleName"); + appAccountManager.getAuthList("account_setAuthTokenVisibility_name","authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_10600 getAuthList authType:\"authType\" err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10600 getAuthList authType:\"authType\" dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(0); + appAccountManager.removeAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10600 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10600 end===="); + done(); + }); + }); + }); + }); + }); + }); + }); + + + it('ActsAccountAuthToken_10700', 0, async function (done) { + var limitAuthType = ''; + for(var i = 0;i < AUTHTYPELENGTHLIMIT + 1; i++){ + limitAuthType += 't'; + } + console.debug("====>ActsAccountAuthToken_10700 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10700 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_setAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_10700 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthTokenVisibility("account_setAuthTokenVisibility_name",limitAuthType,"test_bundleName",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_10700 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + appAccountManager.getAuthList("account_setAuthTokenVisibility_name","authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_10700 getAuthList authType:\"authType\" err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10700 getAuthList authType:\"authType\" dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(0); + appAccountManager.removeAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10700 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10700 end===="); + done(); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_10800', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_10800 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10800 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_setAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_10800 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthTokenVisibility("account_setAuthTokenVisibility_name","invalid_authType","test_bundleName",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_10800 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthList("account_setAuthTokenVisibility_name","invalid_authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_10800 getAuthList err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10800 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(1); + expect(dataArray[0]).assertEqual("test_bundleName"); + appAccountManager.getAuthList("account_setAuthTokenVisibility_name","authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_10800 getAuthList authType:\"authType\" err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10800 getAuthList authType:\"authType\" dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(0); + appAccountManager.removeAccount("account_setAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_10800 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_10800 end===="); + done(); + }); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_10900', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_10900 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.setAuthTokenVisibility("","authType","test_bundleName",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_10900 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + done(); + }); + }); + + it('ActsAccountAuthToken_11000', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_11000 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.setAuthTokenVisibility(" ","authType","test_bundleName",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_11000 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + done(); + }); + }); + + it('ActsAccountAuthToken_11100', 0, async function (done) { + var limitName = ''; + for(var i = 0; i < LENGTHLIMIT + 1; i++){ + limitName += 't'; + } + console.debug("====>ActsAccountAuthToken_11100 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.setAuthTokenVisibility(limitName,"authType","test_bundleName",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_11100 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + done(); + }); + }); + + it('ActsAccountAuthToken_11200', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_11200 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.setAuthTokenVisibility("no_add_account","authType","test_bundleName",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_11200 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + done(); + }); + }); + + it('ActsAccountAuthToken_11300', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_11300 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.checkAuthTokenVisibility("","authType","test_bundleName",(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_11300 checkAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + done(); + }); + }); + + it('ActsAccountAuthToken_11400', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_11400 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.checkAuthTokenVisibility(" ","authType","test_bundleName",(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_11400 checkAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + done(); + }); + }); + + it('ActsAccountAuthToken_11500', 0, async function (done) { + var limitName = ''; + for(var i = 0; i < LENGTHLIMIT + 1; i++){ + limitName += 't'; + } + console.debug("====>ActsAccountAuthToken_11500 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.checkAuthTokenVisibility(limitName,"authType","test_bundleName",(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_11500 checkAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + done(); + }); + }); + + it('ActsAccountAuthToken_11600', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_11600 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.checkAuthTokenVisibility("no_add_account","authType","test_bundleName",(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_11600 checkAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + done(); + }); + }); + + it('ActsAccountAuthToken_11700', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_11700 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_checkAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_11700 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_checkAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_11700 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAuthTokenVisibility("account_checkAuthTokenVisibility_name","","test_bundleName",(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_11700 checkAuthTokenVisibility err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_11700 checkAuthTokenVisibility stateBack:" + stateBack); + expect(err).assertEqual(null); + expect(stateBack).assertEqual(false); + appAccountManager.checkAuthTokenVisibility("account_checkAuthTokenVisibility_name","",OWNERSELF,(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_11700 checkAuthTokenVisibility err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_11700 checkAuthTokenVisibility stateBack:" + stateBack); + expect(err).assertEqual(null); + expect(stateBack).assertEqual(true); + appAccountManager.removeAccount("account_checkAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_11700 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_11700 end===="); + done(); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_11800', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_11800 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_checkAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_11800 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_checkAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_11800 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAuthTokenVisibility("account_checkAuthTokenVisibility_name"," ","test_bundleName",(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_11800 checkAuthTokenVisibility err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_11800 checkAuthTokenVisibility stateBack:" + stateBack); + expect(err).assertEqual(null); + expect(stateBack).assertEqual(false); + appAccountManager.checkAuthTokenVisibility("account_checkAuthTokenVisibility_name"," ",OWNERSELF,(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_11800 checkAuthTokenVisibility err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_11800 checkAuthTokenVisibility stateBack:" + stateBack); + expect(err).assertEqual(null); + expect(stateBack).assertEqual(true); + appAccountManager.removeAccount("account_checkAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_11800 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_11800 end===="); + done(); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_11900', 0, async function (done) { + var limitAuthType =''; + for(var i = 0; i < AUTHTYPELENGTHLIMIT + 1; i++){ + limitAuthType += 't'; + } + console.debug("====>ActsAccountAuthToken_11900 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_checkAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_11900 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_checkAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_11900 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAuthTokenVisibility("account_checkAuthTokenVisibility_name",limitAuthType,"test_bundleName",(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_11900 checkAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + appAccountManager.checkAuthTokenVisibility("account_checkAuthTokenVisibility_name",limitAuthType,OWNERSELF,(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_11900 checkAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + appAccountManager.removeAccount("account_checkAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_11900 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_11900 end===="); + done(); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_12000', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_12000 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_checkAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_12000 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_checkAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_12000 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAuthTokenVisibility("account_checkAuthTokenVisibility_name","invalid_authType","test_bundleName",(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_12000 checkAuthTokenVisibility err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_12000 checkAuthTokenVisibility stateBack:" + stateBack); + expect(err).assertEqual(null); + expect(stateBack).assertEqual(false); + appAccountManager.checkAuthTokenVisibility("account_checkAuthTokenVisibility_name","invalid_authType",OWNERSELF,(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_12000 checkAuthTokenVisibility err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_12000 checkAuthTokenVisibility stateBack:" + stateBack); + expect(err).assertEqual(null); + expect(stateBack).assertEqual(true); + appAccountManager.removeAccount("account_checkAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_12000 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_12000 end===="); + done(); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_12100', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_12100 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_checkAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_12100 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_checkAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_12100 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAuthTokenVisibility("account_checkAuthTokenVisibility_name","authType","",(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_12100 checkAuthTokenVisibility err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_12100 checkAuthTokenVisibility stateBack:" + stateBack); + expect(err.code!=0).assertEqual(true); + appAccountManager.removeAccount("account_checkAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_12100 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_12100 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_12200', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_12200 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_checkAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_12200 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_checkAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_12200 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAuthTokenVisibility("account_checkAuthTokenVisibility_name","authType"," ",(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_12200 checkAuthTokenVisibility err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_12200 checkAuthTokenVisibility stateBack:" + stateBack); + expect(err).assertEqual(null); + expect(stateBack).assertEqual(false); + appAccountManager.removeAccount("account_checkAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_12200 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_12200 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_12300', 0, async function (done) { + var limitBundleName = ''; + for(var i = 0; i < OWNERLENGTHLIMIT + 1; i++){ + limitBundleName += 't'; + } + console.debug("====>ActsAccountAuthToken_12300 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_checkAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_12300 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_checkAuthTokenVisibility_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_12300 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAuthTokenVisibility("account_checkAuthTokenVisibility_name","authType",limitBundleName,(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_12300 checkAuthTokenVisibility err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_12300 checkAuthTokenVisibility stateBack:" + stateBack); + expect(err.code!=0).assertEqual(true); + appAccountManager.removeAccount("account_checkAuthTokenVisibility_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_12300 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_12300 end===="); + done(); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_12400', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_12400 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_testgetAuthList_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_12400 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_testgetAuthList_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_12400 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthTokenVisibility("account_testgetAuthList_name","authType","test_bundleName",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_12400 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthList("account_testgetAuthList_name","",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_12400 getAuthList err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_12400 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(0); + appAccountManager.removeAccount("account_testgetAuthList_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_12400 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_12400 end===="); + done(); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_12500', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_12500 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_testgetAuthList_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_12500 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_testgetAuthList_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_12500 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthTokenVisibility("account_testgetAuthList_name","authType","test_bundleName",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_12500 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthList("account_testgetAuthList_name"," ",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_12500 getAuthList err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_12500 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(0); + appAccountManager.removeAccount("account_testgetAuthList_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_12500 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_12500 end===="); + done(); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_12600', 0, async function (done) { + var limitAuthType =''; + for(var i = 0; i < AUTHTYPELENGTHLIMIT + 1; i++){ + limitAuthType += 't'; + } + console.debug("====>ActsAccountAuthToken_12600 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_testgetAuthList_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_12600 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_testgetAuthList_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_12600 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthTokenVisibility("account_testgetAuthList_name","authType","test_bundleName",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_12600 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthList("account_testgetAuthList_name",limitAuthType,(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_12600 getAuthList err:" + JSON.stringify(err)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountAuthToken_12600 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(dataArray).assertEqual(null); + appAccountManager.removeAccount("account_testgetAuthList_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_12600 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_12600 end===="); + done(); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_12700', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_12700 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.getAuthList("","authType").then((dataArray)=>{ + console.debug("====>ActsAccountAuthToken_12700 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(0); + done(); + }).catch((err)=>{ + expect(err.code!=0).assertEqual(true); + done(); + }) + }); + + it('ActsAccountAuthToken_12800', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_12800 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.getAuthList(" ","authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_12800 getAuthList err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_12800 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(err.code!=0).assertEqual(true); + expect(dataArray).assertEqual(null); + done(); + }); + }); + + it('ActsAccountAuthToken_12900', 0, async function (done) { + var limitName = ''; + for(var i = 0; i < LENGTHLIMIT + 1; i++){ + limitName += 't'; + } + console.debug("====>ActsAccountAuthToken_12900 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.getAuthList(limitName,"authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_12900 getAuthList err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_12900 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(err.code!=0).assertEqual(true); + expect(dataArray).assertEqual(null); + done(); + }); + }); + + it('ActsAccountAuthToken_13000', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_13000 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.getAuthList("no_add_account","authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_13000 getAuthList err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_13000 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(err.code!=0).assertEqual(true); + expect(dataArray).assertEqual(null); + done(); + }); + }); + + it('ActsAccountAuthToken_13100', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_13100 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_tokenTest_name",(err,)=>{ + console.debug("====>ActsAccountAuthToken_13100 createAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthToken("account_tokenTest_name","authType","test_token",(err)=>{ + console.debug("====>ActsAccountAuthToken_13100 setAuthToken err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAuthToken("account_tokenTest_name",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountAuthToken_13100 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_13100 getAuthToken stateBack:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual("test_token"); + appAccountManager.checkAuthTokenVisibility("account_tokenTest_name","authType","test_bundleName",(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_13100 checkAuthTokenVisibility err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_13100 checkAuthTokenVisibility stateBack:" + stateBack); + expect(err).assertEqual(null); + expect(stateBack).assertEqual(false); + appAccountManager.getAuthList("account_tokenTest_name","authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_13100 getAuthList err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_13100 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(err).assertEqual(null); + expect(dataArray.length).assertEqual(0); + appAccountManager.setAuthTokenVisibility("account_tokenTest_name","authType","test_bundleName",true,(err)=>{ + console.debug("====>ActsAccountAuthToken_13100 setAuthTokenVisibility err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAuthTokenVisibility("account_tokenTest_name","authType","test_bundleName",(err,stateBack)=>{ + console.debug("====>ActsAccountAuthToken_13100 checkAuthTokenVisibility err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_13100 checkAuthTokenVisibility stateBack:" + stateBack); + expect(err).assertEqual(null); + expect(stateBack).assertEqual(true); + appAccountManager.getAuthList("account_tokenTest_name","authType",(err,dataArray)=>{ + console.debug("====>ActsAccountAuthToken_13100 getAuthList err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_13100 getAuthList dataArray:" + JSON.stringify(dataArray)); + expect(err).assertEqual(null); + expect(dataArray.length).assertEqual(1); + expect(dataArray[0]).assertEqual("test_bundleName"); + appAccountManager.removeAccount("account_tokenTest_name",(err)=>{ + console.debug("====>ActsAccountAuthToken_13100 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAuthToken_13100 end===="); + done(); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + + it('ActsAccountAuthToken_13200', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_13200 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.queryAuthenticatorInfo("com.example.actsaccountOauthtoken",(err,dataInfo)=>{ + console.debug("====>ActsAccountAuthToken_13200 queryAuthenticatorInfo err:" + JSON.stringify(err)); + console.debug("====>ActsAccountAuthToken_13200 queryAuthenticatorInfo dataInfo:" + JSON.stringify(dataInfo)); + expect(err).assertEqual(null); + expect(isNaN(dataInfo.iconId)).assertFalse(); + expect(isNaN(dataInfo.labelId)).assertFalse(); + done(); + }); + }); + + it('ActsAccountAuthToken_13300', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_13300 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.auth("authenticate_test_account","com.example.actsaccountOauthtoken","authType",{},{ + onResult: (resultCode, resultData)=>{ + console.debug("====>ActsAccountAuthToken_13300 authenticate resultCode:" + JSON.stringify(resultCode)); + console.debug("====>ActsAccountAuthToken_13300 authenticate resultData:" + JSON.stringify(resultData)); + expect(resultCode.code).assertEqual(0); + expect(resultData.name).assertEqual("authenticate_test_account"); + expect(resultData.authType).assertEqual("authType"); + expect(resultData.token).assertEqual("serviceApp/authenticate/Token"); + done(); + }, + onRequestRedirected: null + }); + done(); + }); + + it('ActsAccountAuthToken_13400', 0, async function (done) { + console.debug("====>ActsAccountAuthToken_13400 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccountImplicitly("com.example.actsaccountOauthtoken",{},{ + onResult: (resultCode, resultData) =>{ + console.debug("====>ActsAccountAuthToken_13400 authenticate resultCode:" + JSON.stringify(resultCode)); + console.debug("====>ActsAccountAuthToken_13400 authenticate resultData:" + JSON.stringify(resultData)); + expect(resultCode.code).assertEqual(0); + expect(resultData.name).assertEqual("authenticate_test_account"); + expect(resultData.authType).assertEqual("authType"); + expect(resultData.token).assertEqual("serviceApp/authenticate/Token"); + done(); + }, + onRequestRedirected: (request) =>{ + console.debug("====>ActsAccountAuthToken_13400 onRequestRedirected request:" + JSON.stringify(request)); + let abilityStartSetting = { + want:request + } + featureAbility.startAbility(abilityStartSetting, (err, result)=>{ + console.debug("====>ActsAccountAuthToken_13400 onRequestRedirected err:" + JSON.stringify(err)); + }); + done(); + } + }); + done(); + }); + }) +} diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/Authenticator.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/Authenticator.test.js new file mode 100644 index 000000000..cc2ea3893 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/Authenticator.test.js @@ -0,0 +1,725 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import account from '@ohos.account.appAccount' +import featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +const NAMELIMIT = 512; +const LENGTHLIMIT = 1024; +const name = 'zhangsan' +const owner = 'com.example.accountauthenticator' +const createAccountOptions = {customData:{age:'12'}} +export default function ActsAccountAppAccess() { + describe('ActsAccountAuthenticator', function () { + + function sleep(delay) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) + } + beforeAll(async function (done) { + done(); + }); + /* + * @tc.number : ActsAccountCheckAccountLabels_0100 + * @tc.name : Check Account Labels callback form + * @tc.desc : + */ + it('ActsAccountCheckAccountLabels_0100', 0, async function (done) { + console.debug("====>ActsAccountCheckAccountLabels_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>start finish===="); + appAccountManager.createAccount(name, createAccountOptions, (err)=>{ + console.debug("====>ActsAccountCheckAccountLabels_0100 add_account_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAccountLabels(name, owner, ['level4'], (err, data)=>{ + console.debug("====>ActsAccountCheckAccountLabels_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCheckAccountLabels_0100 data:" + JSON.stringify(data)); + appAccountManager.removeAccount(name, (err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0100 removeAccount_err:" + JSON.stringify(err)) + expect(err).assertEqual(null); + console.debug("====>ActsAccountCheckAccountLabels_0100 end===="); + done(); + }) + }); + }); + }); + + + /* + * @tc.number : ActsAccountCheckAccountLabels_0200 + * @tc.name : Check Account Labels callback form + * @tc.desc : + */ + + it('ActsAccountCheckAccountLabels_0200', 0, async function (done) { + console.debug("====>ActsAccountCheckAccountLabels_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>start finish===="); + appAccountManager.createAccount(name, (err)=>{ + console.debug("====>ActsAccountCheckAccountLabels_0200 add_account_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAccountLabels(name, owner, ['20-30'], (err, data)=>{ + console.debug("====>ActsAccountCheckAccountLabels_0200 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCheckAccountLabels_0200 data:" + JSON.stringify(data)); + appAccountManager.removeAccount(name, (err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0200 removeAccount_err:" + JSON.stringify(err)) + expect(err).assertEqual(null); + console.debug("====>ActsAccountCheckAccountLabels_0200 end===="); + done(); + }) + }); + }); + }); + + /* + * @tc.number : ActsAccountCheckAccountLabels_0300 + * @tc.name : Check Account Labels callback form + * @tc.desc : + */ + + it('ActsAccountCheckAccountLabels_0300', 0, async function (done) { + console.debug("====>ActsAccountCheckAccountLabels_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>start finish===="); + appAccountManager.createAccount('CheckAccountLabels_0300', (err)=>{ + console.debug("====>ActsAccountCheckAccountLabels_0300 add_account_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAccountLabels('CheckAccountLabels_0300', owner, ['male'], (err, data)=>{ + console.debug("====>ActsAccountCheckAccountLabels_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCheckAccountLabels_0300 data:" + JSON.stringify(data)); + expect(data).assertEqual(false) + appAccountManager.removeAccount("CheckAccountLabels_0300", (err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0300 removeAccount_err:" + JSON.stringify(err)) + expect(err).assertEqual(null); + console.debug("====>ActsAccountCheckAccountLabels_0300 end===="); + done(); + }) + + }); + }); + + }); + + /* + * @tc.number : ActsAccountCheckAccountLabels_0400 + * @tc.name : Check Account Labels promise form + * @tc.desc : + */ + + it('ActsAccountCheckAccountLabels_0400', 0, async function (done) { + console.debug("====>ActsAccountCheckAccountLabels_0400 start===="); + var appAccountManager = account.createAppAccountManager(); + await appAccountManager.createAccount(name, createAccountOptions).then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0400 add_account_success"); + appAccountManager.checkAccountLabels(name, owner, ['level4']).then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0400 data:" + JSON.stringify(data)); + appAccountManager.removeAccount(name).then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0400 delete_account_success"); + done(); + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0400 delete_account_err"); + }); + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0400 err:" + JSON.stringify(err)) + expect().assertFail(); + done(); + }) + }).catch((err) => { + console.debug("====>ActsAccountCheckAccountLabels_0400 add_account_err:" + JSON.stringify(err)) + expect().assertFail(); + done(); + }) + }); + + /* + * @tc.number : ActsAccountCheckAccountLabels_0500 + * @tc.name : Check Account Labels promise form + * @tc.desc : + */ + + it('ActsAccountCheckAccountLabels_0500', 0, async function (done) { + console.debug("====>ActsAccountCheckAccountLabels_0500 start===="); + var appAccountManager = account.createAppAccountManager(); + await appAccountManager.createAccount(name, createAccountOptions).then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0500 add_account_success"); + appAccountManager.checkAccountLabels(name, owner, ['20-30']).then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0500 data:" + JSON.stringify(data)); + expect(account.Constants.KEY_REQUIRED_LABELS).assertEqual('requiredLabels') + expect(account.Constants.KEY_BOOLEAN_RESULT).assertEqual('booleanResult') + appAccountManager.removeAccount(name).then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0500 delete_account_success"); + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0500 delete_account_err"); + }); + done() + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0500 err:" + JSON.stringify(err)) + expect(typeof(err) != undefined).assertTrue(); + done(); + }) + }).catch((err) => { + console.debug("====>ActsAccountCheckAccountLabels_0500 add_account_err:" + JSON.stringify(err)) + expect().assertFail(); + done(); + }) + }); + + /* + * @tc.number : ActsAccountCheckAccountLabels_0600 + * @tc.name : Check Account Labels promise form + * @tc.desc : + */ + + it('ActsAccountCheckAccountLabels_0600', 0, async function (done) { + console.debug("====>ActsAccountCheckAccountLabels_0600 start===="); + var appAccountManager = account.createAppAccountManager(); + await appAccountManager.createAccount('CheckAccountLabels_0600', createAccountOptions).then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0600 add_account_success:" + JSON.stringify(data)); + appAccountManager.checkAccountLabels('CheckAccountLabels_0600', owner, ['male']).then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0600 data:" + JSON.stringify(data)); + appAccountManager.removeAccount('CheckAccountLabels_0600').then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0600 delete_account_success"); + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0600 delete_account_err"); + }); + done() + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0600 err:" + JSON.stringify(err)) + expect().assertFail(); + done(); + }) + }).catch((err) => { + console.debug("====>ActsAccountCheckAccountLabels_0600 add_account_err:" + JSON.stringify(err)) + expect().assertFail(); + done(); + }) + }); + + /* + * @tc.number : ActsAccountCheckAppAccess_0100 + * @tc.name : Check App Access callback form + * @tc.desc : + */ + + it('ActsAccountCheckAppAccess_0100', 0, async function (done) { + console.debug("====>ActsAccountCheckAppAccess_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount(name, (err)=>{ + console.debug("====>ActsAccountCheckAppAccess_0100 add_account_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAppAccess(name, owner, (err, data)=>{ + console.debug("====>ActsAccountCheckAppAccess_0100 first_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCheckAppAccess_0100 first_data:" + JSON.stringify(data)); + expect(data).assertEqual(false) + appAccountManager.setAppAccess(name, owner, true, (err, data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0100 enableAppAccess_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAppAccess(name, owner, (err, data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0100 second_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + expect(data).assertEqual(true) + appAccountManager.setAppAccess(name, owner, false, (err, data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0100 disableAppAccount_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkAppAccess(name, owner,(err, data)=>{ + console.debug("====>ActsAccountCheckAppAccess_0100 third_err:" + JSON.stringify(err)) + expect(err).assertEqual(null) + expect(data).assertEqual(false) + try { + appAccountManager.removeAccount(name) + console.debug('====>ActsAccountCheckAppAccess_0100 removeAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountCheckAppAccess_0100 removeAccount_err') + expect().assertFail() + } + }) + + }) + }) + }) + }); + }); + }); + + + /* + * @tc.number : ActsAccountCheckAppAccess_0200 + * @tc.name : Check App Access promise form + * @tc.desc : + */ + + it('ActsAccountCheckAppAccess_0200', 0, async function (done) { + console.debug("====>ActsAccountCheckAppAccess_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount(name, createAccountOptions).then((data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 add_account_success:"); + appAccountManager.checkAppAccess(name, owner).then((data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 first_data:" + JSON.stringify(data)); + expect(data).assertEqual(false); + appAccountManager.setAppAccess(name, owner, true).then((data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 enableAppAccess_success"); + appAccountManager.checkAppAccess(name, owner).then((data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 second_data:" + JSON.stringify(data)); + expect(data).assertEqual(true); + appAccountManager.setAppAccess(name, owner, false).then((data)=>{ + console.debug("====>ActsAccountCheckAppAccess_0200 disabAppAccess_data:" + JSON.stringify(data)); + appAccountManager.checkAppAccess(name, owner).then((data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 third_data:" + JSON.stringify(data)); + expect(data).assertEqual(false); + try{ + appAccountManager.removeAccount(name) + console.debug('====>ActsAccountCheckAppAccess_0200 removeAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountCheckAppAccess_0100 removeAccount_err') + expect().assertFail() + } + }).catch((err)=>{ + console.debug("====>ActsAccountCheckAppAccess_0200 third_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 disableAppAccess_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 second_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err)=>{ + console.debug("====>ActsAccountCheckAppAccess_0200 enableAppAccess_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 first_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err) => { + console.debug("====>ActsAccountCheckAppAccess_0200 createAccount_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + + }); + + + /* + * @tc.number : ActsAccountDeleteAccountCredential_0100 + * @tc.name : Delete Account Credential callback form + * @tc.desc : + */ + + it('ActsAccountDeleteAccountCredential_0100', 0, async function (done) { + console.debug("====>ActsAccountDeleteAccountCredential_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>start finish===="); + appAccountManager.createAccount(name, (err)=>{ + console.debug("====>ActsAccountDeleteAccountCredential_0100 add_account_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setCredential(name, "PIN", "credential1", (err)=>{ + console.debug("====>ActsAccountDeleteAccountCredential_0100 setAccountCredential_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getCredential(name, "PIN", (err, data) =>{ + console.debug("====>ActsAccountDeleteAccountCredential_0100 getAccountCredential_err:" + JSON.stringify(err)) + expect(err).assertEqual(null); + console.debug("====>ActsAccountDeleteAccountCredential_0100 getAccountCredential_success:" + JSON.stringify(data)); + appAccountManager.deleteAccountCredential(name, "PIN", (err, data)=>{ + console.debug("====>ActsAccountDeleteAccountCredential_0100 deleteAccountCredential_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + expect(data).assertEqual(undefined); + console.debug("====>ActsAccountDeleteAccountCredential_0100 deleteAccountCredential_data:" + JSON.stringify(data)); + try{ + appAccountManager.removeAccount(name) + console.debug('====>ActsAccountDeleteAccountCredential_0100 removeAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountDeleteAccountCredential_0100 removeAccount_err') + expect().assertFail() + done(); + } + }) + }) + }); + }); + }); + + /* + * @tc.number : ActsAccountDeleteAccountCredential_0200 + * @tc.name : Delete Account Credential promise form + * @tc.desc : + */ + + it('ActsAccountDeleteAccountCredential_0200', 0, async function (done) { + console.debug("====>ActsAccountDeleteAccountCredential_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount(name, createAccountOptions).then((data) =>{ + console.debug("====>ActsAccountDeleteAccountCredential_0200 add_account_success"); + appAccountManager.setCredential(name, "PIN", "credential2").then(() =>{ + console.debug("====>ActsAccountDeleteAccountCredential_0200 setAccountCredential_success"); + appAccountManager.getCredential(name, "PIN").then((data) =>{ + console.debug("====>ActsAccountDeleteAccountCredential_0200 getAccountCredential_data:" + JSON.stringify(data)); + appAccountManager.deleteAccountCredential(name, "PIN").then((data) =>{ + console.debug("====>ActsAccountDeleteAccountCredential_0200 data:" + JSON.stringify(data)); + try{ + appAccountManager.removeAccount(name) + console.debug('====>ActsAccountDeleteAccountCredential_0200 removeAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountDeleteAccountCredential_0200 removeAccount_err') + expect().assertFail() + } + }).catch((err) =>{ + console.debug("====>ActsAccountDeleteAccountCredential_0200 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err)=>{ + console.debug("====>ActsAccountDeleteAccountCredential_0200 getAccountCredential_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err) =>{ + console.debug("====>ActsAccountDeleteAccountCredential_0200 setAccountCredential_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err) => { + console.debug("====>ActsAccountDeleteAccountCredential_0200 createAccount_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }); + + /* + * @tc.number : ActsAccountVerifyCredential_0100 + * @tc.name : Verify Credential callback form, options + * @tc.desc : + */ + + it('ActsAccountVerifyCredential_0100', 0, async function (done) { + console.debug("====>ActsAccountVerifyCredential_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + var options = {credentialType: "PIN", credential: "123456"} + console.debug("====>start finish===="); + appAccountManager.createAccount(name, (err)=>{ + console.debug("====>ActsAccountVerifyCredential_0100 add_account_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.verifyCredential(name, owner, options, { + onResult: async (resultCode, resultData)=>{ + console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_resultcode:" + JSON.stringify(resultCode)); + expect(resultCode).assertEqual(0) + console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_resultData:" + JSON.stringify(resultData)); + expect(resultData.booleanResult).assertEqual(true) + try{ + await appAccountManager.removeAccount(name) + console.debug('====>ActsAccountVerifyCredential_0100 removeAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountVerifyCredential_0100 removeAccount_err') + expect().assertFail() + } + done(); + }, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_onRequestContinued") + } + }); + }); + }); + + /* + * @tc.number : ActsAccountVerifyCredential_0200 + * @tc.name : Verify Credential callback form + * @tc.desc : + */ + + it('ActsAccountVerifyCredential_0200', 0, async function (done) { + console.debug("====>ActsAccountVerifyCredential_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>start finish===="); + appAccountManager.createAccount(name, (err)=>{ + console.debug("====>ActsAccountVerifyCredential_0200 add_account_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.verifyCredential(name, owner, { + onResult: async (resultCode, resultData)=>{ + console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_resultcode:" + JSON.stringify(resultCode)); + expect(resultCode).assertEqual(0) + console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_resultData:" + JSON.stringify(resultData)); + expect(resultData.booleanResult).assertEqual(false) + try{ + await appAccountManager.removeAccount(name) + console.debug('====>ActsAccountVerifyCredential_0200 removeAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountVerifyCredential_0200 removeAccount_err') + expect().assertFail() + } + done(); + }, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_onRequestContinued") + } + }); + }); + }); + + /* + * @tc.number : ActsAccountSetAuthenticatorProperties_0100 + * @tc.name : Verify Credential callback form, options + * @tc.desc : + */ + + it('ActsAccountSetAuthenticatorProperties_0100', 0, async function (done) { + console.debug("====>ActsAccountSetAuthenticatorProperties_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + var options = {credentialType: "PIN", credential: "123456"} + console.debug("====>start finish===="); + appAccountManager.createAccount(name, (err)=>{ + console.debug("====>ActsAccountSetAuthenticatorProperties_0100 add_account_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthenticatorProperties(owner, options, { + onResult: async (resultCode, resultData)=>{ + console.debug("====>ActsAccountSetAuthenticatorProperties_0100 setAuthenticatorProperties_resultcode:" + JSON.stringify(resultCode)); + expect(resultCode).assertEqual(10016) + console.debug("====>ActsAccountSetAuthenticatorProperties_0100 setAuthenticatorProperties_resultData:" + JSON.stringify(resultData)); + try{ + await appAccountManager.removeAccount(name) + console.debug('====>ActsAccountSetAuthenticatorProperties_0100 removeAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountSetAuthenticatorProperties_0100 removeAccount_err') + expect().assertFail() + } + done(); + }, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountSetAuthenticatorProperties_0100 verifyCredential_onRequestContinued") + } + }); + }); + }); + + /* + * @tc.number : ActsAccountSetAuthenticatorProperties_0200 + * @tc.name : Verify Credential callback form + * @tc.desc : + */ + + it('ActsAccountSetAuthenticatorProperties_0200', 0, async function (done) { + console.debug("====>ActsAccountSetAuthenticatorProperties_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>start finish===="); + appAccountManager.createAccount(name, (err)=>{ + console.debug("====>ActsAccountSetAuthenticatorProperties_0200 add_account_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAuthenticatorProperties(owner, { + onResult: async (resultCode, resultData)=>{ + console.debug("====>ActsAccountSetAuthenticatorProperties_0200 setAuthenticatorProperties_resultcode:" + JSON.stringify(resultCode)); + expect(resultCode).assertEqual(10016) + console.debug("====>ActsAccountSetAuthenticatorProperties_0200 setAuthenticatorProperties_resultData:" + JSON.stringify(resultData)); + try{ + await appAccountManager.removeAccount(name) + console.debug('====>ActsAccountSetAuthenticatorProperties_0200 removeAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountSetAuthenticatorProperties_0200 removeAccount_err') + expect().assertFail() + } + done(); + }, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountSetAuthenticatorProperties_0200 verifyCredential_onRequestContinued") + } + }); + }); + }); + + /* + * @tc.number : ActsAccountSelectAccountByOptions_0100 + * @tc.name : Verify Credential callback form + * @tc.desc : + */ + + it('ActsAccountSelectAccountByOptions_0100', 0, async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.accountauthenticator", + abilityName: "com.example.accountauthenticator.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + ) + await sleep(1000) + console.debug("====>ActsAccountSelectAccountByOptions_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + var select_options = {allowedAccounts:[{"name":name,"owner":owner}]} + console.debug("====>start finish===="); + appAccountManager.createAccount(name, async (err)=>{ + console.debug("====>ActsAccountSelectAccountByOptions_0100 add_account_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + try { + var data = await appAccountManager.selectAccountsByOptions(select_options) + console.debug("====>ActsAccountSelectAccountByOptions_0100 data:" + JSON.stringify(data)); + expect(data.length).assertEqual(1) + } catch(err) { + console.debug("====>ActsAccountSelectAccountByOptions_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null) + } + try{ + await appAccountManager.removeAccount(name) + console.debug('====>ActsAccountSelectAccountByOptions_0100 removeAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountSelectAccountByOptions_0100 removeAccount_err') + expect().assertFail() + done(); + } + }); + }); + + /* + * @tc.number : ActsAccountSelectAccountByOptions_0100 + * @tc.name : Verify Credential callback form + * @tc.desc : + */ + + it('ActsAccountSelectAccountByOptions_0200', 0, async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.accountauthenticator", + abilityName: "com.example.accountauthenticator.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + ) + await sleep(1000) + console.debug("====>ActsAccountSelectAccountByOptions_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + var select_options = {allowedOwners: [owner]} + console.debug("====>start finish===="); + appAccountManager.createAccount(name, async (err)=>{ + console.debug("====>ActsAccountSelectAccountByOptions_0200 add_account_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + try { + var data = await appAccountManager.selectAccountsByOptions(select_options) + console.debug("====>ActsAccountSelectAccountByOptions_0200 data:" + JSON.stringify(data)); + expect(data.length).assertEqual(3) + } catch(err) { + console.debug("====>ActsAccountSelectAccountByOptions_0200 err:" + JSON.stringify(err)); + expect(err).assertEqual(null) + } + try{ + await appAccountManager.removeAccount(name) + console.debug('====>ActsAccountSelectAccountByOptions_0200 removeAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountSelectAccountByOptions_0200 removeAccount_err') + expect().assertFail() + done(); + } + }); + }); + + + /* + * @tc.number : ActsAccountSelectAccountByOptions_0100 + * @tc.name : Verify Credential callback form + * @tc.desc : + */ + + it('ActsAccountSelectAccountByOptions_0300', 0, async function (done) { + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.accountauthenticator", + abilityName: "com.example.accountauthenticator.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + ) + await sleep(1500) + console.debug("====>ActsAccountSelectAccountByOptions_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + var options = {requiredLabels: ["male", "30-40"]} + console.debug("====>start finish===="); + appAccountManager.createAccount(name, async (err)=>{ + console.debug("====>ActsAccountSelectAccountByOptions_0300 add_account_err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + try { + var data = await appAccountManager.selectAccountsByOptions(options) + console.debug("====>ActsAccountSelectAccountByOptions_0300 data:" + JSON.stringify(data)); + expect(data.length).assertEqual(1) + } catch(err) { + console.debug("====>ActsAccountSelectAccountByOptions_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null) + } + try{ + await appAccountManager.removeAccount(name) + console.debug('====>ActsAccountSelectAccountByOptions_0300 removeAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountSelectAccountByOptions_0300 removeAccount_err') + expect().assertFail() + done(); + } + }); + }); + + }) +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/ChangeOnOff.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/ChangeOnOff.js new file mode 100644 index 000000000..860b0b8ed --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/ChangeOnOff.js @@ -0,0 +1,450 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import account from '@ohos.account.appAccount' +import commonevent from '@ohos.commonEvent' +import featureAbility from '@ohos.ability.featureAbility' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +const TIMEOUT = 5000; +export default function ActsAccountOnOff() { + describe('ActsAccountOnOff', async function () { + + function sleep(delay) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) + } + beforeAll(async function (done) { + done(); + }); + + async function testInit(){ + console.debug("====>startAbility start===="); + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.actsaccountsceneonoff", + abilityName: "com.example.actsaccountsceneonoff.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + ); + await sleep(TIMEOUT); + } + + /* + * @tc.number : ActsAccountOnOff_0300 + * @tc.name : Subscribe/unsubscribe to the change event of application + * @tc.desc : Received the account information change to the authorized account of the subscription to change + * the credential + */ + it('ActsAccountOnOff_0300', 0, async function (done) { + testInit(); + console.debug("====>ActsAccountOnOff_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat appAccountManager finish"); + console.debug("====>add account ActsAccountOnOff_0300 start"); + await appAccountManager.createAccount("onoff_setcredential"); + console.debug("====>enableAppAccess ActsAccountOnOff_0300 start"); + await appAccountManager.setAppAccess("onoff_setcredential", "com.example.actsaccountsceneonoff", true); + function unSubscriberCallback(err){ + console.debug("====>unsubscribe 0300 err:" + JSON.stringify(err)); + } + function removeAccountCallback(err){ + console.debug("====>delete account 0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + done(); + } + function subscriberCallback(err, data){ + console.debug("====>subscriberCallback 0300 data:" + JSON.stringify(data)); + expect(data.event).assertEqual("account_on_change_setcredential"); + expect(data.data).assertEqual("SUCCESS"); + commonevent.unsubscribe(subscriber, unSubscriberCallback); + appAccountManager.removeAccount("onoff_setcredential", removeAccountCallback); + } + function publishCallback(err){ + console.debug("====>publish call back err:" + JSON.stringify(err)); + setTimeout(async function (){ + console.debug("====>setCredential start===="); + try{ + await appAccountManager.setCredential("onoff_setcredential", "credentialType", "credential"); + } + catch(err){ + console.error("====>setCredential fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>setCredential finish===="); + }, 500) + } + var commonEventSubscribeInfo = { + events: ["account_on_change_setcredential"] + } + var subscriber + commonevent.createSubscriber(commonEventSubscribeInfo).then(function (data){ + subscriber = data; + commonevent.subscribe(subscriber, subscriberCallback); + console.debug("====>subscribe ActsAccountOnOff_0300 finish====") + }); + + var commonEventPublishData = { + code: 9 + } + setTimeout(function (){ + console.debug("====>publish event account_on_change 0300===="); + commonevent.publish("account_on_change", commonEventPublishData, publishCallback); + }, 1000); + }); + + /* + * @tc.number : ActsAccountOnOff_0400 + * @tc.name : Subscribe/unsubscribe to the change event of application + * @tc.desc : Received the account information change to the authorized account of the subscription to delete + * authorized account + */ + it('ActsAccountOnOff_0400', 0, async function (done) { + testInit(); + console.debug("====>ActsAccountOnOff_0400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat appAccountManager finish"); + console.debug("====>add first account ActsAccountOnOff_0400 start"); + await appAccountManager.createAccount("onoff_removeFir"); + console.debug("====>add second account ActsAccountOnOff_0400 start"); + await appAccountManager.createAccount("onoff_removeSec"); + console.debug("====>enableAppAccess first ActsAccountOnOff_0400 start"); + await appAccountManager.setAppAccess("onoff_removeFir", "com.example.actsaccountsceneonoff", true); + console.debug("====>enableAppAccess second ActsAccountOnOff_0400 start"); + await appAccountManager.setAppAccess("onoff_removeSec", "com.example.actsaccountsceneonoff", true); + function unSubscriberCallback(err){ + console.debug("====>unsubscribe 0400 err:" + JSON.stringify(err)); + } + function removeAccountCallback(err){ + console.debug("====>remove account 0400 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + done(); + } + function subscriberCallback(err, data){ + console.debug("====>subscriberCallback 0400 data:" + JSON.stringify(data)); + expect(data.event).assertEqual("account_on_remove_another"); + expect(data.data).assertEqual("SUCCESS"); + commonevent.unsubscribe(subscriber, unSubscriberCallback); + appAccountManager.removeAccount("onoff_removeFir", removeAccountCallback); + } + function publishCallback(err){ + console.debug("====>publish call back err:" + JSON.stringify(err)); + setTimeout(async function (){ + console.debug("====>removeAccount start===="); + try{ + await appAccountManager.removeAccount("onoff_removeSec"); + } + catch(err){ + console.error("====>removeAccount fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>removeAccount finish===="); + }, 500) + } + var commonEventSubscribeInfo = { + events: ["account_on_remove_another"] + } + var subscriber + commonevent.createSubscriber(commonEventSubscribeInfo).then(function (data){ + subscriber = data; + commonevent.subscribe(subscriber, subscriberCallback); + console.debug("====>subscribe ActsAccountOnOff_0400 finish====") + }); + + var commonEventPublishData = { + code: 10 + } + setTimeout(function (){ + console.debug("====>publish event account_on_change 0400===="); + commonevent.publish("account_on_change", commonEventPublishData, publishCallback); + }, 1000); + }); + + /* + * @tc.number : ActsAccountOnOff_0500 + * @tc.name : Subscribe/unsubscribe to the change event of application + * @tc.desc : Received the account information change to the authorized account of the subscription to delete + * the only authorized account + */ + it('ActsAccountOnOff_0500', 0, async function (done) { + testInit(); + console.debug("====>ActsAccountOnOff_0500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat appAccountManager finish"); + console.debug("====>add account ActsAccountOnOff_0500 start"); + await appAccountManager.createAccount("onoff_remove"); + console.debug("====>enableAppAccess ActsAccountOnOff_0500 start"); + await appAccountManager.setAppAccess("onoff_remove", "com.example.actsaccountsceneonoff", true); + function unSubscriberCallback(err){ + console.debug("====>unsubscribe 0500 err:" + JSON.stringify(err)); + } + function subscriberCallback(err, data){ + console.debug("====>subscriberCallback 0500 data:" + JSON.stringify(data)); + expect(data.event).assertEqual("account_on_change_remove"); + expect(data.data).assertEqual("SUCCESS"); + commonevent.unsubscribe(subscriber, unSubscriberCallback); + done(); + } + function publishCallback(err){ + console.debug("====>publish call back err:" + JSON.stringify(err)); + setTimeout(async function (){ + console.debug("====>removeAccount start===="); + try{ + await appAccountManager.removeAccount("onoff_remove"); + } + catch(err){ + console.error("====>removeAccount fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>removeAccount finish===="); + }, 500) + } + var commonEventSubscribeInfo = { + events: ["account_on_change_remove"] + } + var subscriber + commonevent.createSubscriber(commonEventSubscribeInfo).then(function (data){ + subscriber = data; + commonevent.subscribe(subscriber, subscriberCallback); + console.debug("====>subscribe ActsAccountOnOff_0500 finish====") + }); + + var commonEventPublishData = { + code: 11 + } + setTimeout(function (){ + console.debug("====>publish event account_on_change 0500===="); + commonevent.publish("account_on_change", commonEventPublishData, publishCallback); + }, 1000); + }); + + /* + * @tc.number : ActsAccountOnOff_0600 + * @tc.name : Subscribe/unsubscribe to the change event of application + * @tc.desc : Received the account information change to the authorized account of the subscription to cancel + * authorized account + */ + it('ActsAccountOnOff_0600', 0, async function (done) { + testInit(); + console.debug("====>ActsAccountOnOff_0600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat appAccountManager finish"); + console.debug("====>add first account ActsAccountOnOff_0600 start"); + await appAccountManager.createAccount("onoff_disableFir"); + console.debug("====>add second account ActsAccountOnOff_0600 start"); + await appAccountManager.createAccount("onoff_disableSec"); + console.debug("====>enableAppAccess first ActsAccountOnOff_0600 start"); + await appAccountManager.setAppAccess("onoff_disableFir", "com.example.actsaccountsceneonoff", true); + console.debug("====>enableAppAccess second ActsAccountOnOff_0600 start"); + await appAccountManager.setAppAccess("onoff_disableSec", "com.example.actsaccountsceneonoff", true); + function unSubscriberCallback(err){ + console.debug("====>unsubscribe 0600 err:" + JSON.stringify(err)); + } + function removeAccountCallback(err){ + console.debug("====>remove first account 0600 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("onoff_disableSec", (err)=>{ + console.debug("====>remove second account 0600 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + done(); + }); + } + function subscriberCallback(err, data){ + console.debug("====>subscriberCallback 0600 data:" + JSON.stringify(data)); + expect(data.event).assertEqual("account_on_set_another_disable"); + expect(data.data).assertEqual("SUCCESS"); + commonevent.unsubscribe(subscriber, unSubscriberCallback); + appAccountManager.removeAccount("onoff_disableFir", removeAccountCallback); + } + function publishCallback(err){ + console.debug("====>publish call back err:" + JSON.stringify(err)); + setTimeout(async function (){ + console.debug("====>disableAppAccess start===="); + try{ + await appAccountManager.setAppAccess("onoff_disableSec", "com.example.actsaccountsceneonoff", false); + } + catch(err){ + console.error("====>disableAppAccess fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>disableAppAccess finish===="); + }, 500) + } + var commonEventSubscribeInfo = { + events: ["account_on_set_another_disable"] + } + var subscriber + commonevent.createSubscriber(commonEventSubscribeInfo).then(function (data){ + subscriber = data; + commonevent.subscribe(subscriber, subscriberCallback); + console.debug("====>subscribe ActsAccountOnOff_0600 finish====") + }); + + var commonEventPublishData = { + code: 12 + } + setTimeout(function (){ + console.debug("====>publish event account_on_change 0600===="); + commonevent.publish("account_on_change", commonEventPublishData, publishCallback); + }, 1000); + }); + + /* + * @tc.number : ActsAccountOnOff_0700 + * @tc.name : Subscribe/unsubscribe to the change event of application + * @tc.desc : Received the account information change to the authorized account of the subscription to cancel + * the only authorized account + */ + it('ActsAccountOnOff_0700', 0, async function (done) { + testInit(); + console.debug("====>ActsAccountOnOff_0700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat appAccountManager finish"); + console.debug("====>add account ActsAccountOnOff_0700 start"); + await appAccountManager.createAccount("onoff_disable"); + console.debug("====>enableAppAccess ActsAccountOnOff_0700 start"); + await appAccountManager.setAppAccess("onoff_disable", "com.example.actsaccountsceneonoff", true); + function unSubscriberCallback(err){ + console.debug("====>unsubscribe 0700 err:" + JSON.stringify(err)); + } + function removeAccountCallback(err){ + console.debug("====>delete account 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + done(); + } + function subscriberCallback(err, data){ + console.debug("====>subscriberCallback 0700 data:" + JSON.stringify(data)); + expect(data.event).assertEqual("account_on_set_disable"); + expect(data.data).assertEqual("SUCCESS"); + commonevent.unsubscribe(subscriber, unSubscriberCallback); + appAccountManager.removeAccount("onoff_disable", removeAccountCallback); + } + function publishCallback(err){ + console.debug("====>publish call back err:" + JSON.stringify(err)); + setTimeout(async function (){ + console.debug("====>disableAppAccess start===="); + try{ + await appAccountManager.setAccess("onoff_disable", "com.example.actsaccountsceneonoff", false); + } + catch(err){ + console.error("====>disableAppAccess fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>disableAppAccess finish===="); + }, 500) + } + var commonEventSubscribeInfo = { + events: ["account_on_set_disable"] + } + var subscriber + commonevent.createSubscriber(commonEventSubscribeInfo).then(function (data){ + subscriber = data; + commonevent.subscribe(subscriber, subscriberCallback); + console.debug("====>subscribe ActsAccountOnOff_0700 finish====") + }); + + var commonEventPublishData = { + code: 13 + } + setTimeout(function (){ + console.debug("====>publish event account_on_change 0700===="); + commonevent.publish("account_on_change", commonEventPublishData, publishCallback); + }, 1000); + }); + + + /* + * @tc.number : ActsAccountOnOff_0900 + * @tc.name : Subscribe/unsubscribe to the change event of application + * @tc.desc : Receiving account information after adding two accounts to the app, subscribing to itself, + * and changing one of the associatal data + */ + it('ActsAccountOnOff_0900', 0, async function (done) { + console.debug("====>ActsAccountOnOff_0900 start===="); + let dataMap = new Map(); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat appAccountManager finish"); + console.debug("====>add first account ActsAccountOnOff_0900 start"); + await appAccountManager.createAccount("onoff_self_first"); + console.debug("====>add second account ActsAccountOnOff_0900 start"); + await appAccountManager.createAccount("onoff_self_second"); + console.debug("====>on ActsAccountOnOff_0900 start"); + function changeOnCallback(data){ + console.debug("====>receive change 0900 data:" + JSON.stringify(data)); + console.debug("====>data.length:" + data.length); + for (let i = 0, len = data.length; i < len; i++) { + dataMap.set(data[i].name, data[i].owner) + } + expect(dataMap.has("onoff_self_first")).assertTrue(); + if (dataMap.has("onoff_self_first")) { + let data = dataMap.get("onoff_self_first"); + console.debug("====>the account owner is: " + data); + expect(data).assertEqual("com.example.actsaccountoperatetest"); + } + expect(dataMap.has("onoff_self_second")).assertTrue(); + if (dataMap.has("onoff_self_second")) { + let data = dataMap.get("onoff_self_second"); + console.debug("====>the account owner is: " + data); + expect(data).assertEqual("com.example.actsaccountoperatetest"); + } + appAccountManager.off('accountChange', function (){ + console.debug("====>off ActsAccountOnOff_0900 finish===="); + appAccountManager.removeAccount("onoff_self_first", (err)=>{ + console.debug("====>delete first account 0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("onoff_self_second", (err)=>{ + console.debug("====>delete second account 0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountOnOff_0900 end===="); + done(); + }); + }); + }); + } + try{ + appAccountManager.on('accountChange', ["com.example.actsaccountoperatetest"], changeOnCallback); + } + catch(err){ + console.error("====>on ActsAccountOnOff_0900 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>setCustomData start===="); + try{ + await appAccountManager.setCustomData("onoff_self_second", "change_key", "change_value"); + } + catch(err){ + console.error("====>setCustomData fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + }); + }) +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/CreateAccount.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/CreateAccount.test.js new file mode 100644 index 000000000..4a6d48f99 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/CreateAccount.test.js @@ -0,0 +1,659 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import account from '@ohos.account.appAccount' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +const NAMELIMIT = 512; +const LENGTHLIMIT = 1024; +const ERR_PARAMETER_CHECK_FAILD =401 +const ERR_INVALID_PARAMETER = 12300002 +const ERR_ACCOUNT_EXIST = 12300008 +const createAccountOptions = {customData:{age:'12'}} //k and v length 1024 ,k and v size 1024 +const createAccountOptionsDiff = {customData:{sex:'male'}} +export default function ActsAccountCreateAccount() { + describe('ActsAccountCreateAccount', function () { + + /* + * @tc.number : ActsAccountCreateAccount_0100 + * @tc.name : Add account callback form + * @tc.desc : Add account in callback form without additional information + */ + it('ActsAccountCreateAccount_0100', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_callback_first", (err)=>{ + console.debug("====>add account ActsAccountCreateAccount_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("account_name_callback_first", (err)=>{ + console.debug("====>delete Account ActsAccountCreateAccount_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCreateAccount_0100 end===="); + done(); + }); + }); + }); + + /* + * @tc.number : ActsAccountCreateAccount_0200 + * @tc.name : Add account promise form + * @tc.desc : Add account in promise form without additional information + */ + it('ActsAccountCreateAccount_0200', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account start===="); + try{ + await appAccountManager.createAccount("account_name_promise_first"); + } + catch(err){ + console.error("====>add account fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>delete account start===="); + await appAccountManager.removeAccount("account_name_promise_first"); + console.debug("====>ActsAccountCreateAccount_0200 end===="); + done(); + }); + + /* + * @tc.number : ActsAccountCreateAccount_0300 + * @tc.name : Add account callback form + * @tc.desc : Add account in callback form with additional information + */ + it('ActsAccountCreateAccount_0300', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_callback_second", createAccountOptions, (err)=>{ + console.debug("====>add account ActsAccountCreateAccount_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("account_name_callback_second", (err)=>{ + console.debug("====>delete Account ActsAccountCreateAccount_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCreateAccount_0300 end===="); + done(); + }); + }); + }); + + /* + * @tc.number : ActsAccountCreateAccount_0400 + * @tc.name : Add account promise form + * @tc.desc : Add account in promise form with additional information + */ + it('ActsAccountCreateAccount_0400', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_0400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account start===="); + try{ + await appAccountManager.createAccount("account_name_promise_second", createAccountOptions); + } + catch(err){ + console.error("====>add account fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>delete account start===="); + await appAccountManager.removeAccount("account_name_promise_second"); + console.debug("====>ActsAccountCreateAccount_0400 end===="); + done(); + }); + + + /* + * @tc.number : ActsAccountCreateAccount_0500 + * @tc.name : Add account callback form + * @tc.desc : Repeatedly add the same name account and the same additional information + */ + it('ActsAccountCreateAccount_0500', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_0500 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_name_callback_third", createAccountOptions, (err)=>{ + console.debug("====>add account first time ActsAccountCreateAccount_0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.createAccount("account_name_callback_third", createAccountOptions, (err)=>{ + console.debug("====>add account second time ActsAccountCreateAccount_0500 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_ACCOUNT_EXIST); + appAccountManager.removeAccount("account_name_callback_third", (err)=>{ + console.debug("====>delete Account ActsAccountCreateAccount_0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCreateAccount_0500 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCreateAccount_0600 + * @tc.name : Add account promise form + * @tc.desc : Repeatedly add the same name account and the same additional information + */ + it('ActsAccountCreateAccount_0600', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_0600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>add account for the first time ActsAccountCreateAccount_0600===="); + await appAccountManager.createAccount("account_name_promise_third", createAccountOptions); + console.debug("====>add account for the second time ActsAccountCreateAccount_0600 start===="); + try{ + await appAccountManager.createAccount("account_name_promise_third", createAccountOptions); + } + catch(err){ + console.debug("====>add account for the second time 0600 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_ACCOUNT_EXIST); + await appAccountManager.removeAccount("account_name_promise_third"); + console.debug("====>ActsAccountCreateAccount_0600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCreateAccount_0700 + * @tc.name : Add account callback form + * @tc.desc : The account name exceeds the length limit of 512 characters + */ + it('ActsAccountCreateAccount_0700', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_0700 start===="); + var limitAccountName = ''; + for (var i = 0; i < NAMELIMIT + 1; i++) { + limitAccountName += 't'; + } + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount(limitAccountName, createAccountOptions, (err)=>{ + console.debug("====>add account ActsAccountCreateAccount_0700 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_INVALID_PARAMETER); + console.debug("====>ActsAccountCreateAccount_0700 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsAccountCreateAccount_0800 + * @tc.name : Add account promise form + * @tc.desc : The account name exceeds the length limit of 512 characters + */ + it('ActsAccountCreateAccount_0800', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_0800 start===="); + var limitAccountName = ''; + for (var i = 0; i < NAMELIMIT + 1; i++) { + limitAccountName += 'n'; + } + var appAccountManager = account.createAppAccountManager(); + try{ + await appAccountManager.createAccount(limitAccountName, createAccountOptions); + expect().assertFail(); + done(); + } + catch(err){ + console.debug("====>add account ActsAccountCreateAccount_0800 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_INVALID_PARAMETER); + console.debug("====>ActsAccountCreateAccount_0800 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCreateAccount_0900 + * @tc.name : Add account callback form + * @tc.desc : Additional information exceeds the length limit of 1024 characters + */ + it('ActsAccountCreateAccount_0900', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_0900 start===="); + var limitAccountExtra = ''; + for (var i = 0; i < LENGTHLIMIT + 1; i++) { + limitAccountExtra += 't'; + } + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_name_callback_fifth", {customData:{age:limitAccountExtra}}, (err)=>{ + console.debug("====>add account ActsAccountCreateAccount_0900 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_INVALID_PARAMETER); + console.debug("====>ActsAccountCreateAccount_0900 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsAccountCreateAccount_1000 + * @tc.name : Add account promise form + * @tc.desc : Additional information exceeds the length limit of 1024 characters + */ + it('ActsAccountCreateAccount_1000', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_1000 start===="); + var limitAccountExtra = ''; + for (var i = 0; i < LENGTHLIMIT + 1; i++) { + limitAccountExtra += 'e'; + } + var appAccountManager = account.createAppAccountManager(); + try{ + await appAccountManager.createAccount("account_name_promise_fifth", {customData:{[limitAccountExtra]:'12'}}); + } + catch(err){ + console.debug("====>add account ActsAccountCreateAccount_1000 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_INVALID_PARAMETER); + console.debug("====>ActsAccountCreateAccount_1000 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCreateAccount_1100 + * @tc.name : Add account callback form + * @tc.desc : The account name is an empty string + */ + it('ActsAccountCreateAccount_1100', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_1100 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("", createAccountOptions, (err)=>{ + console.debug("====>add account ActsAccountCreateAccount_1100 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_INVALID_PARAMETER); + console.debug("====>ActsAccountCreateAccount_1100 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsAccountCreateAccount_1200 + * @tc.name : Add account promise form + * @tc.desc : The account name is an empty string + */ + it('ActsAccountCreateAccount_1200', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_1200 start===="); + console.debug("====>ActsAccountCreateAccount_1200 add account start===="); + var appAccountManager = account.createAppAccountManager(); + try{ + await appAccountManager.createAccount("", createAccountOptions); + } + catch(err){ + console.debug("====>add account ActsAccountCreateAccount_1200 err:"+ JSON.stringify(err)); + expect(err.code).assertEqual(ERR_INVALID_PARAMETER); + console.debug("====>ActsAccountCreateAccount_1200 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCreateAccount_1300 + * @tc.name : Add account callback form + * @tc.desc : Additional information is an empty string + */ + it('ActsAccountCreateAccount_1300', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_1300 start===="); + var appAccountManager = account.createAppAccountManager(); + try{ + appAccountManager.createAccount("account_name_callback_seventh", "", (err)=>{ + expect().assertFail(); + done(); + }); + }catch(err){ + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountCreateAccount_1300 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCreateAccount_1400 + * @tc.name : Add account promise form + * @tc.desc : Additional information is an empty string + */ + it('ActsAccountCreateAccount_1400', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_1400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>add account ActsAccountCreateAccount_1400 start===="); + try{ + await appAccountManager.createAccount("account_name_promise_seventh", ""); + } + catch(err){ + console.error("====>add account ActsAccountCreateAccount_1400 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + done(); + } + console.debug("====>delete account ActsAccountCreateAccount_1400 start===="); + await appAccountManager.removeAccount("account_name_promise_seventh"); + done(); + }); + + /* + * @tc.number : ActsAccountCreateAccount_1500 + * @tc.name : Add account callback form + * @tc.desc : The account name is a special character such as a space + */ + it('ActsAccountCreateAccount_1500', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_1500 start===="); + var appAccountManager = account.createAppAccountManager(); + var specialStr = " "; + try{ + appAccountManager.createAccount(specialStr, createAccountOptions, (err)=>{ + expect(err.code == 12300002).assertEqual(true); + console.debug("====>ActsAccountCreateAccount_1500 end===="); + done(); + }); + }catch(err){ + expect().assertFail(); + done(); + } + }); + + /* + * @tc.number : ActsAccountCreateAccount_1600 + * @tc.name : Add account promise form + * @tc.desc : The account name is a special character such as a space + */ + it('ActsAccountCreateAccount_1600', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_1600 start===="); + var appAccountManager = account.createAppAccountManager(); + var specialStr = " "; + try{ + await appAccountManager.createAccount(specialStr, createAccountOptions); + expect().assertFail(); + done(); + } + catch(err){ + console.debug("====>add Account ActsAccountCreateAccount_1600 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>ActsAccountCreateAccount_1600 end===="); + done(); + } + }); + + + /* + * @tc.number : ActsAccountCreateAccount_1700 + * @tc.name : Add account callback form + * @tc.desc : The account name is a special string + */ + it('ActsAccountCreateAccount_1700', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_1700 start===="); + var appAccountManager = account.createAppAccountManager(); + var specialStr = "#@$%^&*()_+!<>~?,./[]abcdefgABCDEFG1234567890"; + appAccountManager.createAccount(specialStr, createAccountOptions, (err)=>{ + console.debug("====>add account ActsAccountCreateAccount_1700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount(specialStr, (err)=>{ + console.debug("====>delete Account ActsAccountCreateAccount_1700 err" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCreateAccount_1700 end===="); + done(); + }); + }); + }); + + /* + * @tc.number : ActsAccountCreateAccount_1800 + * @tc.name : Add account promise form + * @tc.desc : The account name is a special string + */ + it('ActsAccountCreateAccount_1800', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_1800 start===="); + var appAccountManager = account.createAppAccountManager(); + var specialStr = "#@$%^&*()_+!<>~?,./[]abcdefgABCDEFG1234567890"; + console.debug("====>add account ActsAccountCreateAccount_1800===="); + try{ + await appAccountManager.createAccount(specialStr, createAccountOptions); + } + catch(err){ + console.error("====>add Account ActsAccountCreateAccount_1800 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>delete account ActsAccountCreateAccount_1800===="); + await appAccountManager.removeAccount(specialStr); + console.debug("====>ActsAccountCreateAccount_1800 end===="); + done(); + }); + + /* + * @tc.number : ActsAccountCreateAccount_1900 + * @tc.name : Add account callback form + * @tc.desc : Additional information is a special character such as a space + */ + it('ActsAccountCreateAccount_1900', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_1900 start===="); + var appAccountManager = account.createAppAccountManager(); + var specialStr = " "; + try{ + appAccountManager.createAccount("account_name_callback_tenth", specialStr, (err)=>{ + expect().assertFail(); + done(); + }); + }catch(err){ + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountCreateAccount_1900 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCreateAccount_2000 + * @tc.name : Add account promise form + * @tc.desc : Additional information is a special character such as a space + */ + it('ActsAccountCreateAccount_2000', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_2000 start===="); + var appAccountManager = account.createAppAccountManager(); + var specialStr = " "; + console.debug("====>add account ActsAccountCreateAccount_2000===="); + try{ + await appAccountManager.createAccount("account_name_promise_tenth", specialStr); + } + catch(err){ + console.error("====>add Account ActsAccountCreateAccount_2000 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + done(); + } + console.debug("====>delete account ActsAccountCreateAccount_2000===="); + await appAccountManager.removeAccount("account_name_promise_tenth"); + console.debug("====>ActsAccountCreateAccount_2000 end===="); + done(); + }); + + /* + * @tc.number : ActsAccountCreateAccount_2100 + * @tc.name : Add account callback form + * @tc.desc : Additional information is a special string + */ + it('ActsAccountCreateAccount_2100', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_2100 start===="); + var appAccountManager = account.createAppAccountManager(); + var specialStr = "#@$%^&*()_+!<>~?,./[]abcdefgABCDEFG1234567890"; + try{ + appAccountManager.createAccount("account_extraInfo_callback_eleventh", specialStr, (err)=>{ + expect().assertFail(); + done(); + }); + }catch(err){ + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountCreateAccount_2100 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCreateAccount_2200 + * @tc.name : Add account promise form + * @tc.desc : Additional information is a special string + */ + it('ActsAccountCreateAccount_2200', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_2200 start===="); + var appAccountManager = account.createAppAccountManager(); + var specialStr = "#@$%^&*()_+!<>~?,./[]abcdefgABCDEFG1234567890"; + console.debug("====>add account ActsAccountCreateAccount_2200===="); + try{ + await appAccountManager.createAccount("account_extraInfo_promise_eleventh", specialStr); + } + catch(err){ + console.error("====>add Account ActsAccountCreateAccount_2200 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + done(); + } + console.debug("====>delete account ActsAccountCreateAccount_2200===="); + await appAccountManager.removeAccount("account_extraInfo_promise_eleventh"); + console.debug("====>ActsAccountCreateAccount_2200 end===="); + done(); + }); + + /* + * @tc.number : ActsAccountCreateAccount_2300 + * @tc.name : Add account callback form + * @tc.desc : Repeatedly add accounts with the same name and different additional information + */ + it('ActsAccountCreateAccount_2300', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_2300 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("account_name_callback_same", createAccountOptions, (err)=>{ + console.debug("====>add account first time ActsAccountCreateAccount_2300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.createAccount("account_name_callback_same", createAccountOptionsDiff, (err)=>{ + console.debug("====>add account second time ActsAccountCreateAccount_2300 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(12300008); + appAccountManager.removeAccount("account_name_callback_same", (err)=>{ + console.debug("====>delete Account ActsAccountCreateAccount_2300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCreateAccount_2300 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCreateAccount_2400 + * @tc.name : Add account promise form + * @tc.desc : Repeatedly add accounts with the same name and different additional information + */ + it('ActsAccountCreateAccount_2400', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_2400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>add account for the first time ActsAccountCreateAccount_2400===="); + await appAccountManager.createAccount("account_name_promise_same", createAccountOptions); + console.debug("====>add account for the second time ActsAccountCreateAccount_2400===="); + try{ + await appAccountManager.createAccount("account_name_promise_same", createAccountOptionsDiff); + } + catch(err){ + console.debug("====>add account for the second time err:" + JSON.stringify(err)); + expect(err.code).assertEqual(12300008); + appAccountManager.removeAccount("account_name_promise_same"); + console.debug("====>ActsAccountCreateAccount_2400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCreateAccount_2500 + * @tc.name : Add account callback form + * @tc.desc : The account name reaches the limit of 512 characters + */ + it('ActsAccountCreateAccount_2500', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_2500 start===="); + var limitName = ''; + for (var i = 0; i < NAMELIMIT; i++) { + limitName += 't'; + } + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount(limitName, createAccountOptions, (err)=>{ + console.debug("====>add account ActsAccountCreateAccount_2500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount(limitName, (err)=>{ + console.debug("====>delete Account ActsAccountCreateAccount_2500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCreateAccount_2500 end===="); + done(); + }); + }); + }); + + /* + * @tc.number : ActsAccountCreateAccount_2600 + * @tc.name : Add account promise form + * @tc.desc : The account name reaches the limit of 512 characters + */ + it('ActsAccountCreateAccount_2600', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_2600 start===="); + var nameLimit = ''; + for (var i = 0; i < NAMELIMIT; i++) { + nameLimit += 't'; + } + var appAccountManager = account.createAppAccountManager(); + console.debug("====>add account ActsAccountCreateAccount_2600 start===="); + try{ + await appAccountManager.createAccount(nameLimit, createAccountOptions); + } + catch(err){ + console.error("====>add account ActsAccountCreateAccount_2600 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>delete account ActsAccountCreateAccount_2600 start===="); + await appAccountManager.removeAccount(nameLimit); + console.debug("====>ActsAccountCreateAccount_2600 end===="); + done(); + }); + + /* + * @tc.number : ActsAccountCreateAccount_2700 + * @tc.name : Add account callback form + * @tc.desc : Additional information reaches the limit of 1024 characters + */ + it('ActsAccountCreateAccount_2700', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_2700 start===="); + var limitExtra = ''; + for (var i = 0; i < LENGTHLIMIT; i++) { + limitExtra += 't'; + } + var appAccountManager = account.createAppAccountManager(); + try{ + appAccountManager.createAccount("account_extra_callback_limit", limitExtra, (err)=>{ + expect().assertFail(); + done(); + }); + }catch(err){ + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountCreateAccount_2700 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCreateAccount_2800 + * @tc.name : Add account promise form + * @tc.desc : Additional information reaches the limit of 1024 characters + */ + it('ActsAccountCreateAccount_2800', 0, async function (done) { + console.debug("====>ActsAccountCreateAccount_2800 start===="); + var extraLimit = ''; + for (var i = 0; i < LENGTHLIMIT; i++) { + extraLimit += 't'; + } + var appAccountManager = account.createAppAccountManager(); + try{ + await appAccountManager.createAccount("account_extra_promise_limit", extraLimit); + } + catch(err){ + console.error("====>add account ActsAccountCreateAccount_2800 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + done(); + } + console.debug("====>delete account ActsAccountCreateAccount_2800 start===="); + appAccountManager.removeAccount("account_extra_promise_limit"); + console.debug("====>ActsAccountCreateAccount_2800 end===="); + done(); + }); + }) +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/CustomData.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/CustomData.test.js new file mode 100644 index 000000000..8807b3606 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/CustomData.test.js @@ -0,0 +1,1195 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import account from '@ohos.account.appAccount' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +const TIMEOUT = 5000; +const EACHTIMEOUT = 500; +export default function ActsAccountCustomData() { + describe('ActsAccountCustomData', function () { + function sleep(delay) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) + } + + beforeAll(async function (done) { + console.debug("====>beforeAll start===="); + await sleep(TIMEOUT); + console.debug("====>beforeAll end===="); + done(); + }) + + beforeEach(async function (done) { + console.debug("====>beforeEach enter===="); + await sleep(EACHTIMEOUT); + done(); + }) + + /* + * @tc.number : ActsAccountCustomData_0100 + * @tc.name : The correct calls setAssociatedData and getAssociatedData get the value + * @tc.desc : The setAssociatedData setting valueis called when the forwarding parameters + * are correct, and then getAssociatedData is called for the value(callback) + */ + it('ActsAccountCustomData_0100', 0, async function (done) { + console.debug("====>ActsAccountCustomData_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_0100",(err)=>{ + console.debug("====>add accountActsAccountCustomData_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("account_name_0100", "key1", "value1", (err)=>{ + console.debug("====>setAssociatedData ActsAccountCustomData_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAssociatedData("account_name_0100", "key1", (err, data)=>{ + console.debug("====>getAssociatedData 0100 err:" + JSON.stringify(err)); + console.debug("====>getAssociatedData 0100 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual("value1"); + appAccountManager.removeAccount("account_name_0100", (err)=>{ + console.debug("====>delete Account 0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCustomData_0100 end===="); + done(); + }); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_0200 + * @tc.name : The correct calls setAssociatedData and getAssociatedData get the value + * @tc.desc : The setAssociatedData setting value is called when the forwarding parameters + * are correct, and then getAssociatedData is called for the value(promise) + */ + it('ActsAccountCustomData_0200', 0, async function (done) { + console.debug("====>ActsAccountCustomData_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAccountCustomData_0200 start===="); + try{ + await appAccountManager.createAccount("account_name_0200"); + } + catch(err){ + console.error("====>add Account ActsAccountCustomData_0200 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>setAssociatedData ActsAccountCustomData_0200 start===="); + try{ + await appAccountManager.setAssociatedData("account_name_0200", "key2", "value2"); + } + catch(err){ + console.error("====>setAssociatedData ActsAccountCustomData_0200 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAssociatedData ActsAccountCustomData_0200 start===="); + try{ + var data = await appAccountManager.getAssociatedData("account_name_0200", "key2"); + } + catch(err){ + console.error("====>getAssociatedData ActsAccountCustomData_0200 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAssociatedData ActsAccountCustomData_0200 data:" + JSON.stringify(data)); + expect(data).assertEqual("value2"); + console.debug("====>delete account ActsAccountCustomData_0200 start===="); + try{ + await appAccountManager.removeAccount("account_name_0200"); + } + catch(err){ + console.error("====>delete account 0200 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_0200 end===="); + done(); + }); + + /* + * @tc.number : ActsAccountCustomData_0300 + * @tc.name : Get it directly without setting value + * @tc.desc : Call getAssociatedData directly to get value without calling setAssociatedData(callback) + */ + it('ActsAccountCustomData_0300', 0, async function (done) { + console.debug("====>ActsAccountCustomData_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_0300", (err)=>{ + console.debug("====>add account ActsAccountCustomData_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAssociatedData("account_name_0300", "key3", (err, data)=>{ + console.debug("====>getAssociatedData 0300 err:" + JSON.stringify(err)); + console.debug("====>getAssociatedData 0300 data:" + JSON.stringify(data)); + expect(err.code != 0).assertEqual(true); + expect(data).assertEqual(null); + appAccountManager.removeAccount("account_name_0300", (err)=>{ + console.debug("====>delete Account 0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCustomData_0300 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_0400 + * @tc.name : Get it directly without setting value + * @tc.desc : Call getAssociatedData directly to get value without calling setAssociatedData(promise) + */ + it('ActsAccountCustomData_0400', 0, async function (done) { + console.debug("====>ActsAccountCustomData_0400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAccountCustomData_0400 start===="); + try{ + await appAccountManager.createAccount("account_name_0400"); + } + catch(err){ + console.error("====>add Account ActsAccountCustomData_0400 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + await appAccountManager.getAssociatedData("account_name_0400", "key4"); + console.error("====>getAssociatedData fail ActsAccountCustomData_0400===="); + expect().assertFail(); + done(); + } + catch(err){ + console.debug("====>getAssociatedData ActsAccountCustomData_0400 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>delete account ActsAccountCustomData_0400 start===="); + try{ + await appAccountManager.removeAccount("account_name_0400"); + } + catch(err){ + console.error("====>delete account 0400 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_0400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCustomData_0500 + * @tc.name : Call getAssociatedData to get value when passing in the error parameter + * @tc.desc : After calling setAssociatedData setting value correctly, + * call the getAssociatedData of the pass error to check if you get the value(callback) + */ + it('ActsAccountCustomData_0500', 0, async function (done) { + console.debug("====>ActsAccountCustomData_0500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_0500",(err)=>{ + console.debug("====>add account ActsAccountCustomData_0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("account_name_0500", "key5", "value5", (err)=>{ + console.debug("====>setAssociatedData ActsAccountCustomData_0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAssociatedData("account_name_0500", "keyerr", (err, data)=>{ + console.debug("====>getAssociatedData 0500 err:" + JSON.stringify(err)); + console.debug("====>getAssociatedData 0500 data:" + JSON.stringify(data)); + expect(err.code != 0).assertEqual(true); + appAccountManager.removeAccount("account_name_0500", (err)=>{ + console.debug("====>delete Account 0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCustomData_0500 end===="); + done(); + }); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_0600 + * @tc.name : Call getAssociatedData to get value when passing in the error parameter + * @tc.desc : After calling setAssociatedData setting value correctly, + * call the getAssociatedData of the pass error to check if you get the value(promise) + */ + it('ActsAccountCustomData_0600', 0, async function (done) { + console.debug("====>ActsAccountCustomData_0600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAccountCustomData_0600 start===="); + try{ + await appAccountManager.createAccount("account_name_0600"); + } + catch(err){ + console.error("====>add Account ActsAccountCustomData_0600 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + await appAccountManager.setAssociatedData("account_name_0600", "key6", "value6"); + try{ + var data = await appAccountManager.getAssociatedData("account_name_0600", "keyerr"); + } + catch(err){ + console.debug("====>getAssociatedData 0600 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>delete account ActsAccountCustomData_0600 start===="); + try{ + await appAccountManager.removeAccount("account_name_0600"); + } + catch(err){ + console.error("====>delete account 0600 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_0600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCustomData_0700 + * @tc.name : Whether getAssociatedData can get the correct value when calling setAssociatedData multiple times + * @tc.desc : When the first setAssociatedData is called and the second setAssociatedData + * is called,the setting of the value is different if the call getAssociatedData + * can get the second value(callback) + */ + it('ActsAccountCustomData_0700', 0, async function (done) { + console.debug("====>ActsAccountCustomData_0700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_0700",(err)=>{ + console.debug("====>add account ActsAccountCustomData_0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("account_name_0700", "key7", "value7", (err)=>{ + console.debug("====>setAssociatedDatafir first time 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("account_name_0700", "key7", "newvalue7", (err)=>{ + console.debug("====>setAssociatedDatafir second time 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAssociatedData("account_name_0700", "key7", (err, data)=>{ + console.debug("====>getAssociatedData 0700 err:" + JSON.stringify(err)); + console.debug("====>getAssociatedData 0700 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual("newvalue7"); + appAccountManager.removeAccount("account_name_0700", (err)=>{ + console.debug("====>delete Account 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCustomData_0700 end===="); + done(); + }); + }); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_0800 + * @tc.name : Whether getAssociatedData can get the correct value when calling setAssociatedData multiple times + * @tc.desc : When the first setAssociatedData is called and the second setAssociatedData + * is called,the setting of the value is different if the call getAssociatedData + * can get the second value(promise) + */ + it('ActsAccountCustomData_0800', 0, async function (done) { + console.debug("====>ActsAccountCustomData_0800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + try{ + await appAccountManager.createAccount("account_name_0800"); + } + catch(err){ + console.error("====>add account ActsAccountCustomData_0800 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + await appAccountManager.setAssociatedData("account_name_0800","key8","value8"); + await appAccountManager.setAssociatedData("account_name_0800","key8","newvalue8"); + }catch(err){ + console.error("====>setAssociatedData ActsAccountCustomData_0800 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + var data = await appAccountManager.getAssociatedData("account_name_0800", "key8"); + } + catch(err){ + console.error("====>getAssociatedData ActsAccountCustomData_0800 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAssociatedData ActsAccountCustomData_0800 data:" + JSON.stringify(data)); + expect(data).assertEqual("newvalue8"); + console.debug("====>delete account ActsAccountCustomData_0800 start===="); + try{ + await appAccountManager.removeAccount("account_name_0800"); + } + catch(err){ + console.error("====>delete account 0800 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_0800 end===="); + done(); + }); + + /* + * @tc.number : ActsAccountCustomData_0900 + * @tc.name : Whether getAssociatedData can get the correct value when calling setAssociatedData multiple times + * @tc.desc : When the first setAssociatedData is called and the second setAssociatedData + * is called,the setting of the value is same if the call getAssociatedData + * can get the second value(callback) + */ + it('ActsAccountCustomData_0900', 0, async function (done) { + console.debug("====>ActsAccountCustomData_0900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_0900",(err)=>{ + console.debug("====>add account ActsAccountCustomData_0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("account_name_0900", "key9", "value9", (err)=>{ + console.debug("====>setAssociatedData first time 0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("account_name_0900", "key9", "value9", (err)=>{ + console.debug("====>setAssociatedData second time 0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAssociatedData("account_name_0900", "key9", (err, data)=>{ + console.debug("====>getAssociatedData 0900 err:" + JSON.stringify(err)); + console.debug("====>getAssociatedData 0900 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual("value9"); + appAccountManager.removeAccount("account_name_0900", (err)=>{ + console.debug("====>delete Account 0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCustomData_0900 end===="); + done(); + }); + }); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_1000 + * @tc.name : Whether getAssociatedData can get the correct value when calling setAssociatedData multiple times + * @tc.desc : When the first setAssociatedData is called and the second setAssociatedData + * is called,the setting of the value is same if the call getAssociatedData + * can get the second value(promise) + */ + it('ActsAccountCustomData_1000', 0, async function (done) { + console.debug("====>ActsAccountCustomData_1000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>createAccount ActsAccountCustomData_1000 start===="); + try{ + await appAccountManager.createAccount("account_name_1000"); + } + catch(err){ + console.error("====>add account ActsAccountCustomData_1000 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + await appAccountManager.setAssociatedData("account_name_1000", "key10", "value10"); + await appAccountManager.setAssociatedData("account_name_1000", "key10", "value10"); + } + catch(err){ + console.error("====>setAssociatedData ActsAccountCustomData_1000 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + var data = await appAccountManager.getAssociatedData("account_name_1000", "key10"); + } + catch(err){ + console.error("====>getAssociatedData ActsAccountCustomData_1000 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAssociatedData 1000 data:" + JSON.stringify(data)); + expect(data).assertEqual("value10"); + console.debug("====>delete account ActsAccountCustomData_1000 start===="); + try{ + await appAccountManager.removeAccount("account_name_1000"); + } + catch(err){ + console.error("====>delete account 1000 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_1000 end===="); + done(); + }); + + /* + * @tc.number : ActsAccountCustomData_1100 + * @tc.name : Call multiple setAssociatedData calls multiple times getAssociatedData gets the value separately + * @tc.desc : Call setAssociatedData setting value again after calling setAssociatedData setting + * different value, and then call getAssociatedData twice to get the set value(callback) + */ + it('ActsAccountCustomData_1100', 0, async function (done) { + console.debug("====>ActsAccountCustomData_1100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_1100",(err)=>{ + console.debug("====>add account ActsAccountCustomData_1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("account_name_1100", "key11_first", "value11_first", (err)=>{ + console.debug("====>setAssociatedData first time 1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("account_name_1100", "key11_second", "value11_second", (err)=>{ + console.debug("====>setAssociatedData second time 1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAssociatedData("account_name_1100", "key11_first", (err,data)=>{ + console.debug("====>getAssociatedData key11_first 1100 err:" + JSON.stringify(err)); + console.debug("====>getAssociatedData key11_first 1100 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual("value11_first"); + appAccountManager.getAssociatedData("account_name_1100", "key11_second", (err,data)=>{ + console.debug("====>getAssociatedData key11_second 1100 err:" + JSON.stringify(err)); + console.debug("====>getAssociatedData key11_second 1100 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual("value11_second"); + appAccountManager.removeAccount("account_name_1100", (err)=>{ + console.debug("====>delete Account 1100 err:" + JSON.stringify(err)); + }); + console.debug("====>ActsAccountCustomData_1100 end===="); + done(); + }); + }); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_1200 + * @tc.name : Call multiple setAssociatedData calls multiple times getAssociatedData gets the value separately + * @tc.desc : Call setAssociatedData setting value again after calling setAssociatedData setting + * different value, and then call getAssociatedData twice to get the set value(promise) + */ + it('ActsAccountCustomData_1200', 0, async function (done) { + console.debug("====>ActsAccountCustomData_1200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>createAccount ActsAccountCustomData_1200 start===="); + try{ + await appAccountManager.createAccount("account_name_1200"); + } + catch(err){ + console.error("====>add account ActsAccountCustomData_1200 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + await appAccountManager.setAssociatedData("account_name_1200", "key12_first", "value12_first"); + await appAccountManager.setAssociatedData("account_name_1200", "key12_second", "value12_second"); + } + catch(err){ + console.error("====>setAssociatedData ActsAccountCustomData_1200 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + var dataFir = await appAccountManager.getAssociatedData("account_name_1200", "key12_first"); + var dataSec = await appAccountManager.getAssociatedData("account_name_1200", "key12_second"); + } + catch(err){ + console.error("====>getAssociatedData ActsAccountCustomData_1200 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_1200 getAssociatedData dataFir:" + JSON.stringify(dataFir)); + expect(dataFir).assertEqual("value12_first"); + console.debug("====>ActsAccountCustomData_1200 getAssociatedData dataSec:" + JSON.stringify(dataSec)); + expect(dataSec).assertEqual("value12_second"); + console.debug("====>delete account ActsAccountCustomData_1200 start===="); + try{ + await appAccountManager.removeAccount("account_name_1200"); + } + catch(err){ + console.error("====>delete account 1200 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_1200 end===="); + done(); + }); + + /* + * @tc.number : ActsAccountCustomData_1300 + * @tc.name : setAssociatedData setting value is called when the argument is wrong + * @tc.desc : Call setAssociatedData setting value when the incoming parameter KEY is wrong(callback) + */ + it('ActsAccountCustomData_1300', 0, async function (done) { + console.debug("====>ActsAccountCustomData_1300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_1300", (err)=>{ + console.debug("====>add account ActsAccountCustomData_1300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("account_name_1300", "", "value13", (err)=>{ + console.debug("====>setAssociatedData ActsAccountCustomData_1300 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + appAccountManager.removeAccount("account_name_1300", (err)=>{ + console.debug("====>delete account ActsAccountCustomData_1300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCustomData_1300 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_1400 + * @tc.name : setAssociatedData setting value is called when the argument is wrong + * @tc.desc : Call setAssociatedData setting value when the incoming parameter KEY is wrong(promise) + */ + it('ActsAccountCustomData_1400', 0, async function (done) { + console.debug("====>ActsAccountCustomData_1400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAccountCustomData_1400 start===="); + try{ + await appAccountManager.createAccount("account_name_1400"); + } + catch(err){ + console.error("====>add account ActsAccountCustomData_1400 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + await appAccountManager.setAssociatedData("account_name_1400", "", "value14"); + } + catch(err){ + console.debug("====>setAssociatedData ActsAccountCustomData_1400 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>delete account ActsAccountCustomData_1400 start===="); + try{ + await appAccountManager.removeAccount("account_name_1400"); + } + catch(err){ + console.error("====>delete account 1400 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_1400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCustomData_1500 + * @tc.name : setAssociatedData setting key is called when the argument is wrong + * @tc.desc : Call setAssociatedData setting key when the incoming parameter KEY is wrong(callback) + */ + it('ActsAccountCustomData_1500', 0, async function (done) { + console.debug("====>ActsAccountCustomData_1500 start===="); + var keyOverSize = "K" + for(var i = 0;i < 256;i++) + keyOverSize = keyOverSize + "K!@#"; + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_1500", (err)=>{ + console.debug("====>add account ActsAccountCustomData_1500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>1500 keyOverSize.length:" + JSON.stringify(keyOverSize.length)); + expect(keyOverSize.length).assertEqual(1025); + appAccountManager.setAssociatedData("account_name_1500", keyOverSize, "value15", (err)=>{ + console.debug("====>setAssociatedData ActsAccountCustomData_1500 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + appAccountManager.removeAccount("account_name_1500", (err)=>{ + console.debug("====>delete account ActsAccountCustomData_1500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCustomData_1500 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_1600 + * @tc.name : setAssociatedData setting key is called when the argument is wrong + * @tc.desc : Call setAssociatedData setting key when the incoming parameter KEY is wrong(promise) + */ + it('ActsAccountCustomData_1600', 0, async function (done) { + console.debug("====>ActsAccountCustomData_1600 start===="); + var keyOverSize = "K" + for(var i=0;i<256;i++) + keyOverSize = keyOverSize + "K!@#"; + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + expect(keyOverSize.length).assertEqual(1025); + console.debug("====>add account ActsAccountCustomData_1600 start===="); + try{ + await appAccountManager.createAccount("account_name_1600"); + } + catch(err){ + console.error("====>add account ActsAccountCustomData_1600 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + await appAccountManager.setAssociatedData("account_name_1600", keyOverSize, "value16"); + } + catch(err){ + console.debug("====>setAssociatedData ActsAccountCustomData_1600 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>delete account ActsAccountCustomData_1600 start===="); + try{ + await appAccountManager.removeAccount("account_name_1600"); + } + catch(err){ + console.error("====>delete account 1600 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_1600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCustomData_1700 + * @tc.name : setAssociatedData and getAssociatedData are called when the argument is spaced + * @tc.desc : Call setAssociatedData and then getAssociatedData when the incoming key is a space(callback) + */ + it('ActsAccountCustomData_1700', 0, async function (done) { + console.debug("====>ActsAccountCustomData_1700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_1700", (err)=>{ + console.debug("====>add account ActsAccountCustomData_1700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("account_name_1700", " ", "value17", (err)=>{ + console.debug("====>ActsAccountCustomData_1700 setAssociatedData:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAssociatedData("account_name_1700", " ", (err, data)=>{ + console.debug("====>getAssociatedData 1700 err:" + JSON.stringify(err)); + console.debug("====>getAssociatedData 1700 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual("value17"); + appAccountManager.removeAccount("account_name_1700", (err)=>{ + console.debug("====>delete Account 1700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCustomData_1700 end===="); + done(); + }); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_1800 + * @tc.name : setAssociatedData and getAssociatedData are called when the argument is spaced + * @tc.desc : Call setAssociatedData and then getAssociatedData when the incoming key is a space(promise) + */ + it('ActsAccountCustomData_1800', 0, async function (done) { + console.debug("====>ActsAccountCustomData_1800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAccountCustomData_1800 start===="); + try{ + await appAccountManager.createAccount("account_name_1800"); + } + catch(err){ + console.error("====>add account ActsAccountCustomData_1800 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + await appAccountManager.setAssociatedData("account_name_1800", " ", "value18"); + try{ + var data = await appAccountManager.getAssociatedData("account_name_1800", " "); + } + catch(err){ + console.error("====>setAssociatedData ActsAccountCustomData_1800 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAssociatedData ActsAccountCustomData_1800 data:" + JSON.stringify(data)); + expect(data).assertEqual("value18"); + console.debug("====>delete account ActsAccountCustomData_1800 start===="); + try{ + await appAccountManager.removeAccount("account_name_1800"); + } + catch(err){ + console.error("====>delete account 1800 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_1800 end===="); + done(); + }); + + /* + * @tc.number : ActsAccountCustomData_1900 + * @tc.name : setAssociatedData and getAssociatedData are called when the argument is spaced + * @tc.desc : Call setAssociatedData and then getAssociatedData when the incoming value is null(callback) + */ + it('ActsAccountCustomData_1900', 0, async function (done) { + console.debug("====>ActsAccountCustomData_1900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_1900", (err)=>{ + console.debug("====>add account ActsAccountCustomData_1900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("account_name_1900", "key19", "", (err)=>{ + console.debug("====>setAssociatedData ActsAccountCustomData_1900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAssociatedData("account_name_1900", "key19", (err, data)=>{ + console.debug("====>getAssociatedData 1900 err:" + JSON.stringify(err)); + console.debug("====>getAssociatedData 1900 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual(""); + appAccountManager.removeAccount("account_name_1900", (err)=>{ + console.debug("====>delete Account 1900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCustomData_1900 end===="); + done(); + }); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_2000 + * @tc.name : setAssociatedData and getAssociatedData are called when the argument is spaced + * @tc.desc : Call setAssociatedData and then getAssociatedData when the incoming value is null(promise) + */ + it('ActsAccountCustomData_2000', 0, async function (done) { + console.debug("====>ActsAccountCustomData_2000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAccountCustomData_2000 start===="); + try{ + await appAccountManager.createAccount("account_name_2000"); + } + catch(err){ + console.error("====>add account ActsAccountCustomData_2000 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + await appAccountManager.setAssociatedData("account_name_2000", "key20", ""); + } + catch(err){ + console.error("====>setAssociatedData ActsAccountCustomData_2000 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + var data = await appAccountManager.getAssociatedData("account_name_2000", "key20"); + } + catch(err){ + console.error("====>getAssociatedData 2000 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAssociatedData ActsAccountCustomData_2000 data:" + JSON.stringify(data)); + expect(data).assertEqual(""); + console.debug("====>delete account ActsAccountCustomData_2000 start===="); + try{ + await appAccountManager.removeAccount("account_name_2000"); + } + catch(err){ + console.error("====>delete account 2000 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_2000 end===="); + done(); + }); + + /* + * @tc.number : ActsAccountCustomData_2100 + * @tc.name : setAssociatedData setting value is called when the argument is wrong + * @tc.desc : Call setAssociatedData setting value when the incoming parameter value is wrong(callback) + */ + it('ActsAccountCustomData_2100', 0, async function (done) { + console.debug("====>ActsAccountCustomData_2100 start===="); + var valueOverSize = "K" + for(var i = 0;i < 256;i++) + valueOverSize = valueOverSize + "K!@#"; + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_2100",(err)=>{ + console.debug("====>add account ActsAccountCustomData_2100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + expect(valueOverSize.length).assertEqual(1025); + appAccountManager.setAssociatedData("account_name_2100", "key21", valueOverSize, (err)=>{ + console.debug("====>setAssociatedData ActsAccountCustomData_2100 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + appAccountManager.removeAccount("account_name_2100", (err)=>{ + console.debug("====>delete Account ActsAccountCustomData_2100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCustomData_2100 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_2200 + * @tc.name : setAssociatedData setting value is called when the argument is wrong + * @tc.desc : Call setAssociatedData setting value when the incoming parameter value is wrong(promise) + */ + it('ActsAccountCustomData_2200', 0, async function (done) { + console.debug("====>ActsAccountCustomData_2200 start===="); + var valueOverSize = "K" + for(var i = 0;i < 256;i++) + valueOverSize = valueOverSize + "K!@#"; + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + expect(valueOverSize.length).assertEqual(1025); + try{ + await appAccountManager.createAccount("account_name_2200"); + } + catch(err){ + console.error("====>add account ActsAccountCustomData_2200 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + await appAccountManager.setAssociatedData("account_name_2200", "key22", valueOverSize); + } + catch(err){ + console.debug("====>setAssociatedData ActsAccountCustomData_2200 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>delete account ActsAccountCustomData_2200 start===="); + try{ + await appAccountManager.removeAccount("account_name_2200"); + } + catch(err){ + console.error("====>delete account 2200 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_2200 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCustomData_2300 + * @tc.name : setAssociatedData and getAssociatedData are called when the argument is spaced + * @tc.desc : Call setAssociatedData and then getAssociatedData when the incoming value is a space(callback) + */ + it('ActsAccountCustomData_2300', 0, async function (done) { + console.debug("====>ActsAccountCustomData_2300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_2300", (err)=>{ + console.debug("====>add account ActsAccountCustomData_2300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("account_name_2300", "key23", " ", (err)=>{ + console.debug("====>setAssociatedData ActsAccountCustomData_2300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAssociatedData("account_name_2300", "key23", (err, data)=>{ + console.debug("====>getAssociatedData 2300 err:" + JSON.stringify(err)); + console.debug("====>getAssociatedData 2300 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual(" "); + appAccountManager.removeAccount("account_name_2300", (err)=>{ + console.debug("====>delete Account 2300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCustomData_2300 end===="); + done(); + }); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_2400 + * @tc.name : setAssociatedData and getAssociatedData are called when the argument is spaced + * @tc.desc : Call setAssociatedData and then getAssociatedData when the incoming value is a space(promise) + */ + it('ActsAccountCustomData_2400', 0, async function (done) { + console.debug("====>ActsAccountCustomData_2400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAccountCustomData_2400 start===="); + try{ + await appAccountManager.createAccount("account_name_2400"); + } + catch(err){ + console.error("====>add account ActsAccountCustomData_2400 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + await appAccountManager.setAssociatedData("account_name_2400", "key24", " "); + try{ + var data = await appAccountManager.getAssociatedData("account_name_2400", "key24"); + } + catch(err){ + console.error("====>getAssociatedData 2400 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAssociatedData 2400 err:" + JSON.stringify(data)); + expect(data).assertEqual(" "); + console.debug("====>delete account ActsAccountCustomData_2400 start===="); + try{ + await appAccountManager.removeAccount("account_name_2400"); + } + catch(err){ + console.error("====>delete account 2400 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_2400 end===="); + done(); + }); + + /* + * @tc.number : ActsAccountCustomData_2500 + * @tc.name : setAssociatedData and getAssociatedData are called when the argument is spaced + * @tc.desc : Call setAssociatedData and then getAssociatedData when the incoming name is null(callback) + */ + it('ActsAccountCustomData_2500', 0, async function (done) { + console.debug("====>ActsAccountCustomData_2500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_2500", (err)=>{ + console.debug("====>add account ActsAccountCustomData_2500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("", "key25", "value25", (err)=>{ + console.debug("====>setAssociatedData ActsAccountCustomData_2500 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + appAccountManager.removeAccount("account_name_2500", (err)=>{ + console.debug("====>delete Account ActsAccountCustomData_2500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCustomData_2500 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_2600 + * @tc.name : setAssociatedData and getAssociatedData are called when the argument is spaced + * @tc.desc : Call setAssociatedData and then getAssociatedData when the incoming name is null(promise) + */ + it('ActsAccountCustomData_2600', 0, async function (done) { + console.debug("====>ActsAccountCustomData_2600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>ActsAccountCustomData_2600 createAccount start===="); + try{ + await appAccountManager.createAccount("account_name_2600"); + } + catch(err){ + console.error("====>add account ActsAccountCustomData_2600 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + await appAccountManager.setAssociatedData("", "key26", "value26"); + } + catch(err){ + console.debug("====>setAssociatedData ActsAccountCustomData_2600 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>delete account ActsAccountCustomData_2600 start===="); + try{ + await appAccountManager.removeAccount("account_name_2600"); + } + catch(err){ + console.error("====>delete account 2600 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_2600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCustomData_2700 + * @tc.name : setAssociatedData setting name is called when the argument is wrong + * @tc.desc : Call setAssociatedData setting name when the incoming parameter name is wrong(callback) + */ + it('ActsAccountCustomData_2700', 0, async function (done) { + console.debug("====>ActsAccountCustomData_2700 start===="); + var nameOverSize = "n" + for(var i = 0;i < 256;i++) + nameOverSize = nameOverSize+"name"; + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_2700",(err)=>{ + console.debug("====>add account ActsAccountCustomData_2700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + expect(nameOverSize.length).assertEqual(1025); + appAccountManager.setAssociatedData(nameOverSize, "key27", "value27", (err)=>{ + console.debug("====>ActsAccountCustomData_2700 setAssociatedData:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + appAccountManager.removeAccount("account_name_2700", (err)=>{ + console.debug("====>delete Account ActsAccountCustomData_2700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCustomData_2700 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_2800 + * @tc.name : setAssociatedData setting name is called when the argument is wrong + * @tc.desc : Call setAssociatedData setting name when the incoming parameter name is wrong(promise) + */ + it('ActsAccountCustomData_2800', 0, async function (done) { + console.debug("====>ActsAccountCustomData_2800 start===="); + var nameOverSize = "n" + for(var i = 0;i < 256;i++) + nameOverSize = nameOverSize + "name"; + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + expect(nameOverSize.length).assertEqual(1025); + console.debug("====>add account ActsAccountCustomData_2800 start===="); + try{ + await appAccountManager.createAccount("account_name_2800"); + } + catch(err){ + console.error("====>add account ActsAccountCustomData_2800 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + await appAccountManager.setAssociatedData(nameOverSize, "key28", "value28"); + } + catch(err){ + console.debug("====>setAssociatedData ActsAccountCustomData_2800 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>delete account ActsAccountCustomData_2800 start===="); + try{ + await appAccountManager.removeAccount("account_name_2800"); + } + catch(err){ + console.error("====>delete account 2800 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsAccountCustomData_2800 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountCustomData_2900 + * @tc.name : setAssociatedData and getAssociatedData are called when the argument is spaced + * @tc.desc : Call setAssociatedData and then getAssociatedData when the incoming name is a space(callback) + */ + it('ActsAccountCustomData_2900', 0, async function (done) { + console.debug("====>ActsAccountCustomData_2900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount(" ", (err)=>{ + console.debug("====>add account ActsAccountCustomData_2900 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + appAccountManager.setAssociatedData(" ", "key29", "value29", (err)=>{ + console.debug("====>setAssociatedData ActsAccountCustomData_2900 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + appAccountManager.getAssociatedData(" ", "key29", (err, data)=>{ + console.debug("====>getAssociatedData 2900 err:" + JSON.stringify(err)); + console.debug("====>getAssociatedData 2900 data:" + JSON.stringify(data)); + expect(err.code != 0).assertEqual(true); + expect(data).assertEqual(null); + console.debug("====>ActsAccountCustomData_2900 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountCustomData_3000 + * @tc.name : setAssociatedData and getAssociatedData are called when the argument is spaced + * @tc.desc : Call setAssociatedData and then getAssociatedData when the incoming name is a space(promise) + */ + it('ActsAccountCustomData_3000', 0, async function (done) { + console.debug("====>ActsAccountCustomData_3000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + try{ + await appAccountManager.createAccount(" "); + } + catch(err){ + console.debug("====>add account ActsAccountCustomData_3000 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + try{ + await appAccountManager.setAssociatedData(" ", "key30", "value30"); + } + catch(err){ + console.error("====>setAssociatedData ActsAccountCustomData_3000 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + try{ + await appAccountManager.getAssociatedData(" ", "key30"); + } + catch(err){ + console.error("====>getAssociatedData ActsAccountCustomData_3000 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true); + console.debug("====>ActsAccountCustomData_3000 end===="); + done(); + } + } + } + }) + + + /* + * @tc.number : ActsAccountCustomData_3100 + * @tc.name : The correct calls setAssociatedData and getAssociatedData get the value + * @tc.desc : The setAssociatedData setting valueis called when the forwarding parameters + * are correct, and then getAssociatedData is called for the value(callback) + */ + it('ActsAccountCustomData_3100', 0, async function (done) { + console.debug("====>ActsAccountCustomData_3100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_name_3100",(err)=>{ + console.debug("====>add ActsAccountCustomData_3100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("account_name_3100", "key31", "value31", (err)=>{ + console.debug("====>setAssociatedData ActsAccountCustomData_3100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + var result = appAccountManager.getAssociatedDataSync("account_name_3100", "key31") + console.debug("====>getAssociatedData ActsAccountCustomData_3100 result:" + JSON.stringify(result)); + expect(result).assertEqual("value31"); + appAccountManager.removeAccount("account_name_3100", (err)=>{ + console.debug("====>delete Account 0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountCustomData_3100 end===="); + done(); + }); + }); + }); + }); + }) +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/ErrCode.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/ErrCode.test.js new file mode 100644 index 000000000..884450494 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/ErrCode.test.js @@ -0,0 +1,3309 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import account from '@ohos.account.appAccount' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +const TIMEOUT = 5000; +const STRCOUNT = 1025; +const EACHTIMEOUT = 500; +export default function ActsAccountErrCode() { + describe('ActsAccountErrCode', function () { + function sleep(delay) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) + } + + beforeAll(async function (done) { + console.debug("====>beforeAll start===="); + await sleep(TIMEOUT); + console.debug("====>beforeAll end===="); + done(); + }) + + beforeEach(async function (done) { + console.debug("====>beforeEach enter===="); + await sleep(EACHTIMEOUT); + done(); + }) + + /* + * @tc.number : ActsAccountErrCode_0100 + * @tc.name : createAccount callback + * @tc.desc : test the number of parameters does not match (需è¦çš„å‚数顺åºæ£ç¡®,åŽé¢æœ‰å¤šä½™çš„,ä¸æŠ¥é”™) + */ + it('ActsAccountErrCode_0100', 0, async function (done) { + console.debug("====>ActsAccountErrCode_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_0100 creat finish===="); + try { + appAccountManager.createAccount("test_account_name", {"test_key":"test_extrainfo"}, (err)=>{ + console.debug("====>ActsAccountErrCode_0100 create account callback err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("test_account_name", (err)=>{ + console.debug("====>ActsAccountErrCode_0100 delete Account err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountErrCode_0100 end===="); + done(); + }); + }, "test_more_param") + } catch(err) { + console.debug("====>ActsAccountErrCode_0100 create account catch err:" + JSON.stringify(err)); + expect().assertFail(); + console.debug("====>ActsAccountErrCode_0100 end===="); + done(); + } + + }); + + /* + * @tc.number : ActsAccountErrCode_0200 + * @tc.name : createAccount callback + * @tc.desc : test the number of parameters does not match(需è¦çš„å‚数顺åºä¸æœ‰å¤šä½™ç±»åž‹å‚æ•°) + */ + it('ActsAccountErrCode_0200', 0, async function (done) { + console.debug("====>ActsAccountErrCode_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_0200 creat finish===="); + try { + appAccountManager.createAccount("test_account_name", {"test_key":"test_extrainfo"}, "test_more_param", (err)=>{ + console.debug("====>ActsAccountErrCode_0200 create account callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_0200 create account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_0200 end===="); + done(); + } + + }); + + /* + * @tc.number : ActsAccountErrCode_0300 + * @tc.name : createAccount callback + * @tc.desc : test the number of parameters does not match(需è¦çš„å‚æ•°æ•°é‡å°‘于预期) + */ + it('ActsAccountErrCode_0300', 0, async function (done) { + console.debug("====>ActsAccountErrCode_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_0300 creat finish===="); + try { + appAccountManager.createAccount((err)=>{ + console.debug("====>ActsAccountErrCode_0300 create account callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_0300 create account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_0300 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_0400 + * @tc.name : createAccount callback + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_0400', 0, async function (done) { + console.debug("====>ActsAccountErrCode_0400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_0400 creat finish===="); + try { + appAccountManager.createAccount(123456, {"test_key":"test_extrainfo"}, (err)=>{ + console.debug("====>ActsAccountErrCode_0400 create account callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_0400 create account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_0400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_0500 + * @tc.name : createAccount callback + * @tc.desc : test the type of parameters does not match(extrainfoä¸åŒ¹é…) + */ + it('ActsAccountErrCode_0500', 0, async function (done) { + console.debug("====>ActsAccountErrCode_0500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_0500 creat finish===="); + try { + appAccountManager.createAccount("test_account_name", " ", (err)=>{ + console.debug("====>ActsAccountErrCode_0500 create account callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_0500 create account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_0500 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_0510 + * @tc.name : createAccount callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_0510', 0, async function (done) { + console.debug("====>ActsAccountErrCode_0510 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_0510 creat finish===="); + try { + appAccountManager.createAccount(123456, {"test_key":"test_extrainfo"}, 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_0510 create account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_0510 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_0600 + * @tc.name : createAccount promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_0600', 0, async function (done) { + console.debug("====>ActsAccountErrCode_0600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_0600 creat finish===="); + try { + appAccountManager.createAccount(); + } catch(err) { + console.debug("====>ActsAccountErrCode_0600 create account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_0600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_0610 + * @tc.name : createAccount promise + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_0610', 0, async function (done) { + console.debug("====>ActsAccountErrCode_0610 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_0610 creat finish===="); + try { + appAccountManager.createAccount(123456); + } catch(err) { + console.debug("====>ActsAccountErrCode_0610 create account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_0610 end===="); + done(); + } + }); + + //createAccountImplicitly + /* + * @tc.number : ActsAccountErrCode_0700 + * @tc.name : createAccountImplicitly callback + * @tc.desc : test the number of parameters does not match(extrainfoä¸åŒ¹é…) + */ + it('ActsAccountErrCode_0700', 0, async function (done) { + console.debug("====>ActsAccountErrCode_0700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_0700 creat finish===="); + try { + appAccountManager.createAccountImplicitly({ + onResult: (resultCode, resultData)=>{ + console.debug("====>ActsAccountErrCode_0700 authenticate resultCode:" + JSON.stringify(resultCode)); + console.debug("====>ActsAccountErrCode_0700 authenticate resultData:" + JSON.stringify(resultData)); + done(); + }, + onRequestRedirected: null + }); + } catch(err) { + console.debug("====>ActsAccountErrCode_0700 create account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_0700 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_0800 + * @tc.name : createAccountImplicitly callback + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_0800', 0, async function (done) { + console.debug("====>ActsAccountErrCode_0800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_0800 creat finish===="); + try { + appAccountManager.createAccountImplicitly(123456, {}, { + onResult: null, + onRequestRedirected: null + }); + } catch(err) { + console.debug("====>ActsAccountErrCode_0800 create account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_0800 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_0810 + * @tc.name : createAccountImplicitly callback + * @tc.desc : test the type of parameters does not match(optionsä¸åŒ¹é…) + */ + it('ActsAccountErrCode_0810', 0, async function (done) { + console.debug("====>ActsAccountErrCode_0810 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_0810 creat finish===="); + try { + appAccountManager.createAccountImplicitly("test_owner", "test_options", { + onResult: null, + onRequestRedirected: null + }); + } catch(err) { + console.debug("====>ActsAccountErrCode_0810 create account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_0810 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_0820 + * @tc.name : createAccountImplicitly callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_0820', 0, async function (done) { + console.debug("====>ActsAccountErrCode_0820 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_0820 creat finish===="); + var options = {authType: "test_authType"}; + try { + appAccountManager.createAccountImplicitly("test_owner", options, 1233); + } catch(err) { + console.debug("====>ActsAccountErrCode_0820 create account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_0820 end===="); + done(); + } + }); + + //removeAccount + /* + * @tc.number : ActsAccountErrCode_0900 + * @tc.name : removeAccount callback + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_0900', 0, async function (done) { + console.debug("====>ActsAccountErrCode_0900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_0900 creat finish===="); + try { + appAccountManager.removeAccount(123456, (err)=>{ + console.debug("====>ActsAccountErrCode_0900 remove account callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_0900 remove account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_0900 end===="); + done(); + } + }); + + //removeAccount + /* + * @tc.number : ActsAccountErrCode_0910 + * @tc.name : removeAccount callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_0910', 0, async function (done) { + console.debug("====>ActsAccountErrCode_0910 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_0910 creat finish===="); + try { + appAccountManager.removeAccount("test_name", 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_0910 remove account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_0910 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_1000 + * @tc.name : removeAccount callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_1000', 0, async function (done) { + console.debug("====>ActsAccountErrCode_1000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_1000 creat finish===="); + try { + appAccountManager.removeAccount((err)=>{ + console.debug("====>ActsAccountErrCode_1000 remove account callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_1000 remove account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_1000 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_1100 + * @tc.name : removeAccount promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_1100', 0, async function (done) { + console.debug("====>ActsAccountErrCode_1100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_1100 creat finish===="); + try { + appAccountManager.removeAccount(123456) + } catch(err) { + console.debug("====>ActsAccountErrCode_1100 remove account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_1100 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_1200 + * @tc.name : removeAccount callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_1200', 0, async function (done) { + console.debug("====>ActsAccountErrCode_1200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_1200 creat finish===="); + try { + appAccountManager.removeAccount(); + } catch(err) { + console.debug("====>ActsAccountErrCode_1200 remove account catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_1200 end===="); + done(); + } + }); + + //setAppAccess + /* + * @tc.number : ActsAccountErrCode_1300 + * @tc.name : setAppAccess callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_1300', 0, async function (done) { + console.debug("====>ActsAccountErrCode_1300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_1300 creat finish===="); + try { + appAccountManager.setAppAccess((err)=>{ + console.debug("====>ActsAccountErrCode_1300 setAppAccess callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_1300 setAppAccess catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_1300 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_1400 + * @tc.name : setAppAccess callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_1400', 0, async function (done) { + console.debug("====>ActsAccountErrCode_1400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_1400 creat finish===="); + try { + appAccountManager.setAppAccess(123456, "test_owner", false, (err)=>{ + console.debug("====>ActsAccountErrCode_1400 setAppAccess callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_1400 setAppAccess catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_1400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_1410 + * @tc.name : setAppAccess callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_1410', 0, async function (done) { + console.debug("====>ActsAccountErrCode_1410 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_1410 creat finish===="); + try { + appAccountManager.setAppAccess("test_name", "test_owner", false, 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_1410 setAppAccess catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_1410 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_1500 + * @tc.name : setAppAccess promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_1500', 0, async function (done) { + console.debug("====>ActsAccountErrCode_1500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_1500 creat finish===="); + try { + appAccountManager.setAppAccess(); + } catch(err) { + console.debug("====>ActsAccountErrCode_1500 setAppAccess catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_1500 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_1600 + * @tc.name : setAppAccess promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_1600', 0, async function (done) { + console.debug("====>ActsAccountErrCode_1600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_1600 creat finish===="); + try { + appAccountManager.setAppAccess(123456, "test_owner", false); + } catch(err) { + console.debug("====>ActsAccountErrCode_1600 setAppAccess catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_1600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_1610 + * @tc.name : setAppAccess promise + * @tc.desc : test the type of parameters does not match(bundlenameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_1610', 0, async function (done) { + console.debug("====>ActsAccountErrCode_1610 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_1610 creat finish===="); + try { + appAccountManager.setAppAccess("test_name", 12345, false); + } catch(err) { + console.debug("====>ActsAccountErrCode_1610 setAppAccess catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_1610 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_1620 + * @tc.name : setAppAccess promise + * @tc.desc : test the type of parameters does not match(isAccessibleä¸åŒ¹é…) + */ + it('ActsAccountErrCode_1620', 0, async function (done) { + console.debug("====>ActsAccountErrCode_1620 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_1620 creat finish===="); + try { + appAccountManager.setAppAccess("test_name", "test_owner", "123"); + } catch(err) { + console.debug("====>ActsAccountErrCode_1620 setAppAccess catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_1620 end===="); + done(); + } + }); + + //checkDataSyncEnabled + /* + * @tc.number : ActsAccountErrCode_1700 + * @tc.name : checkDataSyncEnabled callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_1700', 0, async function (done) { + console.debug("====>ActsAccountErrCode_1700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_1700 creat finish===="); + try { + appAccountManager.checkDataSyncEnabled((err, data)=>{ + console.debug("====>ActsAccountErrCode_1700 checkDataSyncEnabled callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_1700 checkDataSyncEnabled catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_1700 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_1800 + * @tc.name : checkDataSyncEnabled callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_1800', 0, async function (done) { + console.debug("====>ActsAccountErrCode_1800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_1800 creat finish===="); + try { + appAccountManager.checkDataSyncEnabled(123456, (err, data)=>{ + console.debug("====>ActsAccountErrCode_1800 checkDataSyncEnabled callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_1800 checkDataSyncEnabled catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_1800 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_1810 + * @tc.name : checkDataSyncEnabled callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_1810', 0, async function (done) { + console.debug("====>ActsAccountErrCode_1810 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_1810 creat finish===="); + try { + appAccountManager.checkDataSyncEnabled("test_name", 123456); + } catch(err) { + console.debug("====>ActsAccountErrCode_1810 checkDataSyncEnabled catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_1810 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_1900 + * @tc.name : checkDataSyncEnabled promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_1900', 0, async function (done) { + console.debug("====>ActsAccountErrCode_1900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_1900 creat finish===="); + try { + appAccountManager.checkDataSyncEnabled(); + } catch(err) { + console.debug("====>ActsAccountErrCode_1900 checkDataSyncEnabled catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_1900 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_2000 + * @tc.name : checkDataSyncEnabled promise + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_2000', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2000 creat finish===="); + try { + appAccountManager.checkDataSyncEnabled(123456); + } catch(err) { + console.debug("====>ActsAccountErrCode_2000 checkDataSyncEnabled catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2000 end===="); + done(); + } + }); + + //setCredential + /* + * @tc.number : ActsAccountErrCode_2100 + * @tc.name : setCredential callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_2100', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2100 creat finish===="); + try { + appAccountManager.setCredential((err)=>{ + console.debug("====>ActsAccountErrCode_2100 setCredential callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_2100 setCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2100 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_2200 + * @tc.name : setCredential callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_2200', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2200 creat finish===="); + try { + appAccountManager.setCredential(123456, "test_credential_type", "test_credential", (err)=>{ + console.debug("====>ActsAccountErrCode_2200 setCredential callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_2200 setCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2200 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_2210 + * @tc.name : setCredential callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_2210', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2210 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2210 creat finish===="); + try { + appAccountManager.setCredential("test_name", "test_credential_type", "test_credential", 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_2210 setCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2210 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_2300 + * @tc.name : setCredential promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_2300', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2300 creat finish===="); + try { + appAccountManager.setCredential(); + } catch(err) { + console.debug("====>ActsAccountErrCode_2300 setCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2300 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_2400 + * @tc.name : setCredential promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_2400', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2400 creat finish===="); + try { + appAccountManager.setCredential(123456, "test_credential_type", "test_credential"); + } catch(err) { + console.debug("====>ActsAccountErrCode_2400 setCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_2410 + * @tc.name : setCredential promise + * @tc.desc : test the type of parameters does not match(credentialTypeä¸åŒ¹é…) + */ + it('ActsAccountErrCode_2410', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2410 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2410 creat finish===="); + try { + appAccountManager.setCredential("test_name", 12345, "test_credential"); + } catch(err) { + console.debug("====>ActsAccountErrCode_2410 setCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2410 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_2420 + * @tc.name : setCredential promise + * @tc.desc : test the type of parameters does not match(credentialä¸åŒ¹é…) + */ + it('ActsAccountErrCode_2420', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2420 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2420 creat finish===="); + try { + appAccountManager.setCredential("test_name", "test_credential_type", 12345); + } catch(err) { + console.debug("====>ActsAccountErrCode_2420 setCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2420 end===="); + done(); + } + }); + + //setDataSyncEnabled + /* + * @tc.number : ActsAccountErrCode_2500 + * @tc.name : setDataSyncEnabled callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_2500', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2500 creat finish===="); + try { + appAccountManager.setDataSyncEnabled((err)=>{ + console.debug("====>ActsAccountErrCode_2500 setDataSyncEnabled callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_2500 setDataSyncEnabled catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2500 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_2600 + * @tc.name : setDataSyncEnabled callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_2600', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2600 creat finish===="); + try { + appAccountManager.setDataSyncEnabled(123456, false, (err)=>{ + console.debug("====>ActsAccountErrCode_2600 setDataSyncEnabled callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_2600 setDataSyncEnabled catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_2610 + * @tc.name : setDataSyncEnabled callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_2610', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2610 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2610 creat finish===="); + try { + appAccountManager.setDataSyncEnabled("test_name", false, 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_2610 setDataSyncEnabled catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2610 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_2700 + * @tc.name : setDataSyncEnabled promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_2700', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2700 creat finish===="); + try { + appAccountManager.setDataSyncEnabled(); + } catch(err) { + console.debug("====>ActsAccountErrCode_2700 setDataSyncEnabled catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2700 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_2800 + * @tc.name : setDataSyncEnabled promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_2800', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2800 creat finish===="); + try { + appAccountManager.setDataSyncEnabled(123456, false); + } catch(err) { + console.debug("====>ActsAccountErrCode_2800 setDataSyncEnabled catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2800 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_2810 + * @tc.name : setDataSyncEnabled promise + * @tc.desc : test the type of parameters does not match(isEnableä¸åŒ¹é…) + */ + it('ActsAccountErrCode_2810', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2810 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2810 creat finish===="); + try { + appAccountManager.setDataSyncEnabled("test_name", "false"); + } catch(err) { + console.debug("====>ActsAccountErrCode_2810 setDataSyncEnabled catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2810 end===="); + done(); + } + }); + + //setCustomData + /* + * @tc.number : ActsAccountErrCode_2900 + * @tc.name : setCustomData callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_2900', 0, async function (done) { + console.debug("====>ActsAccountErrCode_2900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_2900 creat finish===="); + try { + appAccountManager.setCustomData((err)=>{ + console.debug("====>ActsAccountErrCode_2900 setCustomData callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_2900 setCustomData catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_2900 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_3000 + * @tc.name : setCustomData callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_3000', 0, async function (done) { + console.debug("====>ActsAccountErrCode_3000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_3000 creat finish===="); + try { + appAccountManager.setCustomData(123456, "test_key", "test_value", (err)=>{ + console.debug("====>ActsAccountErrCode_3000 setCustomData callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_3000 setCustomData catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_3000 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_3010 + * @tc.name : setCustomData callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_3010', 0, async function (done) { + console.debug("====>ActsAccountErrCode_3010 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_3010 creat finish===="); + try { + appAccountManager.setCustomData("test_name", "test_key", "test_value", 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_3010 setCustomData catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_3010 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_3100 + * @tc.name : setCustomData promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_3100', 0, async function (done) { + console.debug("====>ActsAccountErrCode_3100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_3100 creat finish===="); + try { + appAccountManager.setCustomData(); + } catch(err) { + console.debug("====>ActsAccountErrCode_3100 setCustomData catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_3100 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_3200 + * @tc.name : setCustomData promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_3200', 0, async function (done) { + console.debug("====>ActsAccountErrCode_3200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_3200 creat finish===="); + try { + appAccountManager.setCustomData(123456, "test_key", "test_value"); + } catch(err) { + console.debug("====>ActsAccountErrCode_3200 setCustomData catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_3200 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_3210 + * @tc.name : setCustomData promise + * @tc.desc : test the type of parameters does not match(keyä¸åŒ¹é…) + */ + it('ActsAccountErrCode_3210', 0, async function (done) { + console.debug("====>ActsAccountErrCode_3210 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_3210 creat finish===="); + try { + appAccountManager.setCustomData("test_name", 12345, "test_value"); + } catch(err) { + console.debug("====>ActsAccountErrCode_3210 setCustomData catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_3210 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_3220 + * @tc.name : setCustomData promise + * @tc.desc : test the type of parameters does not match(valueä¸åŒ¹é…) + */ + it('ActsAccountErrCode_3220', 0, async function (done) { + console.debug("====>ActsAccountErrCode_3220 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_3220 creat finish===="); + try { + appAccountManager.setCustomData("test_name", "test_key", 12345); + } catch(err) { + console.debug("====>ActsAccountErrCode_3220 setCustomData catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_3220 end===="); + done(); + } + }); + + //getAllAccounts + /* + * @tc.number : ActsAccountErrCode_3300 + * @tc.name : getAllAccounts callback + * @tc.desc : test the type of parameters does not match + */ + + //getAccountsByOwner + /* + * @tc.number : ActsAccountErrCode_3500 + * @tc.name : getAccountsByOwner callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_3500', 0, async function (done) { + console.debug("====>ActsAccountErrCode_3500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_3500 creat finish===="); + try { + appAccountManager.getAccountsByOwner((err, data)=>{ + console.debug("====>ActsAccountErrCode_3500 getAccountsByOwner callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_3500 getAccountsByOwner catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_3500 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_3600 + * @tc.name : getAccountsByOwner callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_3600', 0, async function (done) { + console.debug("====>ActsAccountErrCode_3600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_3600 creat finish===="); + try { + appAccountManager.getAccountsByOwner(123456, (err, data)=>{ + console.debug("====>ActsAccountErrCode_3600 getAccountsByOwner callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_3600 getAccountsByOwner catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_3600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_3610 + * @tc.name : getAccountsByOwner callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_3610', 0, async function (done) { + console.debug("====>ActsAccountErrCode_3610 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_3610 creat finish===="); + try { + appAccountManager.getAccountsByOwner("test_owner", 1234) + } catch(err) { + console.debug("====>ActsAccountErrCode_3610 getAccountsByOwner catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_3610 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_3700 + * @tc.name : getAccountsByOwner promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_3700', 0, async function (done) { + console.debug("====>ActsAccountErrCode_3700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_3700 creat finish===="); + try { + appAccountManager.getAccountsByOwner(); + } catch(err) { + console.debug("====>ActsAccountErrCode_3700 getAccountsByOwner catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_3700 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_3800 + * @tc.name : getAccountsByOwner promise + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_3800', 0, async function (done) { + console.debug("====>ActsAccountErrCode_3800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_3800 creat finish===="); + try { + appAccountManager.getAccountsByOwner(123456); + } catch(err) { + console.debug("====>ActsAccountErrCode_3800 getAccountsByOwner catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_3800 end===="); + done(); + } + }); + + //getCredential + /* + * @tc.number : ActsAccountErrCode_3900 + * @tc.name : getCredential callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_3900', 0, async function (done) { + console.debug("====>ActsAccountErrCode_3900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_3900 creat finish===="); + try { + appAccountManager.getCredential((err, data)=>{ + console.debug("====>ActsAccountErrCode_3900 getCredential callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_3900 getCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_3900 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_4000 + * @tc.name : getCredential callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_4000', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4000 creat finish===="); + try { + appAccountManager.getCredential(123456, "test_credential_type", (err, data)=>{ + console.debug("====>ActsAccountErrCode_4000 getCredential callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_4000 getCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_4000 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_4010 + * @tc.name : getCredential callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_4010', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4010 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4010 creat finish===="); + try { + appAccountManager.getCredential("test_name", "test_credential_type", 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_4010 getCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_4010 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_4100 + * @tc.name : getCredential promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_4100', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4100 creat finish===="); + try { + appAccountManager.getCredential(); + } catch(err) { + console.debug("====>ActsAccountErrCode_4100 getCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_4100 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_4200 + * @tc.name : getCredential promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_4200', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4200 creat finish===="); + try { + appAccountManager.getCredential(123456, "test_credential_type"); + } catch(err) { + console.debug("====>ActsAccountErrCode_4200 getCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_4200 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_4210 + * @tc.name : getCredential promise + * @tc.desc : test the type of parameters does not match(credentialTypeä¸åŒ¹é…) + */ + it('ActsAccountErrCode_4210', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4210 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4210 creat finish===="); + try { + appAccountManager.getCredential("test_name", 12345); + } catch(err) { + console.debug("====>ActsAccountErrCode_4210 getCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_4210 end===="); + done(); + } + }); + + //getCustomData + /* + * @tc.number : ActsAccountErrCode_4300 + * @tc.name : getCustomData callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_4300', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4300 creat finish===="); + try { + appAccountManager.getCustomData((err, data)=>{ + console.debug("====>ActsAccountErrCode_4300 getCustomData callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_4300 getCustomData catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_4300 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_4400 + * @tc.name : getCustomData callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_4400', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4400 creat finish===="); + try { + appAccountManager.getCustomData(123456, "test_key", (err, data)=>{ + console.debug("====>ActsAccountErrCode_4400 getCustomData callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_4400 getCustomData catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_4400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_4410 + * @tc.name : getCustomData callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_4410', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4410 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4410 creat finish===="); + try { + appAccountManager.getCustomData("test_name", "test_key", 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_4410 getCustomData catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_4410 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_4500 + * @tc.name : getCustomData promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_4500', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4500 creat finish===="); + try { + appAccountManager.getCustomData(); + } catch(err) { + console.debug("====>ActsAccountErrCode_4500 getCustomData catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_4500 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_4600 + * @tc.name : getCustomData promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_4600', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4600 creat finish===="); + try { + appAccountManager.getCustomData(123456, "test_key"); + } catch(err) { + console.debug("====>ActsAccountErrCode_4600 getCustomData catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_4600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_4610 + * @tc.name : getCustomData promise + * @tc.desc : test the type of parameters does not match(keyä¸åŒ¹é…) + */ + it('ActsAccountErrCode_4610', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4610 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4610 creat finish===="); + try { + appAccountManager.getCustomData("test_name", 12345); + } catch(err) { + console.debug("====>ActsAccountErrCode_4610 getCustomData catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_4610 end===="); + done(); + } + }); + + + //getCustomDataSync + /* + * @tc.number : ActsAccountErrCode_4700 + * @tc.name : getCustomDataSync + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_4700', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4700 creat finish===="); + try { + appAccountManager.getCustomDataSync(123456, "test_key"); + } catch(err) { + console.debug("====>ActsAccountErrCode_4700 getCustomDataSync catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_4700 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_4710 + * @tc.name : getCustomDataSync + * @tc.desc : test the type of parameters does not match(keyä¸åŒ¹é…) + */ + it('ActsAccountErrCode_4710', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4710 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4710 creat finish===="); + try { + appAccountManager.getCustomDataSync("test_name", 12345); + } catch(err) { + console.debug("====>ActsAccountErrCode_4710 getCustomDataSync catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_4710 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_4800 + * @tc.name : getCustomDataSync + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_4800', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4800 creat finish===="); + try { + appAccountManager.getCustomDataSync(); + } catch(err) { + console.debug("====>ActsAccountErrCode_4800 getCustomDataSync catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_4800 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_4900 + * @tc.name : getCustomDataSync + * @tc.desc : test service error + */ + it('ActsAccountErrCode_4900', 0, async function (done) { + console.debug("====>ActsAccountErrCode_4900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_4900 creat finish===="); + try { + appAccountManager.getCustomDataSync("test_no_account", "test_key"); + } catch(err) { + console.debug("====>ActsAccountErrCode_4900 getCustomDataSync catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(12300003); + console.debug("====>ActsAccountErrCode_4900 end===="); + done(); + } + }); + + //auth + /* + * @tc.number : ActsAccountErrCode_5000 + * @tc.name : auth callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_5000', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5000 creat finish===="); + try { + appAccountManager.auth("test_name"); + } catch(err) { + console.debug("====>ActsAccountErrCode_5000 auth catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5000 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5100 + * @tc.name : auth callback + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_5100', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5100 creat finish===="); + try { + appAccountManager.auth(12346, "test_owner", "test_authtype", { + onResult: null, + onRequestRedirected: null + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_5100 auth catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5100 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5110 + * @tc.name : auth callback + * @tc.desc : test the type of parameters does not match(ownerä¸åŒ¹é…) + */ + it('ActsAccountErrCode_5110', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5110 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5110 creat finish===="); + try { + appAccountManager.auth("test_name", 12346, "test_authtype", { + onResult: null, + onRequestRedirected: null + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_5110 auth catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5110 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5120 + * @tc.name : auth callback + * @tc.desc : test the type of parameters does not match(authtypeä¸åŒ¹é…) + */ + it('ActsAccountErrCode_5120', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5120 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5120 creat finish===="); + try { + appAccountManager.auth("test_name", "test_owner", 123456, { + onResult: null, + onRequestRedirected: null + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_5120 auth catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5120 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5130 + * @tc.name : auth callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_5130', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5130 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5130 creat finish===="); + try { + appAccountManager.auth("test_name", "test_owner", 123456, "callback"); + } catch(err) { + console.debug("====>ActsAccountErrCode_5130 auth catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5130 end===="); + done(); + } + }); + + //getAuthToken + /* + * @tc.number : ActsAccountErrCode_5200 + * @tc.name : getAuthToken callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_5200', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5200 creat finish===="); + try { + appAccountManager.getAuthToken((err, data)=>{ + console.debug("====>ActsAccountErrCode_5200 getAuthToken callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_5200 getAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5200 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5300 + * @tc.name : getAuthToken callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_5300', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5300 creat finish===="); + try { + appAccountManager.getAuthToken("test_name", "test_owner", 12345, (err, data)=>{ + console.debug("====>ActsAccountErrCode_5300 getAuthToken callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_5300 getAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5300 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5310 + * @tc.name : getAuthToken callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_5310', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5310 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5310 creat finish===="); + try { + appAccountManager.getAuthToken("test_name", "test_owner", "test_authType", 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_5310 getAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5310 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5400 + * @tc.name : getAuthToken promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_5400', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5400 creat finish===="); + try { + var authToken = appAccountManager.getAuthToken(); + } catch(err) { + console.debug("====>ActsAccountErrCode_5400 getAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5500 + * @tc.name : getAuthToken promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_5500', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5500 creat finish===="); + try { + var authToken = appAccountManager.getAuthToken(12345, "test_owner", "test_authtype"); + } catch(err) { + console.debug("====>ActsAccountErrCode_5500 getAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5500 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5510 + * @tc.name : getAuthToken promise + * @tc.desc : test the type of parameters does not match(ownerä¸åŒ¹é…) + */ + it('ActsAccountErrCode_5510', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5510 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5510 creat finish===="); + try { + var authToken = appAccountManager.getAuthToken("test_name", 12345, "test_authType"); + } catch(err) { + console.debug("====>ActsAccountErrCode_5510 getAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5510 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5520 + * @tc.name : getAuthToken promise + * @tc.desc : test the type of parameters does not match(ownerä¸åŒ¹é…) + */ + it('ActsAccountErrCode_5520', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5520 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5520 creat finish===="); + try { + var authToken = appAccountManager.getAuthToken("test_name", "test_owner", 12345); + } catch(err) { + console.debug("====>ActsAccountErrCode_5520 getAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5520 end===="); + done(); + } + }); + + //setAuthToken + /* + * @tc.number : ActsAccountErrCode_5600 + * @tc.name : setAuthToken callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_5600', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5600 creat finish===="); + try { + appAccountManager.setAuthToken((err)=>{ + console.debug("====>ActsAccountErrCode_5600 setAuthToken callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_5600 setAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5700 + * @tc.name : setAuthToken callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_5700', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5700 creat finish===="); + try { + appAccountManager.setAuthToken("test_name", 123456, "test_token", (err)=>{ + console.debug("====>ActsAccountErrCode_5700 setAuthToken callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_5700 setAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5700 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5710 + * @tc.name : setAuthToken callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_5710', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5710 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5710 creat finish===="); + try { + appAccountManager.setAuthToken("test_name", "test_authType", "test_token", 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_5710 setAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5710 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5400 + * @tc.name : setAuthToken promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_5800', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5800 creat finish===="); + try { + appAccountManager.setAuthToken(); + } catch(err) { + console.debug("====>ActsAccountErrCode_5800 setAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5800 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5900 + * @tc.name : setAuthToken promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_5900', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5900 creat finish===="); + try { + appAccountManager.setAuthToken(12345, "test_authType", "test_token"); + } catch(err) { + console.debug("====>ActsAccountErrCode_5900 setAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5900 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5910 + * @tc.name : setAuthToken promise + * @tc.desc : test the type of parameters does not match(authTypeä¸åŒ¹é…) + */ + it('ActsAccountErrCode_5910', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5910 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5910 creat finish===="); + try { + appAccountManager.setAuthToken("test_name", 123456, "test_token"); + } catch(err) { + console.debug("====>ActsAccountErrCode_5910 setAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5910 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_5920 + * @tc.name : setAuthToken promise + * @tc.desc : test the type of parameters does not match(tokenä¸åŒ¹é…) + */ + it('ActsAccountErrCode_5920', 0, async function (done) { + console.debug("====>ActsAccountErrCode_5920 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_5920 creat finish===="); + try { + appAccountManager.setAuthToken("test_name", "test_authType", 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_5920 setAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_5920 end===="); + done(); + } + }); + + //deleteAuthToken + /* + * @tc.number : ActsAccountErrCode_6000 + * @tc.name : deleteAuthToken callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_6000', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6000 creat finish===="); + try { + appAccountManager.deleteAuthToken((err)=>{ + console.debug("====>ActsAccountErrCode_6000 deleteAuthToken callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_6000 deleteAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6000 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6100 + * @tc.name : deleteAuthToken callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_6100', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6100 creat finish===="); + try { + appAccountManager.deleteAuthToken("test_name", "test_owner", 123456, "test_token", (err)=>{ + console.debug("====>ActsAccountErrCode_6100 deleteAuthToken callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_6100 deleteAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6100 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6110 + * @tc.name : deleteAuthToken callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_6110', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6110 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6110 creat finish===="); + try { + appAccountManager.deleteAuthToken("test_name", "test_owner", "test_authType", "test_token", 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_6110 deleteAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6110 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6200 + * @tc.name : deleteAuthToken promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_6200', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6200 creat finish===="); + try { + appAccountManager.deleteAuthToken(); + } catch(err) { + console.debug("====>ActsAccountErrCode_6200 deleteAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6200 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6300 + * @tc.name : deleteAuthToken promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_6300', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6300 creat finish===="); + try { + appAccountManager.deleteAuthToken(1234, "test_owner", "test_authType", "test_token"); + } catch(err) { + console.debug("====>ActsAccountErrCode_6300 deleteAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6300 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6310 + * @tc.name : deleteAuthToken promise + * @tc.desc : test the type of parameters does not match(ownerä¸åŒ¹é…) + */ + it('ActsAccountErrCode_6310', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6310 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6310 creat finish===="); + try { + appAccountManager.deleteAuthToken("test_name", 123456, "test_authType", "test_token"); + } catch(err) { + console.debug("====>ActsAccountErrCode_6310 deleteAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6310 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6320 + * @tc.name : deleteAuthToken promise + * @tc.desc : test the type of parameters does not match(authTypeä¸åŒ¹é…) + */ + it('ActsAccountErrCode_6320', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6320 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6320 creat finish===="); + try { + appAccountManager.deleteAuthToken("test_name", "test_owner", 1234, "test_token"); + } catch(err) { + console.debug("====>ActsAccountErrCode_6320 deleteAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6320 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6330 + * @tc.name : deleteAuthToken promise + * @tc.desc : test the type of parameters does not match(tokenä¸åŒ¹é…) + */ + it('ActsAccountErrCode_6330', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6330 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6330 creat finish===="); + try { + appAccountManager.deleteAuthToken("test_name", "test_owner", "test_authType", 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_6330 deleteAuthToken catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6330 end===="); + done(); + } + }); + + //setAuthTokenVisibility + /* + * @tc.number : ActsAccountErrCode_6000 + * @tc.name : setAuthTokenVisibility callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_6400', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6400 creat finish===="); + try { + appAccountManager.setAuthTokenVisibility((err)=>{ + console.debug("====>ActsAccountErrCode_6400 setAuthTokenVisibility callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_6400 setAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6500 + * @tc.name : setAuthTokenVisibility callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_6500', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6500 creat finish===="); + try { + appAccountManager.setAuthTokenVisibility("test_name", "test_authType", 123456, true, (err)=>{ + console.debug("====>ActsAccountErrCode_6500 setAuthTokenVisibility callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_6500 setAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6500 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6510 + * @tc.name : setAuthTokenVisibility callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_6510', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6510 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6510 creat finish===="); + try { + appAccountManager.setAuthTokenVisibility("test_name", "test_authType", "test_bundleName", true, 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_6510 setAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6510 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6600 + * @tc.name : setAuthTokenVisibility promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_6600', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6600 creat finish===="); + try { + appAccountManager.setAuthTokenVisibility(); + } catch(err) { + console.debug("====>ActsAccountErrCode_6600 setAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6700 + * @tc.name : setAuthTokenVisibility promise + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_6700', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6700 creat finish===="); + try { + appAccountManager.setAuthTokenVisibility("test_name", "test_authType", 123456, true); + } catch(err) { + console.debug("====>ActsAccountErrCode_6700 setAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6700 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6710 + * @tc.name : setAuthTokenVisibility promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_6710', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6710 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6710 creat finish===="); + try { + appAccountManager.setAuthTokenVisibility(12345, "test_authType", "test_bundleName", true); + } catch(err) { + console.debug("====>ActsAccountErrCode_6710 setAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6710 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6710 + * @tc.name : setAuthTokenVisibility promise + * @tc.desc : test the type of parameters does not match(authTypeä¸åŒ¹é…) + */ + it('ActsAccountErrCode_6720', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6720 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6720 creat finish===="); + try { + appAccountManager.setAuthTokenVisibility("test_name", 1234, "test_bundleName", true); + } catch(err) { + console.debug("====>ActsAccountErrCode_6720 setAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6720 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6720 + * @tc.name : setAuthTokenVisibility promise + * @tc.desc : test the type of parameters does not match(bundleNameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_6730', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6730 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6730 creat finish===="); + try { + appAccountManager.setAuthTokenVisibility("test_name", "test_authType", 123456, true); + } catch(err) { + console.debug("====>ActsAccountErrCode_6730 setAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6730 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6730 + * @tc.name : setAuthTokenVisibility promise + * @tc.desc : test the type of parameters does not match(isVisibleä¸åŒ¹é…) + */ + it('ActsAccountErrCode_6740', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6740 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6740 creat finish===="); + try { + appAccountManager.setAuthTokenVisibility("test_name", "test_authType", "test_bundleName", "231"); + } catch(err) { + console.debug("====>ActsAccountErrCode_6740 setAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6740 end===="); + done(); + } + }); + + + + //getAllAuthTokens + /* + * @tc.number : ActsAccountErrCode_6800 + * @tc.name : getAllAuthTokens callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_6800', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6800 creat finish===="); + try { + appAccountManager.getAllAuthTokens("test_name", (err, data)=>{ + console.debug("====>ActsAccountErrCode_6800 getAllAuthTokens callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_6800 getAllAuthTokens catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6800 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6900 + * @tc.name : getAllAuthTokens callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_6900', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6900 creat finish===="); + try { + appAccountManager.getAllAuthTokens("test_name", 123456, (err, data)=>{ + console.debug("====>ActsAccountErrCode_6900 getAllAuthTokens callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_6900 getAllAuthTokens catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6900 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6910 + * @tc.name : getAllAuthTokens callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_6910', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6910 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_6910 creat finish===="); + try { + appAccountManager.getAllAuthTokens("test_name", "test_owner", 124); + } catch(err) { + console.debug("====>ActsAccountErrCode_6910 getAllAuthTokens catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_6910 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_7000 + * @tc.name : getAllAuthTokens promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_7000', 0, async function (done) { + console.debug("====>ActsAccountErrCode_7000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_7000 creat finish===="); + try { + var authTokenInfo = appAccountManager.getAllAuthTokens("test_name"); + expect().assertFail(); + done(); + } catch(err) { + console.debug("====>ActsAccountErrCode_7000 getAllAuthTokens catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_7000 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_7100 + * @tc.name : getAllAuthTokens promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_7100', 0, async function (done) { + console.debug("====>ActsAccountErrCode_7100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_7100 creat finish===="); + try { + var authTokenInfo = appAccountManager.getAllAuthTokens(123456, "test_owner"); + expect().assertFail(); + done(); + } catch(err) { + console.debug("====>ActsAccountErrCode_7100 getAllAuthTokens catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_7100 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_7110 + * @tc.name : getAllAuthTokens promise + * @tc.desc : test the type of parameters does not match(ownerä¸åŒ¹é…) + */ + it('ActsAccountErrCode_7110', 0, async function (done) { + console.debug("====>ActsAccountErrCode_7110 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_7110 creat finish===="); + try { + var authTokenInfo = appAccountManager.getAllAuthTokens("test_name", 123456); + expect().assertFail(); + done(); + } catch(err) { + console.debug("====>ActsAccountErrCode_7110 getAllAuthTokens catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_7110 end===="); + done(); + } + }); + + //getAuthList + /* + * @tc.number : ActsAccountErrCode_7200 + * @tc.name : getAuthList callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_7200', 0, async function (done) { + console.debug("====>ActsAccountErrCode_7200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_7200 creat finish===="); + try { + appAccountManager.getAuthList("test_name", (err, data)=>{ + console.debug("====>ActsAccountErrCode_7200 getAuthList callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_7200 getAuthList catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_7200 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_7300 + * @tc.name : getAuthList callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_7300', 0, async function (done) { + console.debug("====>ActsAccountErrCode_7300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_7300 creat finish===="); + try { + appAccountManager.getAuthList("test_name", 123456, (err, data)=>{ + console.debug("====>ActsAccountErrCode_7300 getAuthList callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_7300 getAuthList catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_7300 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_7310 + * @tc.name : getAuthList callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_7310', 0, async function (done) { + console.debug("====>ActsAccountErrCode_7310 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_7310 creat finish===="); + try { + appAccountManager.getAuthList("test_name", "test_authType", 123456); + } catch(err) { + console.debug("====>ActsAccountErrCode_7310 getAuthList catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_7310 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_7400 + * @tc.name : getAuthList promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_7400', 0, async function (done) { + console.debug("====>ActsAccountErrCode_7400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_7400 creat finish===="); + try { + var authList = appAccountManager.getAuthList("test_name"); + expect().assertFail(); + done(); + } catch(err) { + console.debug("====>ActsAccountErrCode_7400 getAuthList catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_7400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_7500 + * @tc.name : getAuthList promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_7500', 0, async function (done) { + console.debug("====>ActsAccountErrCode_7500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_7500 creat finish===="); + try { + var authList = appAccountManager.getAuthList(123456, "test_authType"); + expect().assertFail(); + done(); + } catch(err) { + console.debug("====>ActsAccountErrCode_7500 getAuthList catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_7500 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_7510 + * @tc.name : getAuthList promise + * @tc.desc : test the type of parameters does not match(authTypeä¸åŒ¹é…) + */ + it('ActsAccountErrCode_7510', 0, async function (done) { + console.debug("====>ActsAccountErrCode_7510 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_7510 creat finish===="); + try { + var authList = appAccountManager.getAuthList("test_name", 123456); + expect().assertFail(); + done(); + } catch(err) { + console.debug("====>ActsAccountErrCode_7510 getAuthList catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_7510 end===="); + done(); + } + }); + + //getAuthCallback + /* + * @tc.number : ActsAccountErrCode_7600 + * @tc.name : getAuthCallback callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_7600', 0, async function (done) { + console.debug("====>ActsAccountErrCode_7600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_7600 creat finish===="); + try { + appAccountManager.getAuthCallback((err, databack)=>{ + console.debug("====>ActsAccountErrCode_7600 getAuthCallback callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_7600 getAuthCallback catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_7600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_7700 + * @tc.name : getAuthCallback callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_7700', 0, async function (done) { + console.debug("====>ActsAccountErrCode_7700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_7700 creat finish===="); + try { + appAccountManager.getAuthCallback(123456, (err, data)=>{ + console.debug("====>ActsAccountErrCode_7700 getAuthCallback callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_7700 getAuthCallback catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_7700 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_7710 + * @tc.name : getAuthCallback callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_7710', 0, async function (done) { + console.debug("====>ActsAccountErrCode_7710 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_7710 creat finish===="); + try { + appAccountManager.getAuthCallback("test_sessionId", 123456); + } catch(err) { + console.debug("====>ActsAccountErrCode_7710 getAuthCallback catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_7710 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_7800 + * @tc.name : getAuthCallback promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_7800', 0, async function (done) { + console.debug("====>ActsAccountErrCode_7800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_7800 creat finish===="); + try { + var authCallback = appAccountManager.getAuthCallback(); + expect().assertFail(); + done(); + } catch(err) { + console.debug("====>ActsAccountErrCode_7800 getAuthCallback catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_7800 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_7900 + * @tc.name : getAuthCallback promise + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_7900', 0, async function (done) { + console.debug("====>ActsAccountErrCode_7900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_7900 creat finish===="); + try { + var authCallback = appAccountManager.getAuthCallback(123456); + expect().assertFail(); + done(); + } catch(err) { + console.debug("====>ActsAccountErrCode_7900 getAuthCallback catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_7900 end===="); + done(); + } + }); + + //queryAuthenticatorInfo + /* + * @tc.number : ActsAccountErrCode_8000 + * @tc.name : queryAuthenticatorInfo callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_8000', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8000 creat finish===="); + try { + appAccountManager.queryAuthenticatorInfo((err, authenticatorInfo)=>{ + console.debug("====>ActsAccountErrCode_8000 queryAuthenticatorInfo callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_8000 queryAuthenticatorInfo catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8000 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_8100 + * @tc.name : queryAuthenticatorInfo callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_8100', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8100 creat finish===="); + try { + appAccountManager.queryAuthenticatorInfo(123456, (err, authenticatorInfo)=>{ + console.debug("====>ActsAccountErrCode_8100 queryAuthenticatorInfo callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_8100 queryAuthenticatorInfo catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8100 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_8110 + * @tc.name : queryAuthenticatorInfo callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_8110', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8110 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8110 creat finish===="); + try { + appAccountManager.queryAuthenticatorInfo("test_owner", 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_8110 queryAuthenticatorInfo catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8110 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_8200 + * @tc.name : queryAuthenticatorInfo promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_8200', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8200 creat finish===="); + try { + var authenticatorInfo = appAccountManager.queryAuthenticatorInfo(); + expect().assertFail(); + done(); + } catch(err) { + console.debug("====>ActsAccountErrCode_8200 queryAuthenticatorInfo catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8200 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_8300 + * @tc.name : queryAuthenticatorInfo promise + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_8300', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8300 creat finish===="); + try { + var authenticatorInfo = appAccountManager.queryAuthenticatorInfo(123456); + expect().assertFail(); + done(); + } catch(err) { + console.debug("====>ActsAccountErrCode_8300 queryAuthenticatorInfo catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8300 end===="); + done(); + } + }); + + + //deleteCredential + /* + * @tc.number : ActsAccountErrCode_8400 + * @tc.name : deleteCredential callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_8400', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8400 creat finish===="); + try { + appAccountManager.deleteCredential("test_name", (err)=>{ + console.debug("====>ActsAccountErrCode_8400 deleteCredential callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_8400 deleteCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_8500 + * @tc.name : deleteCredential callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_8500', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8500 creat finish===="); + try { + appAccountManager.deleteCredential("test_name", 123456, (err)=>{ + console.debug("====>ActsAccountErrCode_8500 deleteCredential callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_8500 deleteCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8500 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_8510 + * @tc.name : deleteCredential callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_8510', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8510 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8510 creat finish===="); + try { + appAccountManager.deleteCredential("test_name", "test_credentialType", 122); + } catch(err) { + console.debug("====>ActsAccountErrCode_8510 deleteCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8510 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_8600 + * @tc.name : deleteCredential promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_8600', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8600 creat finish===="); + try { + appAccountManager.deleteCredential(); + expect().assertFail(); + done(); + } catch(err) { + console.debug("====>ActsAccountErrCode_8600 deleteCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_8700 + * @tc.name : deleteCredential promise + * @tc.desc : test the type of parameters does not match(credentialTypeä¸åŒ¹é…) + */ + it('ActsAccountErrCode_8700', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8700 creat finish===="); + try { + appAccountManager.deleteCredential("test_name", 123456); + expect().assertFail(); + done(); + } catch(err) { + console.debug("====>ActsAccountErrCode_8700 deleteCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8700 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_8710 + * @tc.name : deleteCredential promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_8710', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8710 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8710 creat finish===="); + try { + appAccountManager.deleteCredential(12345, "test_credentialType"); + expect().assertFail(); + done(); + } catch(err) { + console.debug("====>ActsAccountErrCode_8710 deleteCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8710 end===="); + done(); + } + }); + + //verifyCredential + /* + * @tc.number : ActsAccountErrCode_8800 + * @tc.name : verifyCredential callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_8800', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8800 creat finish===="); + try { + appAccountManager.verifyCredential("test_name", { + onResult:null, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountErrCode_8800 verifyCredential_onRequestContinued") + } + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_8800 verifyCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8800 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_8900 + * @tc.name : verifyCredential callback + * @tc.desc : test the type of parameters does not match(ownerä¸åŒ¹é…) + */ + it('ActsAccountErrCode_8900', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8900 creat finish===="); + try { + appAccountManager.verifyCredential("test_name", 123456, { + onResult:null, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountErrCode_8900 verifyCredential_onRequestContinued") + } + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_8900 verifyCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8900 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_8910 + * @tc.name : verifyCredential callback + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_8910', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8910 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8910 creat finish===="); + try { + appAccountManager.verifyCredential(12345, "test_owner", { + onResult:null, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountErrCode_8910 verifyCredential_onRequestContinued") + } + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_89100 verifyCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_89100 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_8920 + * @tc.name : verifyCredential callback + * @tc.desc : test the type of parameters does not match(optionä¸åŒ¹é…) + */ + it('ActsAccountErrCode_8920', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8920 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8920 creat finish===="); + try { + appAccountManager.verifyCredential("test_name", "test_owner", 1244, { + onResult:null, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountErrCode_8920 verifyCredential_onRequestContinued") + } + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_8920 verifyCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8920 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_8930 + * @tc.name : verifyCredential callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_8930', 0, async function (done) { + console.debug("====>ActsAccountErrCode_8930 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_8930 creat finish===="); + var options = {credentialType: "PIN", credential: "123456"} + try { + appAccountManager.verifyCredential("test_name", "test_owner", options, 1234); + } catch(err) { + console.debug("====>ActsAccountErrCode_8930 verifyCredential catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_8930 end===="); + done(); + } + }); + + + //setAuthenticatorProperties + /* + * @tc.number : ActsAccountErrCode_9000 + * @tc.name : setAuthenticatorProperties callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_9000', 0, async function (done) { + console.debug("====>ActsAccountErrCode_9000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_9000 creat finish===="); + try { + appAccountManager.setAuthenticatorProperties({ + onResult:null, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountErrCode_9000 setAuthenticatorProperties") + } + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_9000 setAuthenticatorProperties catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_9000 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_9100 + * @tc.name : setAuthenticatorProperties callback + * @tc.desc : test the type of parameters does not match(ownerä¸åŒ¹é…) + */ + it('ActsAccountErrCode_9100', 0, async function (done) { + console.debug("====>ActsAccountErrCode_9100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_9100 creat finish===="); + try { + appAccountManager.setAuthenticatorProperties(123456, { + onResult:null, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountErrCode_9100 setAuthenticatorProperties") + } + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_9100 setAuthenticatorProperties catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_9100 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_9110 + * @tc.name : setAuthenticatorProperties callback + * @tc.desc : test the type of parameters does not match(optionä¸åŒ¹é…) + */ + it('ActsAccountErrCode_9110', 0, async function (done) { + console.debug("====>ActsAccountErrCode_9110 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_9110 creat finish===="); + try { + appAccountManager.setAuthenticatorProperties("test_owner", 12345, { + onResult:null, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountErrCode_9110 setAuthenticatorProperties") + } + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_9110 setAuthenticatorProperties catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_9110 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_9120 + * @tc.name : setAuthenticatorProperties callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_9120', 0, async function (done) { + console.debug("====>ActsAccountErrCode_9120 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_9120 creat finish===="); + var options = {credentialType: "PIN", credential: "123456"} + try { + appAccountManager.setAuthenticatorProperties("test_owner", options, 124); + } catch(err) { + console.debug("====>ActsAccountErrCode_9120 setAuthenticatorProperties catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_9120 end===="); + done(); + } + }); + + //on + /* + * @tc.number : ActsAccountErrCode_9200 + * @tc.name : on callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_9200', 0, async function (done) { + console.debug("====>ActsAccountErrCode_9200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_9200 creat finish===="); + try { + appAccountManager.on('accountChange', function(data){ + console.debug("====>ActsAccountErrCode_9200 on catch err:" + JSON.stringify(data)); + }); + } catch(err) { + console.debug("====>ActsAccountErrCode_9200 on catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_9200 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_9300 + * @tc.name : on callback + * @tc.desc : test the type of parameters does not match(Array<owner>ä¸åŒ¹é…) + */ + it('ActsAccountErrCode_9300', 0, async function (done) { + console.debug("====>ActsAccountErrCode_9300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_9300 creat finish===="); + try { + appAccountManager.on('accountChange', 12356, function(data){ + console.debug("====>ActsAccountErrCode_9300 on catch err:" + JSON.stringify(data)); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_9300 on catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_9300 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_9400 + * @tc.name : on callback + * @tc.desc : test the type of parameters does not match(accountChangeä¸åŒ¹é…) + */ + it('ActsAccountErrCode_9400', 0, async function (done) { + console.debug("====>ActsAccountErrCode_9400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_9400 creat finish===="); + try { + appAccountManager.on(12345, ["test_owner"], function(data){ + console.debug("====>ActsAccountErrCode_9400 on catch err:" + JSON.stringify(data)); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_9400 on catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_9400 end===="); + done(); + } + }); + + //off + /* + * @tc.number : ActsAccountErrCode_9500 + * @tc.name : off callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_9500', 0, async function (done) { + console.debug("====>ActsAccountErrCode_9500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_9500 creat finish===="); + try { + appAccountManager.off(); + } catch(err) { + console.debug("====>ActsAccountErrCode_9500 off catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_9500 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_9600 + * @tc.name : off callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_9600', 0, async function (done) { + console.debug("====>ActsAccountErrCode_9600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_9600 creat finish===="); + try { + appAccountManager.off(123456); + } catch(err) { + console.debug("====>ActsAccountErrCode_9600 off catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_9600 end===="); + done(); + } + }); + + //checkAuthTokenVisibility + /* + * @tc.number : ActsAccountErrCode_6000 + * @tc.name : checkAuthTokenVisibility callback + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_9700', 0, async function (done) { + console.debug("====>ActsAccountErrCode_9700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_9700 creat finish===="); + try { + appAccountManager.checkAuthTokenVisibility((err)=>{ + console.debug("====>ActsAccountErrCode_9700 checkAuthTokenVisibility callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_9700 checkAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_9700 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_9800 + * @tc.name : checkAuthTokenVisibility callback + * @tc.desc : test the type of parameters does not match + */ + it('ActsAccountErrCode_9800', 0, async function (done) { + console.debug("====>ActsAccountErrCode_9800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_9800 creat finish===="); + try { + appAccountManager.checkAuthTokenVisibility("test_name", "test_authType", 123456, (err)=>{ + console.debug("====>ActsAccountErrCode_9800 checkAuthTokenVisibility callback err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + } catch(err) { + console.debug("====>ActsAccountErrCode_9800 checkAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_9800 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_9810 + * @tc.name : checkAuthTokenVisibility callback + * @tc.desc : test the type of parameters does not match(callbackä¸åŒ¹é…) + */ + it('ActsAccountErrCode_9810', 0, async function (done) { + console.debug("====>ActsAccountErrCode_9810 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_9810 creat finish===="); + try { + appAccountManager.checkAuthTokenVisibility("test_name", "test_authType", "test_bundleName", 12234); + } catch(err) { + console.debug("====>ActsAccountErrCode_9810 checkAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_9810 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6600 + * @tc.name : checkAuthTokenVisibility promise + * @tc.desc : test the number of parameters does not match + */ + it('ActsAccountErrCode_9900', 0, async function (done) { + console.debug("====>ActsAccountErrCode_9900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_9900 creat finish===="); + try { + var visibility = appAccountManager.checkAuthTokenVisibility("test_name"); + } catch(err) { + console.debug("====>ActsAccountErrCode_9900 checkAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_9900 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_10000 + * @tc.name : checkAuthTokenVisibility promise + * @tc.desc : test the type of parameters does not match(nameä¸åŒ¹é…) + */ + it('ActsAccountErrCode_10000', 0, async function (done) { + console.debug("====>ActsAccountErrCode_6700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_10000 creat finish===="); + try { + var visibility = appAccountManager.checkAuthTokenVisibility(12345, "test_authType", "test_bundleName"); + } catch(err) { + console.debug("====>ActsAccountErrCode_10000 checkAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_10000 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6710 + * @tc.name : checkAuthTokenVisibility promise + * @tc.desc : test the type of parameters does not match(authTypeä¸åŒ¹é…) + */ + it('ActsAccountErrCode_10010', 0, async function (done) { + console.debug("====>ActsAccountErrCode_10010 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_10010 creat finish===="); + try { + var visibility = appAccountManager.checkAuthTokenVisibility("test_name", 1234, "test_bundleName"); + } catch(err) { + console.debug("====>ActsAccountErrCode_10010 checkAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_10010 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrCode_6720 + * @tc.name : checkAuthTokenVisibility promise + * @tc.desc : test the type of parameters does not match(authTypeä¸åŒ¹é…) + */ + it('ActsAccountErrCode_10020', 0, async function (done) { + console.debug("====>ActsAccountErrCode_10020 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountErrCode_10020 creat finish===="); + try { + var visibility = appAccountManager.checkAuthTokenVisibility("test_name", "test_authType", 12345); + } catch(err) { + console.debug("====>ActsAccountErrCode_10020 checkAuthTokenVisibility catch err:" + JSON.stringify(err)); + expect(err.code).assertEqual(401); + console.debug("====>ActsAccountErrCode_10020 end===="); + done(); + } + }); + + }) +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/ErrPermission.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/ErrPermission.test.js new file mode 100644 index 000000000..a6f106173 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/ErrPermission.test.js @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import account from '@ohos.account.appAccount' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +const TIMEOUT = 5000; +const ERR_PERMISSION_DENIED = 201; +export default function ActsAccountErrPermission() { + describe('ActsAccountErrPermission', function () { + function sleep(delay) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) + } + beforeAll(async function (done) { + console.debug("====>beforeAll start===="); + await sleep(TIMEOUT); + console.debug("====>beforeAll end===="); + done(); + }); + + /* + * @tc.number : ActsAccountErrPermission_0100 + * @tc.name : setDataSyncEnabled callback + * @tc.desc : Set the added account to allow synchronization without permission + */ + it('ActsAccountErrPermission_0100', 0, async function (done) { + console.debug("====>ActsAccountErrPermission_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("syncenable_callback_setnopermission", (err)=>{ + console.debug("====>add account ActsAccountErrPermission_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setDataSyncEnabled("syncenable_callback_setnopermission", true, (err)=>{ + console.debug("====>setDataSyncEnabled 0100 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_PERMISSION_DENIED); + appAccountManager.removeAccount("syncenable_callback_setnopermission", (err)=>{ + console.debug("====>delete Account ActsAccountErrPermission_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountErrPermission_0100 end===="); + done(); + }); + }) + }); + }); + + /* + * @tc.number : ActsAccountErrPermission_0200 + * @tc.name : setDataSyncEnabled promise + * @tc.desc : Set the added account to allow synchronization without permission + */ + it('ActsAccountErrPermission_0200', 0, async function (done) { + console.debug("====>ActsAccountErrPermission_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAccountErrPermission_0200 start===="); + await appAccountManager.createAccount("syncenable_promise_setnopermission"); + console.debug("====>setDataSyncEnabled ActsAccountErrPermission_0200 start===="); + try{ + await appAccountManager.setDataSyncEnabled("syncenable_promise_setnopermission", true); + } + catch(err){ + console.debug("====>setDataSyncEnabled 0200 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_PERMISSION_DENIED); + console.debug("====>delete account ActsAccountErrPermission_0200 start===="); + await appAccountManager.removeAccount("syncenable_promise_setnopermission"); + console.debug("====>ActsAccountErrPermission_0200 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrPermission_0300 + * @tc.name : Check sync flag callback form + * @tc.desc : Check the added account synchronization without permission + */ + it('ActsAccountErrPermission_0300', 0, async function (done) { + console.debug("====>ActsAccountErrPermission_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("syncenable_callback_checknopermission", (err)=>{ + console.debug("====>add account ActsAccountErrPermission_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkDataSyncEnabled("syncenable_callback_checknopermission", (err, data)=>{ + console.debug("====>checkDataSyncEnable 0300 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_PERMISSION_DENIED); + appAccountManager.removeAccount("syncenable_callback_checknopermission", (err)=>{ + console.debug("====>delete Account ActsAccountErrPermission_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountErrPermission_0300 end===="); + done(); + }); + }) + }); + }); + + /* + * @tc.number : ActsAccountErrPermission_0400 + * @tc.name : Check sync flag promise form + * @tc.desc : Check the added account synchronization without permission + */ + it('ActsAccountErrPermission_0400', 0, async function (done) { + console.debug("====>ActsAccountErrPermission_0400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAccountErrPermission_0400 start===="); + await appAccountManager.createAccount("syncenable_promise_checknopermission"); + console.debug("====>checkDataSyncEnable ActsAccountErrPermission_0400 start===="); + try{ + var data = await appAccountManager.checkDataSyncEnabled("syncenable_promise_checknopermission"); + } + catch(err){ + console.debug("====>checkDataSyncEnable 0400 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_PERMISSION_DENIED); + await appAccountManager.removeAccount("syncenable_promise_checknopermission"); + console.debug("====>ActsAccountErrPermission_0400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrPermission_0500 + * @tc.name : getAllAccounts callback + * @tc.desc : This application gets authorization after adding a single account without permission + */ + it('ActsAccountErrPermission_0500', 0, async function (done) { + console.debug("====>ActsAccountErrPermission_0500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("accessibleAccount_callback_nopermission", (err)=>{ + console.debug("====> add account ActsAccountErrPermission_0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAccounts((err, data)=>{ + console.debug("====>getAllAccounts 0500 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_PERMISSION_DENIED); + appAccountManager.removeAccount("accessibleAccount_callback_nopermission", (err)=>{ + console.debug("====>delete Account ActsAccountErrPermission_0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountErrPermission_0500 end===="); + done(); + }) + }); + }); + }); + + /* + * @tc.number : ActsAccountErrPermission_0600 + * @tc.name : getAllAccounts promise + * @tc.desc : This application gets authorization after adding a single account without permission + */ + it('ActsAccountErrPermission_0600', 0, async function (done) { + console.debug("====>ActsAccountErrPermission_0600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAccountErrPermission_0600 start===="); + await appAccountManager.createAccount("accessibleAccount_promise_nopermission"); + console.debug("====>getAllAccounts 0600 start===="); + try{ + var data = await appAccountManager.getAllAccounts(); + } + catch(err){ + console.debug("====>getAllAccounts 0600 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_PERMISSION_DENIED); + await appAccountManager.removeAccount("accessibleAccount_promise_nopermission"); + console.debug("====>ActsAccountErrPermission_0600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountErrPermission_0700 + * @tc.name : getAccountsByOwner callback + * @tc.desc : This application gets its own application information after adding an account without permission + */ + it('ActsAccountErrPermission_0700', 0, async function (done) { + console.debug("====>ActsAccountErrPermission_0700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var selfBundle = "com.example.actsaccountoperatetest"; + appAccountManager.createAccount("getAll_callback_nopermission", (err)=>{ + console.debug("====>add account 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAccountsByOwner(selfBundle, (err, data)=>{ + console.debug("====>getAccountsByOwner 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + expect(data.length>0).assertEqual(true); + appAccountManager.removeAccount("getAll_callback_nopermission", (err)=>{ + console.debug("====>delete account 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountErrPermission_0700 end===="); + done(); + }); + }) + }); + }); + + /* + * @tc.number : ActsAccountErrPermission_0800 + * @tc.name : getAccountsByOwner promise + * @tc.desc : This application gets its own application information after adding an account without permission + */ + it('ActsAccountErrPermission_0800', 0, async function (done) { + console.debug("====>ActsAccountErrPermission_0800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var selfBundle = "com.example.actsaccountoperatetest"; + console.debug("====>add account 0800 start===="); + await appAccountManager.createAccount("getAll_promise_nopermission"); + console.debug("====>getAccountsByOwner 0800 start===="); + try{ + var data = await appAccountManager.getAccountsByOwner(selfBundle); + console.debug("====>getAll_promise_nopermission data:" + JSON.stringify(data)) + expect(data.length>0).assertEqual(true); + done(); + } + catch(err){ + console.error("====>getAccountsByOwner 0800 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_PERMISSION_DENIED); + await appAccountManager.removeAccount("getAll_promise_nopermission"); + console.debug("====>ActsAccountErrPermission_0800 end===="); + done(); + } + }); + }) +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/List.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/List.test.js new file mode 100644 index 000000000..edf602357 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/List.test.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ActsAccountCreateAccount from './CreateAccount.test.js' +import ActsAccountRemoveAccount from './RemoveAccount.test.js' +import ActsAccountSetAppAccess from './SetAppAccess.test.js' +import ActsAccountCustomData from './CustomData.test.js' +import ActsAppAccountCredential from './AccountCredential.test.js' +import ActsAccountAuthToken from './AuthToken.test.js' +import ActsAccountManager from './AccountManager.test.js' +import ActsAccountErrPermission from './ErrPermission.test.js' +import ActsAccountOnOff from './ChangeOnOff.js' +import ActsAccountAuthenticator from './Authenticator.test.js' +import ActsAccountErrCode from './ErrCode.test.js' +export default function testsuite() { + ActsAccountCreateAccount() + ActsAccountSetAppAccess() + ActsAccountCustomData() + ActsAccountManager() + ActsAppAccountCredential() + ActsAccountRemoveAccount() + ActsAccountErrPermission() + ActsAccountAuthToken() + ActsAccountOnOff() + ActsAccountAuthenticator() + ActsAccountErrCode() +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/RemoveAccount.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/RemoveAccount.test.js new file mode 100644 index 000000000..0a71ccc77 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/RemoveAccount.test.js @@ -0,0 +1,248 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import account from '@ohos.account.appAccount' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +const NAMELIMIT = 512; +const TIMEOUT = 5000; +const ERR_INVALID_PARAMETER = 12300002 +const ERR_ACCOUNT_NO_EXIST = 12300003 +const createAccountOptions = {customData:{age:'12'}} +export default function ActsAccountRemoveAccount() { + describe('ActsAccountRemoveAccount', function () { + function sleep(delay) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) + } + + beforeAll(async function (done) { + console.debug("====>beforeAll start===="); + await sleep(TIMEOUT); + console.debug("====>beforeAll end===="); + done(); + }); + + /* + * @tc.number : ActsAccountRemoveAccount_0100 + * @tc.name : Remove account callback form + * @tc.desc : Remove the added account in callback form + */ + it('ActsAccountRemoveAccount_0100', 0, async function (done) { + console.debug("====>ActsAccountRemoveAccount_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("removeAccount_name_callback_first", createAccountOptions, (err)=>{ + console.debug("====>add account ActsAccountRemoveAccount_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("removeAccount_name_callback_first", (err)=>{ + console.debug("====>delete Account ActsAccountRemoveAccount_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountRemoveAccount_0100 end===="); + done(); + }); + }); + }); + + /* + * @tc.number : ActsAccountRemoveAccount_0200 + * @tc.name : Remove account promise form + * @tc.desc : Remove the added account in promise form + */ + it('ActsAccountRemoveAccount_0200',0,async function (done){ + console.debug("====>ActsAccountRemoveAccount_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>add account ActsAccountcreateAccount_0200 start===="); + await appAccountManager.createAccount("removeAccount_name_promise_first",createAccountOptions); + try{ + await appAccountManager.removeAccount("removeAccount_name_promise_first"); + console.debug("====>ActsAccountRemoveAccount_0200 end===="); + done(); + } + catch(err){ + console.error("====>delete account ActsAccountRemoveAccount_0200 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + }); + + /* + * @tc.number : ActsAccountRemoveAccount_0300 + * @tc.name : Remove account callback form + * @tc.desc : Remove unadded account in callback form + */ + it('ActsAccountRemoveAccount_0300', 0, async function (done) { + console.debug("====>ActsAccountRemoveAccount_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.removeAccount("removeAccount_name_callback_second", (err)=>{ + console.debug("====>delete Account ActsAccountRemoveAccount_0300 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_ACCOUNT_NO_EXIST); + console.debug("====>ActsAccountRemoveAccount_0300 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsAccountRemoveAccount_0400 + * @tc.name : Remove account promise form + * @tc.desc : Remove unadded account in promise form + */ + it('ActsAccountRemoveAccount_0400', 0, async function(done){ + console.debug("====>ActsAccountRemoveAccount_0400 start===="); + var appAccountManager = account.createAppAccountManager(); + try{ + await appAccountManager.removeAccount("removeAccount_name_promise_second"); + } + catch(err){ + console.debug("====>delete account ActsAccountRemoveAccount_0400 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_ACCOUNT_NO_EXIST); + console.debug("====>ActsAccountRemoveAccount_0400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountRemoveAccount_0500 + * @tc.name : Remove account callback form + * @tc.desc : Remove the added account, the first time it can be deleted, the second time the deletion fails + */ + it('ActsAccountRemoveAccount_0500', 0, async function (done) { + console.debug("====>ActsAccountRemoveAccount_0500 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.createAccount("removeAccount_name_callback_third", createAccountOptions, (err)=>{ + console.debug("====>add account ActsAccountRemoveAccount_0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("removeAccount_name_callback_third", (err)=>{ + console.debug("====>delete account first time err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("removeAccount_name_callback_third", (err)=>{ + console.debug("====>delete Account second time err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_ACCOUNT_NO_EXIST); + console.debug("====>ActsAccountRemoveAccount_0500 end===="); + done(); + }); + }); + }); + }); + + /* + * @tc.number : ActsAccountRemoveAccount_0600 + * @tc.name : Remove account promise form + * @tc.desc : Remove the added account, the first time it can be deleted, the second time the deletion fails + */ + it('ActsAccountRemoveAccount_0600', 0, async function (done){ + console.debug("====>ActsAccountRemoveAccount_0600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>add account ActsAccountcreateAccount_0600 start===="); + await appAccountManager.createAccount("removeAccount_name_promise_third", createAccountOptions); + console.debug("====>delete Account first time ActsAccountRemoveAccount_0600 start===="); + await appAccountManager.removeAccount("removeAccount_name_promise_third"); + console.debug("====>delete Account second time ActsAccountRemoveAccount_0600 start===="); + try{ + await appAccountManager.removeAccount("removeAccount_name_promise_third"); + } + catch(err){ + console.debug("====>delete account ActsAccountRemoveAccount_0600 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_ACCOUNT_NO_EXIST); + console.debug("====>ActsAccountRemoveAccount_0600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountRemoveAccount_0700 + * @tc.name : Remove account callback form + * @tc.desc : Remove the account name exceeds the length limit of 512 characters + */ + it('ActsAccountRemoveAccount_0700',0, async function (done){ + console.debug("====>ActsAccountRemoveAccount_0700 start===="); + var nameLimit = ''; + for (var i = 0; i < NAMELIMIT + 1; i++) { + nameLimit += 't'; + } + var appAccountManager = account.createAppAccountManager(); + appAccountManager.removeAccount(nameLimit, (err)=>{ + console.debug("====>delete Account ActsAccountRemoveAccount_0700 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_INVALID_PARAMETER); + console.debug("====>ActsAccountRemoveAccount_0700 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsAccountRemoveAccount_0800 + * @tc.name : Remove account promise form + * @tc.desc : Remove the account name exceeds the length limit of 512 characters + */ + it('ActsAccountRemoveAccount_0800', 0, async function (done){ + console.debug("====>ActsAccountRemoveAccount_0800 start===="); + var nameLimit = ''; + for (var i = 0; i < NAMELIMIT + 1; i++) { + nameLimit += 'n'; + } + var appAccountManager = account.createAppAccountManager(); + console.debug("====>delete Account ActsAccountRemoveAccount_0800 start===="); + try{ + await appAccountManager.removeAccount(nameLimit); + } + catch(err){ + console.debug("====>delete account ActsAccountRemoveAccount_0800 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_INVALID_PARAMETER); + console.debug("====>ActsAccountRemoveAccount_0800 end===="); + done(); + } + }) + + /* + * @tc.number : ActsAccountRemoveAccount_0900 + * @tc.name : Remove account callback form + * @tc.desc : Remove the account name is an empty string + */ + it('ActsAccountRemoveAccount_0900',0, async function (done){ + console.debug("====>ActsAccountRemoveAccount_0900 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.removeAccount("", (err)=>{ + console.debug("====>delete Account ActsAccountRemoveAccount_0900 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_INVALID_PARAMETER); + console.debug("====>ActsAccountRemoveAccount_0900 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsAccountRemoveAccount_1000 + * @tc.name : Remove account promise form + * @tc.desc : Remove the account name is an empty string + */ + it('ActsAccountRemoveAccount_1000', 0, async function (done){ + console.debug("====>ActsAccountRemoveAccount_1000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>delete Account ActsAccountRemoveAccount_1000 start===="); + try{ + await appAccountManager.removeAccount(""); + } + catch(err){ + console.debug("====>delete account ActsAccountRemoveAccount_1000 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_INVALID_PARAMETER); + console.debug("====>ActsAccountRemoveAccount_1000 end===="); + done(); + } + }) + }) +} diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/SetAppAccess.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/SetAppAccess.test.js new file mode 100644 index 000000000..fc09f2e46 --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/SetAppAccess.test.js @@ -0,0 +1,569 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import account from '@ohos.account.appAccount' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +const TIMEOUT = 5000; +const STRCOUNT = 513; +const EACHTIMEOUT = 500; +const createAccountOptions = {customData:{age:'12'}} +export default function ActsAccountSetAppAccess() { + describe('ActsAccountSetAppAccess', function () { + function sleep(delay) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, delay) + }).then(() => { + console.info(`sleep #{time} over ...`) + }) + } + + beforeAll(async function (done) { + console.debug("====>beforeAll start===="); + await sleep(TIMEOUT); + console.debug("====>beforeAll end===="); + done(); + }) + + beforeEach(async function (done) { + console.debug("====>beforeEach enter===="); + await sleep(EACHTIMEOUT); + done(); + }) + + /* + * @tc.number : ActsAccountSetAppAccess_0100 + * @tc.name : enableAppAccess callback + * @tc.desc : Enable the app to access the app itself + */ + it('ActsAccountSetAppAccess_0100', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("AppAccess_callback_itself", createAccountOptions, (err)=>{ + console.debug("====>add account ActsAccountSetAppAccess_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAppAccess("AppAccess_callback_itself", "com.example.actsaccountappaccess", true, (err)=>{ + console.debug("====>enableAppAccess err:" + JSON.stringify(err)); + expect(err.code).assertEqual(12400001); + appAccountManager.removeAccount("AppAccess_callback_itself", (err)=>{ + console.debug("====>delete Account ActsAccountSetAppAccess_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountSetAppAccess_0100 end===="); + done(); + }); + }) + }) + }); + + /* + * @tc.number : ActsAccountSetAppAccess_0200 + * @tc.name : enableAppAccess promise + * @tc.desc : Enable the app to access the app itself + */ + it('ActsAccountSetAppAccess_0200', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsAccountSetAppAccess_0200 start===="); + await appAccountManager.createAccount("AppAccess_promise_itself", createAccountOptions); + console.debug("====>enableAppAccess ActsAccountSetAppAccess_0200 start===="); + try{ + await appAccountManager.setAppAccess("AppAccess_promise_itself", "com.example.actsaccountappaccess", true); + } + catch(err){ + console.debug("====>enableAppAccess 0200 err:" + JSON.stringify(err)); + expect(err.code).assertEqual(12400001); + console.debug("====>delete account ActsAccountSetAppAccess_0200 start===="); + await appAccountManager.removeAccount("AppAccess_promise_itself"); + console.debug("====>ActsAccountSetAppAccess_0200 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountSetAppAccess_0300 + * @tc.name : enableAppAccess callback + * @tc.desc : The enabled bundleName does not exist + */ + it('ActsAccountSetAppAccess_0300', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var nonExistBundle = "com.example.NonExistentBundleCallback"; + appAccountManager.createAccount("AppAccess_callback_NotExistBundle", createAccountOptions, (err)=>{ + console.debug("====>add account ActsAccountSetAppAccess_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAppAccess("AppAccess_callback_NotExistBundle", nonExistBundle, true, (err)=>{ + console.debug("====>enableAppAccess 0300 err:" + JSON.stringify(err)); + expect(err.code == 12400001).assertEqual(true); + appAccountManager.removeAccount("AppAccess_callback_NotExistBundle", (err)=>{ + console.debug("====>delete Account ActsAccountSetAppAccess_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountSetAppAccess_0300 end===="); + done(); + }); + }) + }) + }); + + /* + * @tc.number : ActsAccountSetAppAccess_0400 + * @tc.name : enableAppAccess promise + * @tc.desc : The enabled bundleName does not exist + */ + it('ActsAccountSetAppAccess_0400', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_0400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var nonExistBundle = "com.example.NonExistentBundlePromise"; + console.debug("====>add account ActsAccountSetAppAccess_0400 start===="); + await appAccountManager.createAccount("AppAccess_promise_NotExistBundle", createAccountOptions); + console.debug("====>enableAppAccess ActsAccountSetAppAccess_0400 start===="); + try{ + await appAccountManager.setAppAccess("AppAccess_promise_NotExistBundle", nonExistBundle, true); + } + catch(err){ + console.error("====>enableAppAccess ActsAccountSetAppAccess_0400 err:" + JSON.stringify(err)); + expect(err.code == 12400001).assertEqual(true); + console.debug("====>delete account ActsAccountSetAppAccess_0400 start===="); + await appAccountManager.removeAccount("AppAccess_promise_NotExistBundle"); + console.debug("====>ActsAccountSetAppAccess_0400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountSetAppAccess_0500 + * @tc.name : enableAppAccess callback + * @tc.desc : The enabled account name does not exist + */ + it('ActsAccountSetAppAccess_0500', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_0500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var enableBundle = "com.example.actsaccountsceneappaccess"; + var nonExistAccount = "NonExistentAccountCallback"; + appAccountManager.setAppAccess(nonExistAccount, enableBundle, true, (err)=>{ + console.debug("====>enableAppAccess 0500 err:" + JSON.stringify(err)); + expect(err.code == 12300003).assertEqual(true); + console.debug("====>ActsAccountSetAppAccess_0500 end===="); + done(); + }) + }); + + /* + * @tc.number : ActsAccountSetAppAccess_0600 + * @tc.name : enableAppAccess promise + * @tc.desc : The enabled account name does not exist + */ + it('ActsAccountSetAppAccess_0600', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_0600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var enableBundle = "com.example.actsaccountsceneappaccess"; + var nonExistAccount = "NonExistentAccountPromise"; + console.debug("====>enableAppAccess ActsAccountSetAppAccess_0600 start===="); + try{ + await appAccountManager.setAppAccess("NonExistentAccountPromise", enableBundle, true); + } + catch(err){ + console.debug("====>enableAppAccess 0600 err:" + JSON.stringify(err)); + expect(err.code == 12300003).assertEqual(true); + console.debug("====>ActsAccountSetAppAccess_0600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountSetAppAccess_0700 + * @tc.name : enableAppAccess disableAppAccess callback + * @tc.desc : Cancel the authorization after authorizing the account to another app + */ + it('ActsAccountSetAppAccess_0700', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_0700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var enableBundle = "com.example.actsaccountsceneappaccess"; + appAccountManager.createAccount("AppAccess_callback_account", (err)=>{ + console.debug("====>add account ActsAccountSetAppAccess_0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAppAccess("AppAccess_callback_account", enableBundle, true, (err)=>{ + console.debug("====>enableAppAccess 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAppAccess("AppAccess_callback_account", enableBundle, false, (err)=>{ + console.debug("====>disableAppAccess 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null) + appAccountManager.removeAccount("AppAccess_callback_account", (err)=>{ + console.debug("====>delete Account ActsAccountSetAppAccess_0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountSetAppAccess_0700 end===="); + done(); + }); + }) + }) + }) + }); + + /* + * @tc.number : ActsAccountSetAppAccess_0800 + * @tc.name : enableAppAccess disableAppAccess promise + * @tc.desc : Cancel the authorization after authorizing the account to another account + */ + it('ActsAccountSetAppAccess_0800', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_0800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var enableBundle = "com.example.actsaccountsceneappaccess"; + console.debug("====>add account ActsAccountSetAppAccess_0800 start===="); + try{ + await appAccountManager.createAccount("AppAccess_promise_account"); + } + catch(err){ + console.error("====>createAccount ActsAccountSetAppAccess_0800 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>enableAppAccess ActsAccountSetAppAccess_0800 start===="); + try{ + await appAccountManager.setAppAccess("AppAccess_promise_account", enableBundle, true); + } + catch(err){ + console.error("====>enableAppAccess ActsAccountSetAppAccess_0800 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>disableAppAccess ActsAccountSetAppAccess_0800 start===="); + await appAccountManager.setAppAccess("AppAccess_promise_account", enableBundle, false); + console.debug("====>delete account ActsAccountSetAppAccess_0800 start===="); + await appAccountManager.removeAccount("AppAccess_promise_account"); + console.debug("====>ActsAccountSetAppAccess_0800 end===="); + done(); + }); + + /* + * @tc.number : ActsAccountSetAppAccess_0900 + * @tc.name : enableAppAccess callback + * @tc.desc : The authorized account name is a long string + */ + it('ActsAccountSetAppAccess_0900', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_0900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var bigAccountName = ''; + for (var i = 0; i < STRCOUNT; i++) { + bigAccountName += 't'; + } + var enableBundle = "com.example.actsaccountsceneappaccess"; + appAccountManager.setAppAccess(bigAccountName, enableBundle, true, (err)=>{ + console.debug("====>enableAppAccess 0900 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>ActsAccountSetAppAccess_0900 end===="); + done(); + }) + }); + + /* + * @tc.number : ActsAccountSetAppAccess_1000 + * @tc.name : enableAppAccess promise + * @tc.desc : The authorized account name is a long string + */ + it('ActsAccountSetAppAccess_1000', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_1000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var bigAccountName = ''; + for (var i = 0; i < STRCOUNT; i++) { + bigAccountName += 't'; + } + var enableBundle = "com.example.actsaccountsceneappaccess"; + console.debug("====>enableAppAccess ActsAccountSetAppAccess_1000 start===="); + try{ + await appAccountManager.setAppAccess(bigAccountName, enableBundle, true); + } + catch(err){ + console.debug("====>enableAppAccess 1000 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>ActsAccountSetAppAccess_1000 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountSetAppAccess_1100 + * @tc.name : enableAppAccess callback + * @tc.desc : The authorized bundle name is a long string + */ + it('ActsAccountSetAppAccess_1100', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_1100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var bigBundleName = ''; + for (var i = 0; i < STRCOUNT; i++) { + bigBundleName += 't'; + } + appAccountManager.createAccount("AppAccess_callback_bigBundleName", (err)=>{ + console.debug("====>add account ActsAccountSetAppAccess_1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAppAccess("AppAccess_callback_bigBundleName", bigBundleName, true, (err)=>{ + console.debug("====>enableAppAccess 1100 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + appAccountManager.removeAccount("AppAccess_callback_bigBundleName", (err)=>{ + console.debug("====>delete Account ActsAccountSetAppAccess_1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountSetAppAccess_1100 end===="); + done(); + }); + }) + }) + }); + + /* + * @tc.number : ActsAccountSetAppAccess_1200 + * @tc.name : enableAppAccess promise + * @tc.desc : The authorized bundle name is a long string + */ + it('ActsAccountSetAppAccess_1200', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_1200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var bigBundleName = ''; + for (var i = 0; i < STRCOUNT; i++) { + bigBundleName += 't'; + } + console.debug("====>add account ActsAccountSetAppAccess_1200 start===="); + await appAccountManager.createAccount("AppAccess_promise_bigBundleName"); + console.debug("====>enableAppAccess ActsAccountSetAppAccess_1200 start===="); + try{ + await appAccountManager.setAppAccess("AppAccess_promise_bigBundleName", bigBundleName, true); + } + catch(err){ + console.debug("====>enableAppAccess 1200 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>delete account ActsAccountSetAppAccess_1200 start===="); + await appAccountManager.removeAccount("AppAccess_promise_bigBundleName"); + console.debug("====>ActsAccountSetAppAccess_1200 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountSetAppAccess_1300 + * @tc.name : enableAppAccess callback + * @tc.desc : The authorized account name is an empty string + */ + it('ActsAccountSetAppAccess_1300', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_1300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var emptyBundleName = ''; + appAccountManager.createAccount("AppAccess_callback_emptyBundleName", (err)=>{ + console.debug("====>add account ActsAccountSetAppAccess_1300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAppAccess("AppAccess_callback_emptyBundleName", emptyBundleName, true, (err)=>{ + console.debug("====>enableAppAccess 1300 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + appAccountManager.removeAccount("AppAccess_callback_emptyBundleName", (err)=>{ + console.debug("====>delete Account ActsAccountSetAppAccess_1300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountSetAppAccess_1300 end===="); + done(); + }); + }) + }) + }); + + /* + * @tc.number : ActsAccountSetAppAccess_1400 + * @tc.name : enableAppAccess promise + * @tc.desc : The authorized account name is an empty string + */ + it('ActsAccountSetAppAccess_1400', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_1400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var emptyBundleName = ''; + console.debug("====>add account ActsAccountSetAppAccess_1400 start===="); + await appAccountManager.createAccount("AppAccess_promise_emptyBundleName"); + console.debug("====>enableAppAccess ActsAccountSetAppAccess_1400 start===="); + try{ + await appAccountManager.setAppAccess("AppAccess_promise_emptyBundleName", emptyBundleName, true); + } + catch(err){ + console.debug("====>enableAppAccess 1400 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>delete account ActsAccountSetAppAccess_1400 start===="); + await appAccountManager.removeAccount("AppAccess_promise_emptyBundleName"); + console.debug("====>ActsAccountSetAppAccess_1400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountSetAppAccess_1500 + * @tc.name : disableAppAccess callback + * @tc.desc : Cancel authorization Accounts that have not authorized other applications + */ + it('ActsAccountSetAppAccess_1500', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_1500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var enableBundle = "com.example.actsaccountsceneappaccess"; + appAccountManager.createAccount("AppAccess_callback_account", (err)=>{ + console.debug("====>add account ActsAccountSetAppAccess_1500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAppAccess("AppAccess_callback_account", enableBundle, false, (err)=>{ + console.debug("====>setAppAccess ActsAccountSetAppAccess_1500 err:" + JSON.stringify(err)); + expect(err.code == 12400001).assertEqual(true); + appAccountManager.removeAccount("AppAccess_callback_account", (err)=>{ + console.debug("====>delete Account ActsAccountSetAppAccess_1500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountSetAppAccess_1500 end===="); + done(); + }); + }) + }) + }); + + /* + * @tc.number : ActsAccountSetAppAccess_1600 + * @tc.name : disableAppAccess promise + * @tc.desc : Cancel authorization Accounts that have not authorized other applications + */ + it('ActsAccountSetAppAccess_1600', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_1600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var enableBundle = "com.example.actsaccountsceneappaccess"; + console.debug("====>add account ActsAccountSetAppAccess_1600 start===="); + try{ + await appAccountManager.createAccount("AppAccess_promise_account"); + } + catch(err){ + console.error("====>createAccount ActsAccountSetAppAccess_1600 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>disableAppAccess ActsAccountSetAppAccess_1600 start===="); + try{ + await appAccountManager.setAppAccess("AppAccess_promise_account", enableBundle,false); + expect().assertFail(); + done(); + } + catch(err){ + console.debug("====>disableAppAccess ActsAccountSetAppAccess_1600 err:" + JSON.stringify(err)); + expect(err.code == 12400001).assertEqual(true); + await appAccountManager.removeAccount("AppAccess_promise_account"); + console.debug("====>ActsAccountSetAppAccess_1600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountSetAppAccess_1700 + * @tc.name : disableAppAccess callback + * @tc.desc : The disableAppAccess parameter bundleName does not exist + */ + it('ActsAccountSetAppAccess_1700', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_1700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var notExistBundle = "com.example.actsaccountnotexistbundle"; + appAccountManager.createAccount("AppAccess_callback_notExistBundle", (err)=>{ + console.debug("====>add account ActsAccountSetAppAccess_1700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAppAccess("AppAccess_callback_notExistBundle", notExistBundle, false, (err)=>{ + expect(err.code == 12400001).assertEqual(true); + appAccountManager.removeAccount("AppAccess_callback_notExistBundle", (err)=>{ + console.debug("====>delete Account ActsAccountSetAppAccess_1700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountSetAppAccess_1700 end===="); + done(); + }); + }) + }) + }); + + /* + * @tc.number : ActsAccountSetAppAccess_1800 + * @tc.name : disableAppAccess promise + * @tc.desc : The disableAppAccess parameter bundleName does not exist + */ + it('ActsAccountSetAppAccess_1800', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_1800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var notExistBundle = "com.example.actsaccountnotexistbundle"; + console.debug("====>add account ActsAccountSetAppAccess_1800 start===="); + await appAccountManager.createAccount("AppAccess_promise_notExistBundle"); + console.debug("====>disableAppAccess ActsAccountSetAppAccess_1800 start===="); + try{ + await appAccountManager.setAppAccess("AppAccess_promise_notExistBundle", notExistBundle, false); + } + catch(err){ + console.debug("====>disableAppAccess ActsAccountSetAppAccess_1800 err:" + JSON.stringify(err)); + expect(err.code == 12400001).assertEqual(true); + console.debug("====>delete account ActsAccountSetAppAccess_1800 start===="); + await appAccountManager.removeAccount("AppAccess_promise_notExistBundle"); + console.debug("====>ActsAccountSetAppAccess_1600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsAccountSetAppAccess_1900 + * @tc.name : disableAppAccess callback + * @tc.desc : The disableAppAccess parameter accountName does not exist + */ + it('ActsAccountSetAppAccess_1900', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_1900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var notExistAccount = "AppAccess_callback_notExistAccount"; + var enableBundle = "com.example.actsaccountsceneappaccess"; + console.debug("====>disableAppAccess ActsAccountSetAppAccess_1900===="); + appAccountManager.setAppAccess(notExistAccount, enableBundle, false, (err)=>{ + console.debug("====>disableAppAccess ActsAccountSetAppAccess_1900 err:" + JSON.stringify(err)); + expect(err.code == 12300003).assertEqual(true); + console.debug("====>ActsAccountSetAppAccess_1900 end===="); + done(); + }) + }); + + /* + * @tc.number : ActsAccountSetAppAccess_2000 + * @tc.name : disableAppAccess promise + * @tc.desc : The disableAppAccess parameter accountName does not exist + */ + it('ActsAccountSetAppAccess_2000', 0, async function (done) { + console.debug("====>ActsAccountSetAppAccess_2000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var notExistAccount = "AppAccess_promise_notExistAccount"; + var enableBundle = "com.example.actsaccountsceneappaccess"; + console.debug("====>disableAppAccess ActsAccountSetAppAccess_2000===="); + try{ + await appAccountManager.setAppAccess(notExistAccount, enableBundle, false); + } + catch(err){ + console.debug("====>disableAppAccess ActsAccountSetAppAccess_2000 err:" + JSON.stringify(err)); + expect(err.code == 12300003).assertEqual(true); + console.debug("====>ActsAccountSetAppAccess_2000 end===="); + done(); + } + }); + }) +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/resources/base/element/string.json b/account/appaccount/actsaccountoperatetest/src/main/resources/base/element/string.json new file mode 100644 index 000000000..5a685e30c --- /dev/null +++ b/account/appaccount/actsaccountoperatetest/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsAccountTest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/account/appaccount/actsaccountoperatetest/src/main/resources/base/media/icon.png b/account/appaccount/actsaccountoperatetest/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpB<l@9sw zy?6dOXX?(K?>l$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=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i`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJL<k~a{}KP^0ew-EVGKm73>o%P>4I&$}y<EG|7-flk7U1byCfol%r zRq(+_wBzmq8c82N1TcaziET^jKK$H5cV$r;;CGKDIb+^eoOy*3L`cMt;?yr;9jVNq g9jT&p2BIGx8p5me=?Fj;|Gtl&DQhd$Ky4BK2beUY8~^|S literal 0 HcmV?d00001 diff --git a/account/appaccount/actsaccounttest/Test.json b/account/appaccount/actsaccounttest/Test.json index 53ccc60a4..acdfde0f7 100644 --- a/account/appaccount/actsaccounttest/Test.json +++ b/account/appaccount/actsaccounttest/Test.json @@ -14,7 +14,8 @@ "ActsAccountSceneAppAccess.hap", "ActsAccountSceneOnOff.hap", "ActsAccountOauthtoken.hap", - "ActsAccountAuthenticator.hap" + "ActsAccountAuthenticator.hap", + "ActsAccountOperateTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/account/appaccount/actsaccounttest/src/main/js/test/AddAccount.test.js b/account/appaccount/actsaccounttest/src/main/js/test/AddAccount.test.js index 969f8bf7e..9cad0eb72 100755 --- a/account/appaccount/actsaccounttest/src/main/js/test/AddAccount.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/AddAccount.test.js @@ -352,11 +352,12 @@ export default function ActsAccountAddAccount() { var specialStr = " "; try{ await appAccountManager.addAccount(specialStr, "account_extraInfo_promise_eighth"); + expect().assertFail(); + done(); } catch(err){ - console.debug("====>add Account ActsAccountAddAccount_1600 err:" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.debug("====>ActsAccountAddAccount_1600 end===="); + console.debug("====>add Account ActsAccountAddAccount_1600 throw_err:" + JSON.stringify(err)); + expect(err.code != 0 ).assertEqual(true); done(); } }); diff --git a/account/appaccount/actsaccounttest/src/main/js/test/AssociatedData.test.js b/account/appaccount/actsaccounttest/src/main/js/test/AssociatedData.test.js index 226cd16e5..048eba2c0 100755 --- a/account/appaccount/actsaccounttest/src/main/js/test/AssociatedData.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/AssociatedData.test.js @@ -1120,7 +1120,6 @@ export default function ActsAccountAssociatedData() { console.debug("====>getAssociatedData 2900 err:" + JSON.stringify(err)); console.debug("====>getAssociatedData 2900 data:" + JSON.stringify(data)); expect(err.code != 0).assertEqual(true); - expect(data).assertEqual(null); console.debug("====>ActsAccountAssociatedData_2900 end===="); done(); }); diff --git a/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js b/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js index 6a8b280d8..6fc2a5cb1 100644 --- a/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js @@ -35,6 +35,18 @@ export default function ActsAccountAppAccess() { beforeAll(async function (done) { done(); }); + beforeEach(async function (done) { + console.debug("====>afterEach start===="); + var appAccountManager = account.getAccountManager(); + var accounts = await appAccountManager.getAllAccountByOwner(owner) + for (i=0;i<accounts.length;i++){ + var localName = accounts[i].name + if(localName != 'zhangsan'){ + await appAccountManager.removeOsAccount(localName) + } + } + done(); + }); /* * @tc.number : ActsAccountCheckAccountLabels_0100 * @tc.name : Check Account Labels callback form @@ -347,8 +359,7 @@ export default function ActsAccountAppAccess() { appAccountManager.setAccountCredential(name, "PIN", '123456', (err, data)=>{ console.debug("====>ActsAccountDeleteAccountCredential_0100 setAccountCredential_err:" + JSON.stringify(err)); expect(err).assertEqual(null); - console.debug("====>ActsAccountDeleteAccountCredential_0100 setAccountCredential_data:" + JSON.stringify(data)); - appAccountManager.getAccountCredential(name, "PIN", (err) =>{ + appAccountManager.getAccountCredential(name, "PIN", (err, data) =>{ console.debug("====>ActsAccountDeleteAccountCredential_0100 getAccountCredential_err:" + JSON.stringify(err)) expect(err).assertEqual(null); console.debug("====>ActsAccountDeleteAccountCredential_0100 getAccountCredential_success:" + JSON.stringify(data)); @@ -386,9 +397,9 @@ export default function ActsAccountAppAccess() { console.debug("====>ActsAccountDeleteAccountCredential_0200 add_account_success"); appAccountManager.setAccountCredential(name, "PIN", '123456').then(() =>{ console.debug("====>ActsAccountDeleteAccountCredential_0200 setAccountCredential_success"); - appAccountManager.getAccountCredential(name, "PIN").then((data) =>{ + appAccountManager.getAccountCredential(name, "PIN").then((data) =>{ console.debug("====>ActsAccountDeleteAccountCredential_0200 getAccountCredential_data:" + JSON.stringify(data)); - appAccountManager.deleteAccountCredential(name, "PIN").then((data) =>{ + appAccountManager.deleteAccountCredential(name, "PIN").then((data) =>{ console.debug("====>ActsAccountDeleteAccountCredential_0200 data:" + JSON.stringify(data)); try{ appAccountManager.deleteAccount(name) @@ -436,24 +447,24 @@ export default function ActsAccountAppAccess() { console.debug("====>ActsAccountVerifyCredential_0100 add_account_err:" + JSON.stringify(err)); expect(err).assertEqual(null); appAccountManager.verifyCredential(name, owner, options, { - onResult:(resultCode, resultData)=>{ - console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_resultcode:" + JSON.stringify(resultCode)); - expect(resultCode).assertEqual(0) - console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_resultData:" + JSON.stringify(resultData)); - expect(resultData.booleanResult).assertEqual(true) - try{ - appAccountManager.deleteAccount(name) - console.debug('====>ActsAccountVerifyCredential_0100 deleteAccount_success') - done(); - } - catch{ - console.debug('====>ActsAccountVerifyCredential_0100 deleteAccount_err') - expect().assertFail() - } - done(); - }, - onRequestRedirected:null, - onRequestContinued: function(){ + onResult:(resultCode, resultData)=>{ + console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_resultcode:" + JSON.stringify(resultCode)); + expect(resultCode).assertEqual(0) + console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_resultData:" + JSON.stringify(resultData)); + expect(resultData.booleanResult).assertEqual(true) + try{ + appAccountManager.deleteAccount(name) + console.debug('====>ActsAccountVerifyCredential_0100 deleteAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountVerifyCredential_0100 deleteAccount_err') + expect().assertFail() + } + done(); + }, + onRequestRedirected:null, + onRequestContinued: function(){ console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_onRequestContinued") } }); @@ -473,30 +484,35 @@ export default function ActsAccountAppAccess() { appAccountManager.addAccount(name, (err)=>{ console.debug("====>ActsAccountVerifyCredential_0200 add_account_err:" + JSON.stringify(err)); expect(err).assertEqual(null); - console.debug("====>ActsAccountVerifyCredential_0200 add_account_err:" + JSON.stringify(err)); - expect(err).assertEqual(null); - appAccountManager.verifyCredential(name, owner, { - onResult:(resultCode, resultData)=>{ - console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_resultcode:" + JSON.stringify(resultCode)); - expect(resultCode).assertEqual(0) - console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_resultData:" + JSON.stringify(resultData)); - expect(resultData.booleanResult).assertEqual(false) - try{ - appAccountManager.deleteAccount(name) - console.debug('====>ActsAccountVerifyCredential_0200 deleteAccount_success') - done(); - } - catch{ - console.debug('====>ActsAccountVerifyCredential_0200 deleteAccount_err') - expect().assertFail() - } - done(); - }, - onRequestRedirected:null, - onRequestContinued: function(){ - console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_onRequestContinued") - } - }); + console.debug("====>ActsAccountVerifyCredential_0200 add_account_data:" + JSON.stringify(data)); + try{ + appAccountManager.verifyCredential(name, owner, { + onResult:(resultCode, resultData)=>{ + console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_resultcode:" + JSON.stringify(resultCode)); + expect(resultCode).assertEqual(0) + console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_resultData:" + JSON.stringify(resultData)); + expect(resultData.booleanResult).assertEqual(false) + try{ + appAccountManager.deleteAccount(name) + console.debug('====>ActsAccountVerifyCredential_0200 deleteAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountVerifyCredential_0200 deleteAccount_err') + expect().assertFail() + } + done(); + }, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_onRequestContinued") + } + }); + }catch(err){ + console.debug('====>====>ActsAccountVerifyCredential_0200 err:'+JSON.stringify(err)) + expect().assertFail(); + done(); + } }); }); diff --git a/account/appaccount/actsaccounttest/src/main/js/test/OAuthToken.test.js b/account/appaccount/actsaccounttest/src/main/js/test/OAuthToken.test.js index f9ca813b7..ea7e113a9 100644 --- a/account/appaccount/actsaccounttest/src/main/js/test/OAuthToken.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/OAuthToken.test.js @@ -427,7 +427,7 @@ export default function ActsAccountOAuthToken() { expect(err).assertEqual(null); appAccountManager.deleteOAuthToken("account_callback_empty_authType",OWNERSELF,"","callback_empty_authType_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_7800 deleteOAuthToken err:" + JSON.stringify(err)); - expect(err).assertEqual(null); + expect(err.code !=0).assertEqual(true); appAccountManager.getOAuthToken("account_callback_empty_authType",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_7800 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_7800 getOAuthToken data:" + data); @@ -453,15 +453,19 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_7900 setOAuthToken start===="); await appAccountManager.setOAuthToken("account_promise_empty_authType","authType","promise_empty_authType_token"); console.debug("====>ActsAccountOAuthToken_7900 deleteOAuthToken start===="); - await appAccountManager.deleteOAuthToken("account_promise_empty_authType",OWNERSELF,"","promise_empty_authType_token"); - console.debug("====>ActsAccountOAuthToken_7900 getOAuthToken start===="); - var data = await appAccountManager.getOAuthToken("account_promise_empty_authType",OWNERSELF,"authType"); - expect(data).assertEqual("promise_empty_authType_token"); - console.debug("====>ActsAccountOAuthToken_7900 deleteAccount start===="); - await appAccountManager.deleteAccount("account_promise_empty_authType"); - console.debug("====>ActsAccountOAuthToken_7900 end===="); - done(); - + try{ + await appAccountManager.deleteOAuthToken("account_promise_empty_authType",OWNERSELF,"","promise_empty_authType_token"); + }catch(err){ + console.debug('====>ActsAccountAuthToken_7900 deleteAuthToken err:' + JSON.stringify(err)) + expect(err.code !=0 ).assertEqual(true); + console.debug("====>ActsAccountAuthToken_7900 getAuthToken start===="); + var data = await appAccountManager.getOAuthToken("account_promise_empty_authType",OWNERSELF,"authType"); + expect(data).assertEqual("promise_empty_authType_token"); + console.debug("====>ActsAccountAuthToken_7900 removeAccount start===="); + await appAccountManager.deleteAccount("account_promise_empty_authType"); + console.debug("====>ActsAccountAuthToken_7900 end===="); + done(); + } }); @@ -485,7 +489,7 @@ export default function ActsAccountOAuthToken() { expect(data).assertEqual("callback_setSameAuthType_token2"); appAccountManager.deleteOAuthToken("account_callback_setSameAuthType",OWNERSELF,"authType","callback_setSameAuthType_token1",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_8000 deleteOAuthToken err:" + JSON.stringify(err)); - expect(err).assertEqual(null); + expect(err.code != 0).assertEqual(true); appAccountManager.deleteAccount("account_callback_setSameAuthType",(err)=>{ console.debug("====>ActsAccountOAuthToken_8000 deleteAccount err:" + JSON.stringify(err)); expect(err).assertEqual(null); @@ -1331,12 +1335,17 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_2200 addAccount start===="); await appAccountManager.addAccount("account_promise_repeatDelete"); console.debug("====>setOAuthToken ActsAccountOAuthToken_2200 start===="); - await appAccountManager.setOAuthToken("account_promise_repeatDelete","aythType","promise_repeatDelete_token"); + await appAccountManager.setOAuthToken("account_promise_repeatDelete","authType","promise_repeatDelete_token"); console.debug("====>deleteOAuthToken first ActsAccountOAuthToken_2200 start===="); - await appAccountManager.deleteOAuthToken("account_promise_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token"); - console.debug("====>deleteOAuthToken second ActsAccountOAuthToken_2200 start===="); - await appAccountManager.deleteOAuthToken("account_promise_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token"); - console.debug("====>getOAuthToken ActsAccountOAuthToken_2200 start===="); + await appAccountManager.deleteOAuthToken("account_promise_repeatDelete",OWNERSELF,"authType","promise_repeatDelete_token"); + try{ + console.debug("====>deleteOAuthToken second ActsAccountOAuthToken_2200 start===="); + await appAccountManager.deleteOAuthToken("account_promise_repeatDelete",OWNERSELF,"authType","promise_repeatDelete_token"); + }catch(err){ + console.debug("====>deleteOAuthToken second ActsAccountOAuthToken_2200 err:" + JSON.stringify(err)); + expect(err.code != 0 ).assertEqual(true); + done(); + } try{ var data = await appAccountManager.getOAuthToken("account_promise_repeatDelete",OWNERSELF,"authType"); } @@ -2417,22 +2426,27 @@ export default function ActsAccountOAuthToken() { appAccountManager.setOAuthToken("account_callback_delete_space","authType","account_callback_delete_space_token",(err)=>{ console.debug("====>ActsAccountOAuthToken_6900 setOAuthToken err:" + JSON.stringify(err)); expect(err).assertEqual(null); - appAccountManager.deleteOAuthToken("account_callback_delete_space",OWNERSELF,"authType","",(err)=>{ - console.debug("====>ActsAccountOAuthToken_6900 getOAuthToken err:" + JSON.stringify(err)); - expect(err).assertEqual(null); - appAccountManager.getOAuthToken("account_callback_delete_space",OWNERSELF,"authType",(err,data)=>{ - console.debug("====>ActsAccountOAuthToken_6900 getOAuthToken err:" + JSON.stringify(err)); - console.debug("====>ActsAccountOAuthToken_6900 getOAuthToken data:" + data); - expect(err).assertEqual(null); - expect(data).assertEqual("account_callback_delete_space_token"); - appAccountManager.deleteAccount("account_callback_delete_space",(err)=>{ - console.debug("====>ActsAccountOAuthToken_6900 deleteAccount err:" + JSON.stringify(err)); + try{ + appAccountManager.deleteOAuthToken("account_callback_delete_space",OWNERSELF,"authType","",(err)=>{ + console.debug("====>ActsAccountOAuthToken_6900 deleteOAuthToken err:" + JSON.stringify(err)); + expect(err.code == 12400004).assertEqual(true) + appAccountManager.getOAuthToken("account_callback_delete_space",OWNERSELF,"authType",(err,data)=>{ + console.debug("====>ActsAccountOAuthToken_6900 getAuthToken err:" + JSON.stringify(err)); + console.debug("====>ActsAccountOAuthToken_6900 getAuthToken data:" + data); expect(err).assertEqual(null); - console.debug("====>ActsAccountOAuthToken_6900 end===="); - done(); - }); - }); - }); + expect(data).assertEqual("account_callback_delete_space_token"); + appAccountManager.deleteAccount("account_callback_delete_space",(err)=>{ + console.debug("====>ActsAccountOAuthToken_6900 removeAccount err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountOAuthToken_6900 end===="); + done(); + }); + }); + }) + }catch(err){ + expect().assertFail(); + done(); + }; }); }); }); @@ -2445,14 +2459,18 @@ export default function ActsAccountOAuthToken() { console.debug("====>ActsAccountOAuthToken_7000 setOAuthToken start===="); await appAccountManager.setOAuthToken("account_promise_delete_space","authType","account_promise_delete_space_token"); console.debug("====>ActsAccountOAuthToken_7000 deleteOAuthToken start===="); - await appAccountManager.deleteOAuthToken("account_promise_delete_space",OWNERSELF,"authType",""); - console.debug("====>ActsAccountOAuthToken_7000 getOAuthToken start===="); - var data = await appAccountManager.getOAuthToken("account_promise_delete_space",OWNERSELF,"authType"); - expect(data).assertEqual("account_promise_delete_space_token"); - console.debug("====>ActsAccountOAuthToken_7000 deleteAccount start===="); - await appAccountManager.deleteAccount("account_promise_delete_space"); - console.debug("====>ActsAccountOAuthToken_7000 end===="); - done(); + try{ + await appAccountManager.deleteOAuthToken("account_promise_delete_space",OWNERSELF,"authType",""); + }catch(err){ + expect(err.code != 0).assertEqual(true) + console.debug("====>ActsAccountOAuthToken_7000 getOAuthToken start===="); + var data = await appAccountManager.getOAuthToken("account_promise_delete_space",OWNERSELF,"authType"); + expect(data).assertEqual("account_promise_delete_space_token"); + console.debug("====>ActsAccountOAuthToken_7000 deleteAccount start===="); + await appAccountManager.deleteAccount("account_promise_delete_space"); + console.debug("====>ActsAccountOAuthToken_7000 end===="); + done(); + } }); it('ActsAccountOAuthToken_9200', 0, async function (done) { @@ -3398,7 +3416,7 @@ export default function ActsAccountOAuthToken() { it('ActsAccountOAuthToken_13400', 0, async function (done) { console.debug("====>ActsAccountOAuthToken_13400 start===="); var appAccountManager = account.createAppAccountManager(); - appAccountManager.addAccountImplicitly("com.example.actsaccountOauthtoken","authType",{},{ + appAccountManager.addAccountImplicitly("com.example.actsaccountOauthtoken", "authType", {},{ onResult: (resultCode, resultData) =>{ console.debug("====>ActsAccountOAuthToken_13400 authenticate resultCode:" + JSON.stringify(resultCode)); console.debug("====>ActsAccountOAuthToken_13400 authenticate resultData:" + JSON.stringify(resultData)); diff --git a/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js b/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js index c5020391e..20487f3cb 100644 --- a/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js @@ -854,8 +854,7 @@ export default function ActsAccountChangeOnOff() { } catch(err){ console.error("====>on ActsAccountChangeOnOff_1300 err:" + JSON.stringify(err)); - expect().assertFail(); - done(); + expect(err.code).assertEqual(201); } console.debug("====>setAccountExtraInfo start===="); try{ @@ -901,8 +900,7 @@ export default function ActsAccountChangeOnOff() { } catch(err){ console.error("====>on ActsAccountChangeOnOff_1400 err:" + JSON.stringify(err)); - expect().assertFail(); - done(); + expect(err).assertFail(); } console.debug("====>setAccountExtraInfo start===="); try{ diff --git a/account/appaccount/actsaccounttstest/entry/src/main/ets/test/AuthTokenInfoTest.test.ets b/account/appaccount/actsaccounttstest/entry/src/main/ets/test/AuthTokenInfoTest.test.ets new file mode 100644 index 000000000..385dd42c4 --- /dev/null +++ b/account/appaccount/actsaccounttstest/entry/src/main/ets/test/AuthTokenInfoTest.test.ets @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import appAccount from "@ohos.account.appAccount" + +export default function authTokenInfoTest() { + describe('AuthTokenInfoTest', function () { + beforeAll(async function (done) { + console.info('AccountTsTest: beforeAll'); + done(); + }) + + afterAll(async function (done) { + console.info('AccountTsTest: afterAll'); + done(); + }) + + beforeEach(async function (done) { + console.info('AccountTsTest: beforeEach'); + done(); + }) + + afterEach(async function (done) { + console.info('AccountTsTest: afterEach'); + done(); + }) + + /* + * @tc.number AuthTokenInfoTest_0100 + * @tc.name AuthTokenInfoTest_0100 + * @tc.desc AuthTokenInfo without account. + * @tc.size SmallTest + * @tc.type User + */ + it('AuthTokenInfoTest_0100', 0, async function (done) { + let info : appAccount.AuthTokenInfo = { + authType: "getSocialData", + token: "xxxxx" + } + console.log("AuthTokenInfoTest_0100 info: " + JSON.stringify(info)); + expect(info.hasOwnProperty("accounts")).assertEqual(false) + expect(info.hasOwnProperty("account")).assertEqual(false) + done() + }) + + /* + * @tc.number AuthTokenInfoTest_0200 + * @tc.name AuthTokenInfoTest_0200 + * @tc.desc AuthTokenInfo with account. + * @tc.size SmallTest + * @tc.type User + */ + it('AuthTokenInfoTest_0200', 0, async function (done) { + let info : appAccount.AuthTokenInfo = { + authType: "getSocialData", + token: "xxxxx", + account: { + name: "zhangsan", + owner: "com.ohos.testapp" + } + } + console.log("AuthTokenInfoTest_0200 info: " + JSON.stringify(info)) + expect(info.hasOwnProperty("accounts")).assertEqual(false) + expect(info.hasOwnProperty("account")).assertEqual(true) + expect(info.account.owner).assertEqual("com.ohos.testapp") + done(); + }) + }) +} diff --git a/account/appaccount/actsaccounttstest/entry/src/main/ets/test/List.test.ets b/account/appaccount/actsaccounttstest/entry/src/main/ets/test/List.test.ets index 484485f4d..c6174cfdf 100644 --- a/account/appaccount/actsaccounttstest/entry/src/main/ets/test/List.test.ets +++ b/account/appaccount/actsaccounttstest/entry/src/main/ets/test/List.test.ets @@ -13,7 +13,9 @@ * limitations under the License. */ import oauthTokenInfoTest from './OAuthTokenInfoTest.test.ets' +import authTokenInfoTest from './AuthTokenInfoTest.test.ets' export default function testsuite() { oauthTokenInfoTest() + authTokenInfoTest() } \ No newline at end of file diff --git a/account/appaccount/actsgetaccountsbyowner/BUILD.gn b/account/appaccount/actsgetaccountsbyowner/BUILD.gn new file mode 100644 index 000000000..cba31f9e0 --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsGetAccountsByOwnerTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsGetAccountsByOwnerTest" + subsystem_name = "account" + part_name = "os_account" +} +ohos_js_assets("hjs_demo_js_assets") { + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" +} + +ohos_resources("hjs_demo_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/account/appaccount/actsgetaccountsbyowner/Test.json b/account/appaccount/actsgetaccountsbyowner/Test.json new file mode 100644 index 000000000..c7496071d --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "60000", + "bundle-name": "com.example.actsgetaccountsbyowner", + "package-name": "com.example.actsgetaccountsbyowner", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsGetAccountsByOwnerTest.hap", + "ActsSceneGetAllAccounts.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/account/appaccount/actsgetaccountsbyowner/signature/openharmony_sx.p7b b/account/appaccount/actsgetaccountsbyowner/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6 GIT binary patch literal 3442 zcmcgvYj6|S6}BF>F-F+L*anwiBOa!J?7OmLOQwYEN~;%M$tz2?WlYUVT0LxOwU$<1 zS(Haa;)Zu=rr?H0Y#s&@105h3XNE^Z10^9aB$Vk;3~>l;p)@qbNk}NPE878^fghdB zpdZ>f=bn4-chC9Gcjtnbh)PPC(V}blR>Vu@x5Y$tASRm6=kXvBNKHyv*rMZ+0wJFV zVu@*w19@$+!~|hX_@71MCNdcE1}KRm;3UPR(5y!eituv|F;oBwfOwWT9QHanQx2ph zcBPV($X(o@tXS@pDCIyQA(SM5iexSq2`RW}rkRdU4w62S2$7tFplONI8)AZ9dzgvu zHy9BJ)p;p~bO(vJmkVqnd|s!QX%?3*5>o+2VkcdJU>uoTDN_{7rE<lrem~)2$ROt~ zRw!j9MVx!_EU`UIIenzWOSuB^=}xkV^aW@#DCvi8qDe|e1pNW3ncHU=7zY_-ye_YU zVB)AH@gIU}^~O9EYPRS#dKGLz`@OXkrq`>ms7eLfNjJ>u5!kIq36rWYs)jMd?QZlm z)SJq2Tn)2U7}H`ARTMTLZet|^+bnQ{(ZsD_##z*DQ&-~nJd|b19ooupg;vvSuTq9d z3tEFA4lN8>QB?%PEk%gW-r(^#{7{pfYH(L-D?PQ8-GbI*DzrZej$p)-QFt}N+O@uV zTeX?COJ!~xpsdd0Fk<y6i`B!;90rR%VzOY7D$Z+EH$<>{Eb_=#j|4D0#H#Rqj9Qd6 zs4exV6+`p`xI9={E%n5n5v>KT9yn*nf}%>crb@22RT~()R4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v!d$W#+ YX9HpW+h1JFRc8v8e%3PML|^*<0J%6(*8l(j literal 0 HcmV?d00001 diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/config.json b/account/appaccount/actsgetaccountsbyowner/src/main/config.json new file mode 100644 index 000000000..0e5479435 --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/config.json @@ -0,0 +1,127 @@ +{ + "app": { + "bundleName": "com.example.actsgetaccountsbyowner", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsgetaccountsbyowner", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "ohos.permission.GET_ALL_APP_ACCOUNTS" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.GET_ALL_APP_ACCOUNTS", + "reason": "ceshi" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO", + "reason":"need use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } + } +} \ No newline at end of file diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/app.js b/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/app.js new file mode 100644 index 000000000..2a68c1992 --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/i18n/en-US.json b/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 000000000..e63c70d97 --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/i18n/zh-CN.json b/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 000000000..de6ee5748 --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/pages/index/index.css b/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 000000000..2334ecfa2 --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/pages/index/index.hml b/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 000000000..58fdc1444 --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,19 @@ +<!-- + Copyright (c) 2021 Huawei Device Co., Ltd. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<div class="container"> + <text class="title"> + {{title}} + </text> +</div> diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/pages/index/index.js b/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 000000000..0c25c846b --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "getAllAccounts" + }, + onInit() { + this.title = "getAllAccounts"; + }, + onShow() { + console.info('onShow finish') + }, + onReady() { + }, +} \ No newline at end of file diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/app.js b/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/i18n/en-US.json b/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/i18n/zh-CN.json b/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/pages/index/index.css b/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..2b45eb97c --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/pages/index/index.hml b/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ +<!-- + Copyright (c) 2021 Huawei Device Co., Ltd. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<div class="container" onswipe="touchMove"> + <text class="title"> + {{ $t('strings.hello') }} {{title}} + </text> + <input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input> +</div> diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/pages/index/index.js b/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/account/appaccount/actsgetaccountsbyowner/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/test/Getaccountsbyowner.test.js b/account/appaccount/actsgetaccountsbyowner/src/main/js/test/Getaccountsbyowner.test.js new file mode 100644 index 000000000..07e7c355e --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/test/Getaccountsbyowner.test.js @@ -0,0 +1,647 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import account from '@ohos.account.appAccount' +import featureAbility from '@ohos.ability.featureAbility' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +const TIMEOUT = 2000; +const LENGTHLIMIT = 1024; +const SELFBUNDLE = 'com.example.actsgetaccountsbyowner' +const createAccountOptions = {customData:{age:'12'}} +export default function GetAccountsByOwner() { + describe('GetAccountsByOwner', function () { + + /* + * @tc.number : GetAccountsByOwner_0100 + * @tc.name : getAccountsByOwner callback + * @tc.desc : This application gets its own application information after adding an account + */ + it('GetAccountsByOwner_0100', 0, async function (done) { + console.debug("====>GetAccountsByOwner_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("Account_this_application_callback", (err)=>{ + console.debug("====>add account 0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAccountsByOwner(SELFBUNDLE, (err, data)=>{ + console.debug("====>getAccountsByOwner 0100 err:" + JSON.stringify(err)); + console.debug("====>getAccountsByOwner 0100 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + try{ + expect(data[0].name).assertEqual("Account_this_application_callback"); + expect(data[0].owner).assertEqual("com.example.actsgetaccountsbyowner"); + } + catch(err){ + console.error("====>getAccountsByOwner 0100 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + appAccountManager.removeAccount("Account_this_application_callback", (err)=>{ + console.debug("====>delete account 0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>GetAccountsByOwner_0100 end===="); + done(); + }); + }) + }); + }); + + /* + * @tc.number : GetAccountsByOwner_0200 + * @tc.name : getAccountsByOwner promise + * @tc.desc : This application gets its own application information after adding an account + */ + it('GetAccountsByOwner_0200', 0, async function (done) { + console.debug("====>GetAccountsByOwner_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>getAccountsByOwner for clean===="); + try{ + var acclist = await appAccountManager.getAccountsByOwner(SELFBUNDLE); + } + catch(err){ + console.error("====>getAccountsByOwner err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>account list length: " + acclist.length); + if(acclist.length > 0){ + for(var i = 0;i < acclist.length; i++){ + await appAccountManager.removeAccount(acclist[i].name); + } + } + console.debug("====>add account 0200 start===="); + await appAccountManager.createAccount("Account_this_application_promise"); + console.debug("====>getAccountsByOwner 0200 start===="); + try{ + var data = await appAccountManager.getAccountsByOwner(SELFBUNDLE); + } + catch(err){ + console.error("====>getAccountsByOwner 0200 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + try{ + expect(data[0].name).assertEqual("Account_this_application_promise"); + expect(data[0].owner).assertEqual("com.example.actsgetaccountsbyowner"); + } + catch(err){ + console.error("====>check data 0200 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>delete account 0200 start===="); + await appAccountManager.removeAccount("Account_this_application_promise"); + console.debug("====>GetAccountsByOwner_0200 end===="); + done(); + }); + + /* + * @tc.number : GetAccountsByOwner_0300 + * @tc.name : getAccountsByOwner callback + * @tc.desc : No account has been added to this application and it is not authorized by other applications to + * obtain account information for this application + */ + it('GetAccountsByOwner_0300', 0, async function (done) { + console.debug("====>GetAccountsByOwner_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.getAccountsByOwner(SELFBUNDLE, (err, data)=>{ + console.debug("====>getAccountsByOwner 0300 err:" + JSON.stringify(err)); + console.debug("====>getAccountsByOwner 0300 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data.length).assertEqual(0); + console.debug("====>GetAccountsByOwner_0300 end===="); + done(); + }) + }); + + /* + * @tc.number : GetAccountsByOwner_0400 + * @tc.name : getAccountsByOwner promise + * @tc.desc : No account has been added to this application and it is not authorized by other applications to + * obtain account information for this application + */ + it('GetAccountsByOwner_0400', 0, async function (done) { + console.debug("====>GetAccountsByOwner_0400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>getAccountsByOwner for clean===="); + try{ + var acclist = await appAccountManager.getAccountsByOwner(SELFBUNDLE); + } + catch(err){ + console.error("====>getAccountsByOwner err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>account list length: " + acclist.length); + if(acclist.length > 0){ + for(var i = 0;i < acclist.length; i++){ + await appAccountManager.removeAccount(acclist[i].name); + } + } + var data = await appAccountManager.getAccountsByOwner(SELFBUNDLE); + console.debug("====>getAccountsByOwner 0400 data:" + JSON.stringify(data)); + expect(data.length).assertEqual(0); + console.debug("====>GetAccountsByOwner_0400 end===="); + done(); + }); + + /* + * @tc.number : GetAccountsByOwner_0500 + * @tc.name : getAccountsByOwner callback + * @tc.desc : The parameter owner is an empty string + */ + it('GetAccountsByOwner_0500', 0, async function (done) { + console.debug("====>GetAccountsByOwner_0500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var emptyBundle = ""; + appAccountManager.getAccountsByOwner(emptyBundle, (err, data)=>{ + console.debug("====>getAccountsByOwner 0500 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>GetAccountsByOwner_0500 end===="); + done(); + }) + }); + + /* + * @tc.number : GetAccountsByOwner_0600 + * @tc.name : getAccountsByOwner promise + * @tc.desc : The parameter owner is an empty string + */ + it('GetAccountsByOwner_0600', 0, async function (done) { + console.debug("====>GetAccountsByOwner_0600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var emptyBundle = ""; + try{ + var data = await appAccountManager.getAccountsByOwner(emptyBundle); + } + catch(err){ + console.debug("====>getAccountsByOwner 0600 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>GetAccountsByOwner_0600 end===="); + done(); + } + }); + + /* + * @tc.number : GetAccountsByOwner_0700 + * @tc.name : getAccountsByOwner callback + * @tc.desc : The parameter owner is a string that exceeds the length limit + */ + it('GetAccountsByOwner_0700', 0, async function (done) { + console.debug("====>GetAccountsByOwner_0700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var limitBundle = ''; + for (var i = 0; i < LENGTHLIMIT + 1; i++) { + limitBundle += 't'; + } + appAccountManager.getAccountsByOwner(limitBundle, (err, data)=>{ + console.debug("====>getAccountsByOwner 0700 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>GetAccountsByOwner_0700 end===="); + done(); + }) + }); + + /* + * @tc.number : GetAccountsByOwner_0800 + * @tc.name : getAccountsByOwner promise + * @tc.desc : The parameter owner is a string that exceeds the length limit + */ + it('GetAccountsByOwner_0800', 0, async function (done) { + console.debug("====>GetAccountsByOwner_0800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var limitBundle = ''; + for (var i = 0; i < LENGTHLIMIT + 1; i++) { + limitBundle += 'n'; + } + try{ + var data = await appAccountManager.getAccountsByOwner(limitBundle); + } + catch(err){ + console.debug("====>getAccountsByOwner 0800 err:" + JSON.stringify(err)); + expect(err.code == 12300002).assertEqual(true); + console.debug("====>GetAccountsByOwner_0800 end===="); + done(); + } + }); + + /* + * @tc.number : GetAccountsByOwner_0900 + * @tc.name : getAccountsByOwner callback + * @tc.desc : This application adds an account, and after other applications authorize an account to this + * application, this application obtains the information of its own application + */ + it('GetAccountsByOwner_0900', 0, async function (done) { + console.debug("====>GetAccountsByOwner_0900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account 0900 start===="); + await appAccountManager.createAccount("Account_application_callback"); + console.debug("====>startAbility 0900 start===="); + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.actsscenegetallaccounts", + abilityName: "com.example.actsscenegetallaccounts.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + ); + function getAllCallback(err, data){ + console.debug("====>getAccountsByOwner 0900 err:" + JSON.stringify(err)); + console.debug("====>getAccountsByOwner 0900 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data[0].name).assertEqual("Account_application_callback"); + expect(data[0].owner).assertEqual("com.example.actsgetaccountsbyowner"); + appAccountManager.removeAccount("Account_application_callback", (err)=>{ + console.debug("====>delete account 0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>GetAccountsByOwner_0900 end===="); + done(); + }); + } + setTimeout(async function(){ + console.debug("====>getAccountsByOwner 0900 start===="); + appAccountManager.getAccountsByOwner(SELFBUNDLE, getAllCallback); + }, TIMEOUT); + }); + + /* + * @tc.number : GetAccountsByOwner_1000 + * @tc.name : getAccountsByOwner promise + * @tc.desc : This application adds an account, and after other applications authorize an account to this + * application, this application obtains the information of its own application + */ + it('GetAccountsByOwner_1000', 0, async function (done) { + console.debug("====>GetAccountsByOwner_1000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account 1000 start===="); + await appAccountManager.createAccount("Account_application_promise"); + console.debug("====>startAbility 1000 start===="); + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.actsscenegetallaccounts", + abilityName: "com.example.actsscenegetallaccounts.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + ); + setTimeout(async function(){ + console.debug("====>getAccountsByOwner 1000 start===="); + try{ + var data = await appAccountManager.getAccountsByOwner(SELFBUNDLE); + } + catch(err){ + console.error("====>getAccountsByOwner 1000 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAccountsByOwner 1000 data:" + JSON.stringify(data)); + try{ + expect(data[0].name).assertEqual("Account_application_promise"); + expect(data[0].owner).assertEqual("com.example.actsgetaccountsbyowner"); + } + catch(err){ + console.error("====>check data 1000 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>delete account 1000 start===="); + await appAccountManager.removeAccount("Account_application_promise"); + console.debug("====>GetAccountsByOwner_1000 end===="); + done(); + }, TIMEOUT); + }); + + /* + * @tc.number : GetAccountsByOwner_1100 + * @tc.name : getAccountsByOwner callback + * @tc.desc : This application adds an account, and after other applications authorize an account to this + * application, this application obtains the information of its own application + */ + it('GetAccountsByOwner_1100', 0, async function (done) { + console.debug("====>GetAccountsByOwner_1100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var specifiedBundle = "com.example.actsscenegetallaccounts"; + console.debug("====>startAbility 1100 start===="); + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.actsscenegetallaccounts", + abilityName: "com.example.actsscenegetallaccounts.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + ); + function getAllCallback(err, data){ + console.debug("====>getAccountsByOwner 1100 err:" + JSON.stringify(err)); + console.debug("====>getAccountsByOwner 1100 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data[0].name).assertEqual("account_name_scene_single"); + expect(data[0].owner).assertEqual("com.example.actsscenegetallaccounts"); + console.debug("====>GetAccountsByOwner_1100 end===="); + done(); + } + setTimeout(async function(){ + console.debug("====>getAccountsByOwner 1100 start===="); + appAccountManager.getAccountsByOwner(specifiedBundle, getAllCallback); + }, TIMEOUT); + }); + + /* + * @tc.number : GetAccountsByOwner_1200 + * @tc.name : getAccountsByOwner promise + * @tc.desc : This application adds an account, and after other applications authorize an account to this + * application, this application obtains the information of its own application + */ + it('GetAccountsByOwner_1200', 0, async function (done) { + console.debug("====>GetAccountsByOwner_1200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var specifiedBundle = "com.example.actsscenegetallaccounts"; + console.debug("====>startAbility 1200 start===="); + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.actsscenegetallaccounts", + abilityName: "com.example.actsscenegetallaccounts.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + ); + setTimeout(async function(){ + console.debug("====>getAccountsByOwner 1200 start===="); + try{ + var data = await appAccountManager.getAccountsByOwner(specifiedBundle); + } + catch(err){ + console.error("====>getAccountsByOwner 1200 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAccountsByOwner 1200 data:" + JSON.stringify(data)); + expect(data[0].name).assertEqual("account_name_scene_single"); + expect(data[0].owner).assertEqual("com.example.actsscenegetallaccounts"); + console.debug("====>GetAccountsByOwner_1200 end===="); + done(); + }, TIMEOUT); + }); + + /* + * @tc.number : GetAccountsByOwner_1300 + * @tc.name : getAccountsByOwner callback + * @tc.desc : The parameter owner is a bundlename that does not exist + */ + it('GetAccountsByOwner_1300', 0, async function (done) { + console.debug("====>GetAccountsByOwner_1300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var nonexistentBundle = "com.example.actsgetallaccountsnonexistent"; + appAccountManager.getAccountsByOwner(nonexistentBundle, (err, data)=>{ + console.debug("====>getAccountsByOwner 1300 err:" + JSON.stringify(err)); + expect(err.code == 12400001).assertEqual(true); + console.debug("====>GetAccountsByOwner_1300 end===="); + done(); + }) + }); + + /* + * @tc.number : GetAccountsByOwner_1400 + * @tc.name : getAccountsByOwner promise + * @tc.desc : The parameter owner is a bundlename that does not exist + */ + it('GetAccountsByOwner_1400', 0, async function (done) { + console.debug("====>GetAccountsByOwner_1400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + var nonexistentBundle = "com.example.actsgetallaccountsnonexistent"; + try{ + var data = await appAccountManager.getAccountsByOwner(nonexistentBundle); + expect().assertFail(); + done(); + } + catch(err){ + console.debug("====>getAccountsByOwner 1400 err:" + JSON.stringify(err)); + expect(err.code == 12400001).assertEqual(true); + console.debug("====>GetAccountsByOwner_1400 end===="); + done(); + } + }); + + /* + * @tc.number : GetAccountsByOwner_1500 + * @tc.name : getAccountsByOwner callback + * @tc.desc : Get account information after adding and deleting account + */ + it('GetAccountsByOwner_1500', 0, async function (done) { + console.debug("====>GetAccountsByOwner_1500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_callback_delete", (err)=>{ + console.debug("====>add account 1500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAccountsByOwner(SELFBUNDLE, (err, data)=>{ + console.debug("====>getAccountsByOwner 1500 err:" + JSON.stringify(err)); + console.debug("====>getAccountsByOwner 1500 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data[0].name).assertEqual("account_callback_delete"); + expect(data[0].owner).assertEqual("com.example.actsgetaccountsbyowner"); + appAccountManager.removeAccount("account_callback_delete", (err)=>{ + console.debug("====>delete account 1500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAccountsByOwner(SELFBUNDLE, (err, data)=>{ + console.debug("====>getAccountsByOwner 1500 err:" + JSON.stringify(err)); + console.debug("====>getAccountsByOwner 1500 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data.length).assertEqual(0); + console.debug("====>GetAccountsByOwner_1500 end===="); + done(); + }) + }); + }) + }); + }); + + /* + * @tc.number : GetAccountsByOwner_1600 + * @tc.name : getAccountsByOwner promise + * @tc.desc : Get account information after adding and deleting account + */ + it('GetAccountsByOwner_1600', 0, async function (done) { + console.debug("====>GetAccountsByOwner_1600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>getAccountsByOwner for clean===="); + try{ + var acclist = await appAccountManager.getAccountsByOwner(SELFBUNDLE); + } + catch(err){ + console.error("====>getAccountsByOwner err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>account list length: " + acclist.length); + if(acclist.length > 0){ + for(var i = 0;i < acclist.length; i++){ + await appAccountManager.removeAccount(acclist[i].name); + } + } + console.debug("====>add account 1600 start===="); + await appAccountManager.createAccount("account_promise_delete"); + console.debug("====>first getAccountsByOwner 1600 start===="); + try{ + var data = await appAccountManager.getAccountsByOwner(SELFBUNDLE); + } + catch(err){ + console.error("====>getAccountsByOwner 1600 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + expect(data[0].name).assertEqual("account_promise_delete"); + expect(data[0].owner).assertEqual("com.example.actsgetaccountsbyowner"); + console.debug("====>delete account 1600 start===="); + await appAccountManager.removeAccount("account_promise_delete"); + console.debug("====>second getAccountsByOwner 1600 start===="); + try{ + var dataDelete = await appAccountManager.getAccountsByOwner(SELFBUNDLE); + } + catch(err){ + console.error("====>second getAccountsByOwner 1600 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + expect(dataDelete.length).assertEqual(0); + console.debug("====>GetAccountsByOwner_1600 end===="); + done(); + }); + + /* + * @tc.number : GetAccountsByOwner_1700 + * @tc.name : getAccountsByOwner callback + * @tc.desc : Get account information after adding an account with additional information and deleting an + * account + */ + it('GetAccountsByOwner_1700', 0, async function (done) { + console.debug("====>GetAccountsByOwner_1700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("account_callback_additional", createAccountOptions, (err)=>{ + console.debug("====>add account 1700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAccountsByOwner(SELFBUNDLE, (err, data)=>{ + console.debug("====>getAccountsByOwner 1700 err:" + JSON.stringify(err)); + console.debug("====>getAccountsByOwner 1700 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data[0].name).assertEqual("account_callback_additional"); + expect(data[0].owner).assertEqual("com.example.actsgetaccountsbyowner"); + appAccountManager.removeAccount("account_callback_additional", (err)=>{ + console.debug("====>delete account 1700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAccountsByOwner(SELFBUNDLE, (err, data)=>{ + console.debug("====>getAccountsByOwner 1700 err:" + JSON.stringify(err)); + console.debug("====>getAccountsByOwner 1700 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data.length).assertEqual(0); + console.debug("====>GetAccountsByOwner_1700 end===="); + done(); + }) + }); + }) + }); + }); + + /* + * @tc.number : GetAccountsByOwner_1800 + * @tc.name : getAccountsByOwner promise + * @tc.desc : Get account information after adding an account with additional information and deleting an + * account + */ + it('GetAccountsByOwner_1800', 0, async function (done) { + console.debug("====>GetAccountsByOwner_1800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>getAccountsByOwner for clean===="); + try{ + var acclist = await appAccountManager.getAccountsByOwner(SELFBUNDLE); + } + catch(err){ + console.error("====>getAccountsByOwner err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>account list length: " + acclist.length); + if(acclist.length > 0){ + for(var i = 0;i < acclist.length; i++){ + await appAccountManager.removeAccount(acclist[i].name); + } + } + console.debug("====>add account 1800 start===="); + await appAccountManager.createAccount("account_promise_additional", createAccountOptions); + console.debug("====>first getAccountsByOwner 1800 start===="); + try{ + var data = await appAccountManager.getAccountsByOwner(SELFBUNDLE); + } + catch(err){ + console.error("====>getAccountsByOwner 1800 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>first getAccountsByOwner 1800 data:" + JSON.stringify(data)); + expect(data[0].name).assertEqual("account_promise_additional"); + expect(data[0].owner).assertEqual("com.example.actsgetaccountsbyowner"); + console.debug("====>delete account 1800 start===="); + await appAccountManager.removeAccount("account_promise_additional"); + console.debug("====>second getAccountsByOwner 1800 start===="); + try{ + var dataDelete = await appAccountManager.getAccountsByOwner(SELFBUNDLE); + } + catch(err){ + console.error("====>second getAccountsByOwner 1800 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>second getAccountsByOwner 1800 data:" + JSON.stringify(data)); + expect(dataDelete.length).assertEqual(0); + console.debug("====>GetAccountsByOwner_1800 end===="); + done(); + }); + }) +} \ No newline at end of file diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/js/test/List.test.js b/account/appaccount/actsgetaccountsbyowner/src/main/js/test/List.test.js new file mode 100644 index 000000000..fa179292b --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import GetAccountsByOwner from './Getaccountsbyowner.test.js' + +export default function testsuite() { + GetAccountsByOwner() +} \ No newline at end of file diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/resources/base/element/string.json b/account/appaccount/actsgetaccountsbyowner/src/main/resources/base/element/string.json new file mode 100644 index 000000000..6e2452f1a --- /dev/null +++ b/account/appaccount/actsgetaccountsbyowner/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsGetAllAccounts" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/account/appaccount/actsgetaccountsbyowner/src/main/resources/base/media/icon.png b/account/appaccount/actsgetaccountsbyowner/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpB<l@9sw zy?6dOXX?(K?>l$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4Zzg<l*k=3l5TH`42AmvHedhz{2z& z6+bsw7KML=Or~18Op0DUFeWj6aXtqjQ9&jNDSjbwK~XUwUM68dAqfFNF#$nwK0zU{ zpd?sWi0OZcMGl`y#>deKtgoc<KeET3EQ^bu9~>+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NF<BRd8k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Cn^!?Kh})0(U0+w}pgNiSL>Q%N&t$}k?w+``2A=aotj0;2v$~AL z{scF-cL{wsdrmPvf#a9OHyYLcwQD4Kcm)`LLwMh4WT~p29f7M!iafJSU`IV}QY5Wa z(n44-9oA}?J{a+ah*@31WTs#&J#o1`H98#6IQf;Wv0N_!);f&9g7o-k(lW5rWnDUR zQBFIRG+X=6NnsI@mxnwm;tf5;_Uxg?jZ8m-m0}&6+DA!qam(p$mN5R})yA_7m$q@| zFEd|dpS595rxQr-n#GjI5i-AhnUE>Cr;jpCq<NG2-WoxlOPbfntZd`cG-kgX_H&`E zuk%ukIk14p{qK*fLz}vWOpIR?Cr;wWVd!|iw2F^$-Py&P3PO<cb(1)5fWITzL`2hW zxb?{>SrD~EwK_DqI^7%3#p5)%T_od!t3SOmH9MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-<tEu278X#CQp zQruTl^@@A;@99wA_Le>oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJL<k~a{}KP^0ew-EVGKm73>o%P>4I&$}y<EG|7-flk7U1byCfol%r zRq(+_wBzmq8c82N1TcaziET^jKK$H5cV$r;;CGKDIb+^eoOy*3L`cMt;?yr;9jVNq g9jT&p2BIGx8p5me=?Fj;|Gtl&DQhd$Ky4BK2beUY8~^|S literal 0 HcmV?d00001 diff --git a/account/appaccount/actsgetallaccounts/Test.json b/account/appaccount/actsgetallaccounts/Test.json index 309f568ea..9a6b63c13 100644 --- a/account/appaccount/actsgetallaccounts/Test.json +++ b/account/appaccount/actsgetallaccounts/Test.json @@ -3,8 +3,8 @@ "driver": { "type": "OHJSUnitTest", "test-timeout": "60000", - "bundle-name": "com.example.actsgetallaaccounts", - "package-name": "com.example.actsgetallaaccounts", + "bundle-name": "com.example.actsgetallaccounts", + "package-name": "com.example.actsgetallaccounts", "shell-timeout": "60000" }, "kits": [ diff --git a/account/appaccount/actsgetallaccounts/src/main/config.json b/account/appaccount/actsgetallaccounts/src/main/config.json index 0e0a22a31..26de14108 100644 --- a/account/appaccount/actsgetallaccounts/src/main/config.json +++ b/account/appaccount/actsgetallaccounts/src/main/config.json @@ -1,6 +1,6 @@ { "app": { - "bundleName": "com.example.actsgetallaaccounts", + "bundleName": "com.example.actsgetallaccounts", "vendor": "example", "version": { "code": 1, @@ -14,12 +14,12 @@ }, "deviceConfig": {}, "module": { - "package": "com.example.actsgetallaaccounts", + "package": "com.example.actsgetallaccounts", "name": ".entry", "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ - "default", + "default", "phone" ], "distro": { diff --git a/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js b/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js index dace9ca65..91baf102f 100755 --- a/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js +++ b/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js @@ -30,7 +30,7 @@ export default function ActsGetAllAccounts() { console.debug("====>ActsGetAllAccounts_0100 start===="); var appAccountManager = account.createAppAccountManager(); console.debug("====>creat finish===="); - var selfBundle = "com.example.actsgetallaaccounts"; + var selfBundle = "com.example.actsgetallaccounts"; appAccountManager.addAccount("Account_this_application_callback", (err)=>{ console.debug("====>add account 0100 err:" + JSON.stringify(err)); expect(err).assertEqual(null); @@ -40,7 +40,7 @@ export default function ActsGetAllAccounts() { expect(err).assertEqual(null); try{ expect(data[0].name).assertEqual("Account_this_application_callback"); - expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts"); + expect(data[0].owner).assertEqual("com.example.actsgetallaccounts"); } catch(err){ console.error("====>getAllAccounts 0100 fail err:" + JSON.stringify(err)); @@ -67,7 +67,7 @@ export default function ActsGetAllAccounts() { var appAccountManager = account.createAppAccountManager(); console.debug("====>creat finish===="); console.debug("====>getAllAccounts for clean===="); - var selfBundle = "com.example.actsgetallaaccounts"; + var selfBundle = "com.example.actsgetallaccounts"; try{ var acclist = await appAccountManager.getAllAccounts(selfBundle); } @@ -95,7 +95,7 @@ export default function ActsGetAllAccounts() { } try{ expect(data[0].name).assertEqual("Account_this_application_promise"); - expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts"); + expect(data[0].owner).assertEqual("com.example.actsgetallaccounts"); } catch(err){ console.error("====>check data 0200 fail err:" + JSON.stringify(err)); @@ -118,7 +118,7 @@ export default function ActsGetAllAccounts() { console.debug("====>ActsGetAllAccounts_0300 start===="); var appAccountManager = account.createAppAccountManager(); console.debug("====>creat finish===="); - var selfBundle = "com.example.actsgetallaaccounts"; + var selfBundle = "com.example.actsgetallaccounts"; appAccountManager.getAllAccounts(selfBundle, (err, data)=>{ console.debug("====>getAllAccounts 0300 err:" + JSON.stringify(err)); console.debug("====>getAllAccounts 0300 data:" + JSON.stringify(data)); @@ -140,7 +140,7 @@ export default function ActsGetAllAccounts() { var appAccountManager = account.createAppAccountManager(); console.debug("====>creat finish===="); console.debug("====>getAllAccounts for clean===="); - var selfBundle = "com.example.actsgetallaaccounts"; + var selfBundle = "com.example.actsgetallaccounts"; try{ var acclist = await appAccountManager.getAllAccounts(selfBundle); } @@ -256,7 +256,7 @@ export default function ActsGetAllAccounts() { console.debug("====>ActsGetAllAccounts_0900 start===="); var appAccountManager = account.createAppAccountManager(); console.debug("====>creat finish===="); - var selfBundle = "com.example.actsgetallaaccounts"; + var selfBundle = "com.example.actsgetallaccounts"; console.debug("====>add account 0900 start===="); await appAccountManager.addAccount("Account_application_callback"); console.debug("====>startAbility 0900 start===="); @@ -278,7 +278,7 @@ export default function ActsGetAllAccounts() { console.debug("====>getAllAccounts 0900 data:" + JSON.stringify(data)); expect(err).assertEqual(null); expect(data[0].name).assertEqual("Account_application_callback"); - expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts"); + expect(data[0].owner).assertEqual("com.example.actsgetallaccounts"); appAccountManager.deleteAccount("Account_application_callback", (err)=>{ console.debug("====>delete account 0900 err:" + JSON.stringify(err)); expect(err).assertEqual(null); @@ -302,7 +302,7 @@ export default function ActsGetAllAccounts() { console.debug("====>ActsGetAllAccounts_1000 start===="); var appAccountManager = account.createAppAccountManager(); console.debug("====>creat finish===="); - var selfBundle = "com.example.actsgetallaaccounts"; + var selfBundle = "com.example.actsgetallaccounts"; console.debug("====>add account 1000 start===="); await appAccountManager.addAccount("Account_application_promise"); console.debug("====>startAbility 1000 start===="); @@ -332,7 +332,7 @@ export default function ActsGetAllAccounts() { console.debug("====>getAllAccounts 1000 data:" + JSON.stringify(data)); try{ expect(data[0].name).assertEqual("Account_application_promise"); - expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts"); + expect(data[0].owner).assertEqual("com.example.actsgetallaccounts"); } catch(err){ console.error("====>check data 1000 fail err:" + JSON.stringify(err)); @@ -479,7 +479,7 @@ export default function ActsGetAllAccounts() { console.debug("====>ActsGetAllAccounts_1500 start===="); var appAccountManager = account.createAppAccountManager(); console.debug("====>creat finish===="); - var selfBundle = "com.example.actsgetallaaccounts"; + var selfBundle = "com.example.actsgetallaccounts"; appAccountManager.addAccount("account_callback_delete", (err)=>{ console.debug("====>add account 1500 err:" + JSON.stringify(err)); expect(err).assertEqual(null); @@ -488,7 +488,7 @@ export default function ActsGetAllAccounts() { console.debug("====>getAllAccounts 1500 data:" + JSON.stringify(data)); expect(err).assertEqual(null); expect(data[0].name).assertEqual("account_callback_delete"); - expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts"); + expect(data[0].owner).assertEqual("com.example.actsgetallaccounts"); appAccountManager.deleteAccount("account_callback_delete", (err)=>{ console.debug("====>delete account 1500 err:" + JSON.stringify(err)); expect(err).assertEqual(null); @@ -515,7 +515,7 @@ export default function ActsGetAllAccounts() { var appAccountManager = account.createAppAccountManager(); console.debug("====>creat finish===="); console.debug("====>getAllAccounts for clean===="); - var selfBundle = "com.example.actsgetallaaccounts"; + var selfBundle = "com.example.actsgetallaccounts"; try{ var acclist = await appAccountManager.getAllAccounts(selfBundle); } @@ -542,7 +542,7 @@ export default function ActsGetAllAccounts() { done(); } expect(data[0].name).assertEqual("account_promise_delete"); - expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts"); + expect(data[0].owner).assertEqual("com.example.actsgetallaccounts"); console.debug("====>delete account 1600 start===="); await appAccountManager.deleteAccount("account_promise_delete"); console.debug("====>second getAllAccounts 1600 start===="); @@ -569,7 +569,7 @@ export default function ActsGetAllAccounts() { console.debug("====>ActsGetAllAccounts_1700 start===="); var appAccountManager = account.createAppAccountManager(); console.debug("====>creat finish===="); - var selfBundle = "com.example.actsgetallaaccounts"; + var selfBundle = "com.example.actsgetallaccounts"; appAccountManager.addAccount("account_callback_additional", "account_extrainfo", (err)=>{ console.debug("====>add account 1700 err:" + JSON.stringify(err)); expect(err).assertEqual(null); @@ -578,7 +578,7 @@ export default function ActsGetAllAccounts() { console.debug("====>getAllAccounts 1700 data:" + JSON.stringify(data)); expect(err).assertEqual(null); expect(data[0].name).assertEqual("account_callback_additional"); - expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts"); + expect(data[0].owner).assertEqual("com.example.actsgetallaccounts"); appAccountManager.deleteAccount("account_callback_additional", (err)=>{ console.debug("====>delete account 1700 err:" + JSON.stringify(err)); expect(err).assertEqual(null); @@ -606,7 +606,7 @@ export default function ActsGetAllAccounts() { var appAccountManager = account.createAppAccountManager(); console.debug("====>creat finish===="); console.debug("====>getAllAccounts for clean===="); - var selfBundle = "com.example.actsgetallaaccounts"; + var selfBundle = "com.example.actsgetallaccounts"; try{ var acclist = await appAccountManager.getAllAccounts(selfBundle); } @@ -634,7 +634,7 @@ export default function ActsGetAllAccounts() { } console.debug("====>first getAllAccounts 1800 data:" + JSON.stringify(data)); expect(data[0].name).assertEqual("account_promise_additional"); - expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts"); + expect(data[0].owner).assertEqual("com.example.actsgetallaccounts"); console.debug("====>delete account 1800 start===="); await appAccountManager.deleteAccount("account_promise_additional"); console.debug("====>second getAllAccounts 1800 start===="); diff --git a/account/appaccount/actssetcheckdatasyncenable/BUILD.gn b/account/appaccount/actssetcheckdatasyncenable/BUILD.gn new file mode 100644 index 000000000..0444985eb --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSetCheckDataSyncEnableTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsSetCheckDataSyncEnableTest" + subsystem_name = "account" + part_name = "os_account" +} +ohos_js_assets("hjs_demo_js_assets") { + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" +} + +ohos_resources("hjs_demo_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/account/appaccount/actssetcheckdatasyncenable/Test.json b/account/appaccount/actssetcheckdatasyncenable/Test.json new file mode 100644 index 000000000..ecec00766 --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "60000", + "bundle-name": "com.example.actssetcheckdatasyncenable", + "package-name": "com.example.actssetcheckdatasyncenable", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsSetCheckDataSyncEnableTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/account/appaccount/actssetcheckdatasyncenable/signature/openharmony_sx.p7b b/account/appaccount/actssetcheckdatasyncenable/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6 GIT binary patch literal 3442 zcmcgvYj6|S6}BF>F-F+L*anwiBOa!J?7OmLOQwYEN~;%M$tz2?WlYUVT0LxOwU$<1 zS(Haa;)Zu=rr?H0Y#s&@105h3XNE^Z10^9aB$Vk;3~>l;p)@qbNk}NPE878^fghdB zpdZ>f=bn4-chC9Gcjtnbh)PPC(V}blR>Vu@x5Y$tASRm6=kXvBNKHyv*rMZ+0wJFV zVu@*w19@$+!~|hX_@71MCNdcE1}KRm;3UPR(5y!eituv|F;oBwfOwWT9QHanQx2ph zcBPV($X(o@tXS@pDCIyQA(SM5iexSq2`RW}rkRdU4w62S2$7tFplONI8)AZ9dzgvu zHy9BJ)p;p~bO(vJmkVqnd|s!QX%?3*5>o+2VkcdJU>uoTDN_{7rE<lrem~)2$ROt~ zRw!j9MVx!_EU`UIIenzWOSuB^=}xkV^aW@#DCvi8qDe|e1pNW3ncHU=7zY_-ye_YU zVB)AH@gIU}^~O9EYPRS#dKGLz`@OXkrq`>ms7eLfNjJ>u5!kIq36rWYs)jMd?QZlm z)SJq2Tn)2U7}H`ARTMTLZet|^+bnQ{(ZsD_##z*DQ&-~nJd|b19ooupg;vvSuTq9d z3tEFA4lN8>QB?%PEk%gW-r(^#{7{pfYH(L-D?PQ8-GbI*DzrZej$p)-QFt}N+O@uV zTeX?COJ!~xpsdd0Fk<y6i`B!;90rR%VzOY7D$Z+EH$<>{Eb_=#j|4D0#H#Rqj9Qd6 zs4exV6+`p`xI9={E%n5n5v>KT9yn*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sw1C7i80M~^ssbgpv!d$W#+ YX9HpW+h1JFRc8v8e%3PML|^*<0J%6(*8l(j literal 0 HcmV?d00001 diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/config.json b/account/appaccount/actssetcheckdatasyncenable/src/main/config.json new file mode 100644 index 000000000..5e6189439 --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/config.json @@ -0,0 +1,131 @@ +{ + "app": { + "bundleName": "com.example.actssetcheckdatasyncenable", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actssetcheckdatasyncenable", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "defPermissions": [ + { + "availableScope": [], + "grantMode": "user_grant", + "name": "ohos.permission.DISTRIBUTED_DATASYNC" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", + "reason": "ceshi" + }, + { + "name": "ohos.permission.DISTRIBUTED_DATASYNC", + "reason": "ceshi" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO", + "reason":"need use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } + } +} \ No newline at end of file diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/app.js b/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/app.js new file mode 100644 index 000000000..2a68c1992 --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/i18n/en-US.json b/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 000000000..e63c70d97 --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/i18n/zh-CN.json b/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 000000000..de6ee5748 --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/pages/index/index.css b/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 000000000..2334ecfa2 --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/pages/index/index.hml b/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 000000000..58fdc1444 --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,19 @@ +<!-- + Copyright (c) 2021 Huawei Device Co., Ltd. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<div class="container"> + <text class="title"> + {{title}} + </text> +</div> diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/pages/index/index.js b/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 000000000..8406ae568 --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "setAppAccountSyncEnableå’ŒcheckAppAccountSyncEnable" + }, + onInit() { + this.title = "setAppAccountSyncEnableå’ŒcheckAppAccountSyncEnable"; + }, + onShow() { + console.info('onShow finish') + + }, + onReady() { + }, +} \ No newline at end of file diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/app.js b/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/i18n/en-US.json b/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/i18n/zh-CN.json b/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/pages/index/index.css b/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..2b45eb97c --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 60px; + text-align: center; + width: 100%; + height: 40%; + margin: 10px; +} +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/pages/index/index.hml b/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ +<!-- + Copyright (c) 2021 Huawei Device Co., Ltd. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<div class="container" onswipe="touchMove"> + <text class="title"> + {{ $t('strings.hello') }} {{title}} + </text> + <input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input> +</div> diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/pages/index/index.js b/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/test/List.test.js b/account/appaccount/actssetcheckdatasyncenable/src/main/js/test/List.test.js new file mode 100644 index 000000000..3a69eebde --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ActsSetCheckDataSyncEnable from './Syncenable.test.js' + +export default function testsuite() { + ActsSetCheckDataSyncEnable() +} \ No newline at end of file diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/js/test/Syncenable.test.js b/account/appaccount/actssetcheckdatasyncenable/src/main/js/test/Syncenable.test.js new file mode 100644 index 000000000..ca3789d82 --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/js/test/Syncenable.test.js @@ -0,0 +1,575 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import account from '@ohos.account.appAccount' +import bundle from '@ohos.bundle' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +const TIMEOUT = 2000; +const PERMISSION_USER_SET = 1; +const PERMISSION_USER_NAME = "ohos.permission.DISTRIBUTED_DATASYNC"; +var tokenID = undefined; +export default function ActsSetCheckDataSyncEnabled() { + describe('ActsSetCheckDataSyncEnabled', function () { + beforeAll(async function (done) { + console.debug("====>beforeAll start===="); + var appInfo = await bundle.getApplicationInfo('com.example.actssetcheckdatasyncenable', 0, 100); + tokenID = appInfo.accessTokenId; + console.debug("accessTokenId" + appInfo.accessTokenId + " bundleName:" + appInfo.bundleName); + var atManager = abilityAccessCtrl.createAtManager(); + var result = await atManager.grantUserGrantedPermission(tokenID, PERMISSION_USER_NAME, PERMISSION_USER_SET); + console.debug("tokenId" + tokenID + " result:" + result); + sleep(TIMEOUT); + console.debug("====>beforeAll end===="); + done(); + }) + + function sleep(delay) { + var start = (new Date()).getTime(); + while((new Date()).getTime() - start < delay) { + continue; + } + } + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_0100 + * @tc.name : Check sync flag callback form + * @tc.desc : Get the synchronization flag of the account that has not set the synchronization flag + */ + it('ActsSetCheckDataSyncEnabled_0100', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("syncenable_callback_notset", (err)=>{ + console.debug("====>add account ActsSetCheckDataSyncEnabled_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkDataSyncEnabled("syncenable_callback_notset", (err, data)=>{ + console.debug("====>checkDataSyncEnabled 0100 err:" + JSON.stringify(err)); + console.debug("====>checkDataSyncEnabled 0100 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual(false); + appAccountManager.removeAccount("syncenable_callback_notset", (err)=>{ + console.debug("====>delete Account ActsSetCheckDataSyncEnabled_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsSetCheckDataSyncEnabled_0100 end===="); + done(); + }); + }) + }); + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_0200 + * @tc.name : Check sync flag promise form + * @tc.desc : Get the synchronization flag of the account that has not set the synchronization flag + */ + it('ActsSetCheckDataSyncEnabled_0200', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsSetCheckDataSyncEnabled_0200 start===="); + try{ + await appAccountManager.createAccount("syncenable_promise_notset"); + } + catch(err){ + console.error("====>add account ActsSetCheckDataSyncEnabled_0200 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>checkDataSyncEnabled ActsSetCheckDataSyncEnabled_0200 start===="); + try{ + var data = await appAccountManager.checkDataSyncEnabled("syncenable_promise_notset"); + } + catch(err){ + console.error("====>checkDataSyncEnabled 0200 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>checkDataSyncEnabled 0200 data:" + JSON.stringify(data)); + expect(data).assertEqual(false); + console.debug("====>delete account ActsSetCheckDataSyncEnabled_0200 start===="); + try{ + await appAccountManager.removeAccount("syncenable_promise_notset"); + } + catch(err){ + console.error("====>delete account 0200 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsSetCheckDataSyncEnabled_0200 end===="); + done(); + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_0300 + * @tc.name : Check the set synchronization flag callback form + * @tc.desc : Check the synchronization flag after setting the synchronization flag to true for the account + */ + it('ActsSetCheckDataSyncEnabled_0300', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("syncenable_callback_settrue", (err)=>{ + console.debug("====>add account ActsSetCheckDataSyncEnabled_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setDataSyncEnabled("syncenable_callback_settrue", true, (err)=>{ + console.debug("====>setDataSyncEnabled 0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkDataSyncEnabled("syncenable_callback_settrue", (err, data)=>{ + console.debug("====>checkDataSyncEnabled 0300 err:" + JSON.stringify(err)); + console.debug("====>checkDataSyncEnabled 0300 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual(true); + appAccountManager.removeAccount("syncenable_callback_settrue", (err)=>{ + console.debug("====>delete Account ActsSetCheckDataSyncEnabled_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsSetCheckDataSyncEnabled_0300 end===="); + done(); + }); + }) + }) + }); + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_0400 + * @tc.name : Check the set synchronization flag promise form + * @tc.desc : Check the synchronization flag after setting the synchronization flag to true for the account + */ + it('ActsSetCheckDataSyncEnabled_0400', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_0400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsSetCheckDataSyncEnabled_0400 start===="); + try{ + await appAccountManager.createAccount("syncenable_promise_settrue"); + } + catch(err){ + console.error("====>add account ActsSetCheckDataSyncEnabled_0400 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>setDataSyncEnabled ActsSetCheckDataSyncEnabled_0400 start===="); + await appAccountManager.setDataSyncEnabled("syncenable_promise_settrue", true); + console.debug("====>checkDataSyncEnabled ActsSetCheckDataSyncEnabled_0400 start===="); + try{ + var data = await appAccountManager.checkDataSyncEnabled("syncenable_promise_settrue"); + } + catch(err){ + console.error("====>checkDataSyncEnabled 0400 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>checkDataSyncEnabled 0400 data:" + JSON.stringify(data)); + expect(data).assertEqual(true); + console.debug("====>delete account ActsSetCheckDataSyncEnabled_0400 start===="); + try{ + await appAccountManager.removeAccount("syncenable_promise_settrue"); + } + catch(err){ + console.error("====>delete account 0400 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsSetCheckDataSyncEnabled_0400 end===="); + done(); + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_0500 + * @tc.name : Check the set synchronization flag callback form + * @tc.desc : Check the synchronization flag after setting the synchronization flag to false for the account + */ + it('ActsSetCheckDataSyncEnabled_0500', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_0500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("syncenable_callback_setfalse", (err)=>{ + console.debug("====>add account ActsSetCheckDataSyncEnabled_0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setDataSyncEnabled("syncenable_callback_setfalse", false, (err)=>{ + console.debug("====>setDataSyncEnabled 0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkDataSyncEnabled("syncenable_callback_setfalse", (err, data)=>{ + console.debug("====>checkDataSyncEnabled 0500 err:" + JSON.stringify(err)); + console.debug("====>checkDataSyncEnabled 0500 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual(false); + appAccountManager.removeAccount("syncenable_callback_setfalse", (err)=>{ + console.debug("====>delete Account ActsSetCheckDataSyncEnabled_0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsSetCheckDataSyncEnabled_0500 end===="); + done(); + }); + }) + }) + }); + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_0600 + * @tc.name : Check the set synchronization flag promise form + * @tc.desc : Check the synchronization flag after setting the synchronization flag to false for the account + */ + it('ActsSetCheckDataSyncEnabled_0600', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_0600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsSetCheckDataSyncEnabled_0600 start===="); + try{ + await appAccountManager.createAccount("syncenable_promise_setfalse"); + } + catch(err){ + console.error("====>add account ActsSetCheckDataSyncEnabled_0600 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>setDataSyncEnabled ActsSetCheckDataSyncEnabled_0600 start===="); + await appAccountManager.setDataSyncEnabled("syncenable_promise_setfalse", false); + console.debug("====>checkDataSyncEnabled ActsSetCheckDataSyncEnabled_0600 start===="); + try{ + var data = await appAccountManager.checkDataSyncEnabled("syncenable_promise_setfalse"); + } + catch(err){ + console.error("====>checkDataSyncEnabled 0600 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>checkDataSyncEnabled 0600 data:" + JSON.stringify(data)); + expect(data).assertEqual(false); + console.debug("====>delete account ActsSetCheckDataSyncEnabled_0600 start===="); + try{ + await appAccountManager.removeAccount("syncenable_promise_setfalse"); + } + catch(err){ + console.error("====>delete account 0600 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsSetCheckDataSyncEnabled_0600 end===="); + done(); + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_0700 + * @tc.name : Check the set synchronization flag callback form + * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to false + * for the first time and true for the second time + */ + it('ActsSetCheckDataSyncEnabled_0700', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_0700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("syncenable_callback_falsetrue", (err)=>{ + console.debug("====>add account ActsSetCheckDataSyncEnabled_0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setDataSyncEnabled("syncenable_callback_falsetrue", false, (err)=>{ + console.debug("====>setDataSyncEnabled first time 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setDataSyncEnabled("syncenable_callback_falsetrue", true, (err)=>{ + console.debug("====>setDataSyncEnabled second time 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkDataSyncEnabled("syncenable_callback_falsetrue", (err, data)=>{ + console.debug("====>checkDataSyncEnabled 0700 err:" + JSON.stringify(err)); + console.debug("====>checkDataSyncEnabled 0700 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual(true); + appAccountManager.removeAccount("syncenable_callback_falsetrue", (err)=>{ + console.debug("====>delete Account 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsSetCheckDataSyncEnabled_0700 end===="); + done(); + }); + }) + }) + }) + }); + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_0800 + * @tc.name : Check the set synchronization flag promise form + * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to false + * for the first time and true for the second time + */ + it('ActsSetCheckDataSyncEnabled_0800', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_0800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsSetCheckDataSyncEnabled_0800 start===="); + await appAccountManager.createAccount("syncenable_promise_truefalse"); + console.debug("====>setDataSyncEnabled first time ActsSetCheckDataSyncEnabled_0800 start===="); + await appAccountManager.setDataSyncEnabled("syncenable_promise_truefalse", false); + console.debug("====>setDataSyncEnabled second time ActsSetCheckDataSyncEnabled_0800 start===="); + await appAccountManager.setDataSyncEnabled("syncenable_promise_truefalse", true); + console.debug("====>checkDataSyncEnabled ActsSetCheckDataSyncEnabled_0800 start===="); + try{ + var data = await appAccountManager.checkDataSyncEnabled("syncenable_promise_truefalse"); + } + catch(err){ + console.error("====>checkDataSyncEnabled 0800 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>checkDataSyncEnabled 0800 data:" + JSON.stringify(data)); + expect(data).assertEqual(true); + console.debug("====>delete account ActsSetCheckDataSyncEnabled_0800 start===="); + try{ + await appAccountManager.removeAccount("syncenable_promise_truefalse"); + } + catch(err){ + console.error("====>delete account 0800 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsSetCheckDataSyncEnabled_0800 end===="); + done(); + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_0900 + * @tc.name : Check the set synchronization flag callback form + * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to true + * for the first time and false for the second time + */ + it('ActsSetCheckDataSyncEnabled_0900', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_0900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("syncenable_callback_falsetrue", (err)=>{ + console.debug("====>add account ActsSetCheckDataSyncEnabled_0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setDataSyncEnabled("syncenable_callback_falsetrue", true, (err)=>{ + console.debug("====>setDataSyncEnabled first time 0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setDataSyncEnabled("syncenable_callback_falsetrue", false, (err)=>{ + console.debug("====>setDataSyncEnabled second time 0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkDataSyncEnabled("syncenable_callback_falsetrue", (err, data)=>{ + console.debug("====>checkDataSyncEnabled 0900 err:" + JSON.stringify(err)); + console.debug("====>checkDataSyncEnabled 0900 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual(false); + appAccountManager.removeAccount("syncenable_callback_falsetrue", (err)=>{ + console.debug("====>delete Account 0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsSetCheckDataSyncEnabled_0900 end===="); + done(); + }); + }) + }) + }) + }); + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_1000 + * @tc.name : Check the set synchronization flag promise form + * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to true + * for the first time and false for the second time + */ + it('ActsSetCheckDataSyncEnabled_1000', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_1000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsSetCheckDataSyncEnabled_1000 start===="); + await appAccountManager.createAccount("syncenable_promise_truefalse"); + console.debug("====>setDataSyncEnabled first time ActsSetCheckDataSyncEnabled_1000 start===="); + await appAccountManager.setDataSyncEnabled("syncenable_promise_truefalse", true); + console.debug("====>setDataSyncEnabled second time ActsSetCheckDataSyncEnabled_1000 start===="); + await appAccountManager.setDataSyncEnabled("syncenable_promise_truefalse", false); + console.debug("====>checkDataSyncEnabled ActsSetCheckDataSyncEnabled_1000 start===="); + try{ + var data = await appAccountManager.checkDataSyncEnabled("syncenable_promise_truefalse"); + } + catch(err){ + console.error("====>checkDataSyncEnabled 1000 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>checkDataSyncEnabled 1000 data:" + JSON.stringify(data)); + expect(data).assertEqual(false); + console.debug("====>delete account ActsSetCheckDataSyncEnabled_1000 start===="); + try{ + await appAccountManager.removeAccount("syncenable_promise_truefalse"); + } + catch(err){ + console.error("====>delete account 1000 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsSetCheckDataSyncEnabled_1000 end===="); + done(); + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_1100 + * @tc.name : Check the set synchronization flag callback form + * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to true + * for the first time and true for the second time + */ + it('ActsSetCheckDataSyncEnabled_1100', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_1100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("syncenable_callback_truetrue", (err)=>{ + console.debug("====>add account ActsSetCheckDataSyncEnabled_1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setDataSyncEnabled("syncenable_callback_truetrue", true, (err)=>{ + console.debug("====>setDataSyncEnabled first time 1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setDataSyncEnabled("syncenable_callback_truetrue", true, (err)=>{ + console.debug("====>setDataSyncEnabled second time 1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.checkDataSyncEnabled("syncenable_callback_truetrue", (err, data)=>{ + console.debug("====>checkDataSyncEnabled 1100 err:" + JSON.stringify(err)); + console.debug("====>checkDataSyncEnabled 1100 data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual(true); + appAccountManager.removeAccount("syncenable_callback_truetrue", (err)=>{ + console.debug("====>delete Account 1100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsSetCheckDataSyncEnabled_1100 end===="); + done(); + }); + }) + }) + }) + }); + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_1200 + * @tc.name : Check the set synchronization flag promise form + * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to true + * for the true time and true for the second time + */ + it('ActsSetCheckDataSyncEnabled_1200', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_1200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account ActsSetCheckDataSyncEnabled_1200 start===="); + await appAccountManager.createAccount("syncenable_promise_truetrue"); + console.debug("====>setDataSyncEnabled first time ActsSetCheckDataSyncEnabled_1200 start===="); + await appAccountManager.setDataSyncEnabled("syncenable_promise_truetrue", true); + console.debug("====>setDataSyncEnabled second time ActsSetCheckDataSyncEnabled_1200 start===="); + await appAccountManager.setDataSyncEnabled("syncenable_promise_truetrue", true); + console.debug("====>checkDataSyncEnabled ActsSetCheckDataSyncEnabled_1200 start===="); + try{ + var data = await appAccountManager.checkDataSyncEnabled("syncenable_promise_truetrue"); + } + catch(err){ + console.error("====>checkDataSyncEnabled 1200 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>checkDataSyncEnabled 1200 data:" + JSON.stringify(data)); + expect(data).assertEqual(true); + console.debug("====>delete account ActsSetCheckDataSyncEnabled_1200 start===="); + try{ + await appAccountManager.removeAccount("syncenable_promise_truetrue"); + } + catch(err){ + console.error("====>delete account 1200 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>ActsSetCheckDataSyncEnabled_1200 end===="); + done(); + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_1300 + * @tc.name : setDataSyncEnabled callback form + * @tc.desc : Set synchronization flag for non-existent account + */ + it('ActsSetCheckDataSyncEnabled_1300', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_1300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>setDataSyncEnabled ActsSetCheckDataSyncEnabled_1300 start====") + var accountNotExist = "syncenable_callback_notexist"; + appAccountManager.setDataSyncEnabled(accountNotExist, true, (err)=>{ + console.debug("====>setDataSyncEnabled 1300 err:" + JSON.stringify(err)); + expect(err.code == 12300003).assertEqual(true); + console.debug("====>ActsSetCheckDataSyncEnabled_1300 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_1400 + * @tc.name : setDataSyncEnabled promise form + * @tc.desc : Set synchronization flag for non-existent account + */ + it('ActsSetCheckDataSyncEnabled_1400', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_1400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>setDataSyncEnabled ActsSetCheckDataSyncEnabled_1400 start====") + var accountNotExist = "syncenable_promise_notexist"; + try{ + await appAccountManager.setDataSyncEnabled(accountNotExist, true); + } + catch(err){ + console.debug("====>setDataSyncEnabled 1400 err:" + JSON.stringify(err)); + expect(err.code == 12300003).assertEqual(true); + console.debug("====>ActsSetCheckDataSyncEnabled_1400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_1500 + * @tc.name : checkDataSyncEnabled callback form + * @tc.desc : Check synchronization flag for non-existent account + */ + it('ActsSetCheckDataSyncEnabled_1500', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_1500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>checkDataSyncEnabled ActsSetCheckDataSyncEnabled_1500 start====") + var accountNotExist = "syncenable_callback_notexist"; + appAccountManager.checkDataSyncEnabled(accountNotExist, (err, data)=>{ + console.debug("====>checkDataSyncEnabled 1500 err:" + JSON.stringify(err)); + expect(err.code == 12300003).assertEqual(true); + console.debug("====>ActsSetCheckDataSyncEnabled_1500 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsSetCheckDataSyncEnabled_1600 + * @tc.name : checkDataSyncEnabled promise form + * @tc.desc : Check synchronization flag for non-existent account + */ + it('ActsSetCheckDataSyncEnabled_1600', 0, async function (done) { + console.debug("====>ActsSetCheckDataSyncEnabled_1600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>checkDataSyncEnabled ActsSetCheckDataSyncEnabled_1600 start====") + var accountNotExist = "syncenable_promise_notexist"; + try{ + await appAccountManager.checkDataSyncEnabled(accountNotExist); + } + catch(err){ + console.debug("====>checkDataSyncEnabled 1600 err:" + JSON.stringify(err)); + expect(err.code == 12300003).assertEqual(true); + console.debug("====>ActsSetCheckDataSyncEnabled_1600 end===="); + done(); + } + }); + }) +} \ No newline at end of file diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/resources/base/element/string.json b/account/appaccount/actssetcheckdatasyncenable/src/main/resources/base/element/string.json new file mode 100644 index 000000000..89f90a73a --- /dev/null +++ b/account/appaccount/actssetcheckdatasyncenable/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsSetCheckSyncEnable" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/account/appaccount/actssetcheckdatasyncenable/src/main/resources/base/media/icon.png b/account/appaccount/actssetcheckdatasyncenable/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpB<l@9sw zy?6dOXX?(K?>l$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4Zzg<l*k=3l5TH`42AmvHedhz{2z& z6+bsw7KML=Or~18Op0DUFeWj6aXtqjQ9&jNDSjbwK~XUwUM68dAqfFNF#$nwK0zU{ zpd?sWi0OZcMGl`y#>deKtgoc<KeET3EQ^bu9~>+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg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ynRK;sBjCb2iZR^+uPrXpvPS~Bh}IAbd8$ss8H+AYHeyc-Wk6rr)A$n`FT)uR zt<_77<RQx&`x6_Cn^!?Kh})0(U0+w}pgNiSL>Q%N&t$}k?w+``2A=aotj0;2v$~AL z{scF-cL{wsdrmPvf#a9OHyYLcwQD4Kcm)`LLwMh4WT~p29f7M!iafJSU`IV}QY5Wa z(n44-9oA}?J{a+ah*@31WTs#&J#o1`H98#6IQf;Wv0N_!);f&9g7o-k(lW5rWnDUR zQBFIRG+X=6NnsI@mxnwm;tf5;_Uxg?jZ8m-m0}&6+DA!qam(p$mN5R})yA_7m$q@| zFEd|dpS595rxQr-n#GjI5i-AhnUE>Cr;jpCq<NG2-WoxlOPbfntZd`cG-kgX_H&`E zuk%ukIk14p{qK*fLz}vWOpIR?Cr;wWVd!|iw2F^$-Py&P3PO<cb(1)5fWITzL`2hW zxb?{>SrD~EwK_DqI^7%3#p5)%T_od!t3SOmH9MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-<tEu278X#CQp zQruTl^@@A;@99wA_Le>oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJL<k~a{}KP^0ew-EVGKm73>o%P>4I&$}y<EG|7-flk7U1byCfol%r zRq(+_wBzmq8c82N1TcaziET^jKK$H5cV$r;;CGKDIb+^eoOy*3L`cMt;?yr;9jVNq g9jT&p2BIGx8p5me=?Fj;|Gtl&DQhd$Ky4BK2beUY8~^|S literal 0 HcmV?d00001 diff --git a/account/appaccount/getallaccounts/BUILD.gn b/account/appaccount/getallaccounts/BUILD.gn new file mode 100644 index 000000000..e2fb5c041 --- /dev/null +++ b/account/appaccount/getallaccounts/BUILD.gn @@ -0,0 +1,24 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +group("getallaccounts") { + testonly = true + if (is_standard_system) { + deps = [ + "getallaccountsnoparameter:GetAllAccountsNoParameter", + "getmultipleaccounts:GetMultipleAccountsTest", + ] + } +} diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/BUILD.gn b/account/appaccount/getallaccounts/getallaccountsnoparameter/BUILD.gn new file mode 100644 index 000000000..8def05bca --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("GetAllAccountsNoParameter") { + hap_profile = "./src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "GetAllAccountsNoParameter" + subsystem_name = "account" + part_name = "os_account" +} +ohos_js_assets("hjs_demo_js_assets") { + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" +} + +ohos_resources("hjs_demo_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/Test.json b/account/appaccount/getallaccounts/getallaccountsnoparameter/Test.json new file mode 100644 index 000000000..67db914bd --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "60000", + "bundle-name": "com.example.getallaccountsnoparameter", + "package-name": "com.example.getallaccountsnoparameter", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "GetAllAccountsNoParameter.hap", + "ActsAccountSceneAccessible.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/signature/openharmony_sx.p7b b/account/appaccount/getallaccounts/getallaccountsnoparameter/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6 GIT binary patch literal 3442 zcmcgvYj6|S6}BF>F-F+L*anwiBOa!J?7OmLOQwYEN~;%M$tz2?WlYUVT0LxOwU$<1 zS(Haa;)Zu=rr?H0Y#s&@105h3XNE^Z10^9aB$Vk;3~>l;p)@qbNk}NPE878^fghdB zpdZ>f=bn4-chC9Gcjtnbh)PPC(V}blR>Vu@x5Y$tASRm6=kXvBNKHyv*rMZ+0wJFV zVu@*w19@$+!~|hX_@71MCNdcE1}KRm;3UPR(5y!eituv|F;oBwfOwWT9QHanQx2ph zcBPV($X(o@tXS@pDCIyQA(SM5iexSq2`RW}rkRdU4w62S2$7tFplONI8)AZ9dzgvu zHy9BJ)p;p~bO(vJmkVqnd|s!QX%?3*5>o+2VkcdJU>uoTDN_{7rE<lrem~)2$ROt~ zRw!j9MVx!_EU`UIIenzWOSuB^=}xkV^aW@#DCvi8qDe|e1pNW3ncHU=7zY_-ye_YU zVB)AH@gIU}^~O9EYPRS#dK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S}yV6ZJbk=JtmW}sx>HmH4R#)aHw=Rw0 z#Ol<D0K2C&*lzBcCb|D^b>{~gHl)Aro86NYoABWEtHw3K8*7Q{w2fKg{!sST?8^mE zj0bZho5Q^hK*Mt><KT@t^dZvb1>+t)L{bD0H}=Exg$E`)GEx$uH11O5u0)^&a(S_= zqy`i|9u-1jVcuFgr(k5xqD<o)ap%leTc`f@<eg%?EUR~iyN`C<JKhRLKDx>ILM=e~ zc{#;vD-tsmmGjTOa;B*7yD=xXwyzeC*e}ny+-|#O-3sw1C7i80M~^ssbgpv!d$W#+ YX9HpW+h1JFRc8v8e%3PML|^*<0J%6(*8l(j literal 0 HcmV?d00001 diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/config.json b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/config.json new file mode 100644 index 000000000..108d3d283 --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/config.json @@ -0,0 +1,127 @@ +{ + "app": { + "bundleName": "com.example.getallaccountsnoparameter", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.getallaccountsnoparameter", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "ohos.permission.GET_ALL_APP_ACCOUNTS" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.GET_ALL_APP_ACCOUNTS", + "reason": "ceshi" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO", + "reason":"need use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } + } +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/app.js b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/app.js new file mode 100644 index 000000000..2a68c1992 --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/i18n/en-US.json b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 000000000..e63c70d97 --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/i18n/zh-CN.json b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 000000000..de6ee5748 --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/pages/index/index.css b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 000000000..2334ecfa2 --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/pages/index/index.hml b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 000000000..58fdc1444 --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,19 @@ +<!-- + Copyright (c) 2021 Huawei Device Co., Ltd. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<div class="container"> + <text class="title"> + {{title}} + </text> +</div> diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/pages/index/index.js b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 000000000..7ffbf87ea --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "getAllAccessibleAccounts" + }, + onInit() { + this.title = "getAllAccessibleAccounts"; + }, + onShow() { + console.info('onShow finish') + }, + onReady() { + }, +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/app.js b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/i18n/en-US.json b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/i18n/zh-CN.json b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/pages/index/index.css b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..1ba8e4e82 --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} + + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/pages/index/index.hml b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ +<!-- + Copyright (c) 2021 Huawei Device Co., Ltd. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<div class="container" onswipe="touchMove"> + <text class="title"> + {{ $t('strings.hello') }} {{title}} + </text> + <input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input> +</div> diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/pages/index/index.js b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/test/Getallaccounts.test.js b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/test/Getallaccounts.test.js new file mode 100644 index 000000000..5527cc73d --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/test/Getallaccounts.test.js @@ -0,0 +1,600 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import account from '@ohos.account.appAccount' +import featureAbility from '@ohos.ability.featureAbility' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +const TIMEOUT = 2000; +const SELFBUNDLE = 'com.example.getallaccountsnoparameter' +export default function ActsGetAllAccountsNoParameter() { + describe('ActsGetAllAccountsNoParameter', function () { + + /* + * @tc.number : ActsGetAllAccountsNoParameter_0100 + * @tc.name : getAllAccounts callback + * @tc.desc : This application has not added an account and has not been authorized by other applications to + * obtain authorization + */ + it('ActsGetAllAccountsNoParameter_0100', 0, async function (done) { + console.debug("====>ActsGetAllAccountsNoParameter_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.getAllAccounts((err, data)=>{ + console.debug("====>getAllAccounts 0100 err:" + JSON.stringify(err)); + console.debug("====>getAllAccounts 0100 data:" + JSON.stringify(data)); + console.debug("====>getAllAccounts 0100 data.length:" + data.length); + expect(err).assertEqual(null); + expect(data.length).assertEqual(0); + console.debug("====>ActsGetAllAccountsNoParameter_0100 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsGetAllAccountsNoParameter_0200 + * @tc.name : getAllAccounts promise + * @tc.desc : This application has not added an account and has not been authorized by other applications to + * obtain authorization + */ + it('ActsGetAllAccountsNoParameter_0200', 0, async function (done) { + console.debug("====>ActsGetAllAccountsNoParameter_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>getAllAccounts 0200 start===="); + try{ + var data = await appAccountManager.getAllAccounts(); + } + catch(err){ + console.error("====>getAllAccounts 0200 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAllAccounts 0200 data:" + JSON.stringify(data)); + console.debug("====>getAllAccounts 0200 data.length:" + data.length); + expect(data.length).assertEqual(0); + console.debug("====>ActsGetAllAccountsNoParameter_0200 end===="); + done(); + }); + + /* + * @tc.number : ActsGetAllAccountsNoParameter_0300 + * @tc.name : getAllAccounts callback + * @tc.desc : This application gets authorization after adding a single account + */ + it('ActsGetAllAccountsNoParameter_0300', 0, async function (done) { + console.debug("====>ActsGetAllAccountsNoParameter_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("accessibleAccount_callback_single", (err)=>{ + console.debug("====> add account ActsGetAllAccountsNoParameter_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAccounts((err, data)=>{ + console.debug("====>getAllAccounts 0300 err:" + JSON.stringify(err)); + console.debug("====>getAllAccounts 0300 data:" + JSON.stringify(data)); + console.debug("====>getAllAccounts 0300 data.length:" + data.length); + expect(err).assertEqual(null); + expect(data.length).assertEqual(1); + try{ + expect(data[0].name).assertEqual("accessibleAccount_callback_single"); + expect(data[0].owner).assertEqual("com.example.getallaccountsnoparameter"); + } + catch(err){ + console.error("====>getAllAccounts check data 0300 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + appAccountManager.removeAccount("accessibleAccount_callback_single", (err)=>{ + console.debug("====>delete Account ActsGetAllAccountsNoParameter_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsGetAllAccountsNoParameter_0300 end===="); + done(); + }) + }); + }); + }); + + /* + * @tc.number : ActsGetAllAccountsNoParameter_0400 + * @tc.name : getAllAccounts promise + * @tc.desc : This application gets authorization after adding a single account + */ + it('ActsGetAllAccountsNoParameter_0400', 0, async function (done) { + console.debug("====>ActsGetAllAccountsNoParameter_0400 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>getAllAccounts for clean===="); + try{ + var acclist = await appAccountManager.getAllAccounts(SELFBUNDLE); + } + catch(err){ + console.error("====>getAllAccounts err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>account list length: " + acclist.length); + if(acclist.length > 0){ + for(var i = 0;i < acclist.length; i++){ + await appAccountManager.removeAccount(acclist[i].name); + } + } + console.debug("====>add account ActsGetAllAccountsNoParameter_0400 start===="); + await appAccountManager.createAccount("accessibleAccount_promise_single"); + console.debug("====>getAllAccounts 0400 start===="); + try{ + var data = await appAccountManager.getAllAccounts(); + } + catch(err){ + console.error("====>getAllAccounts 0400 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAllAccounts 0400 data:" + JSON.stringify(data)); + console.debug("====>getAllAccounts 0400 data.length:" + data.length); + try{ + expect(data[0].name).assertEqual("accessibleAccount_promise_single"); + expect(data[0].owner).assertEqual("com.example.getallaccountsnoparameter"); + } + catch(err){ + console.error("====>getAllAccounts check data 0400 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + await appAccountManager.removeAccount("accessibleAccount_promise_single"); + console.debug("====>ActsGetAllAccountsNoParameter_0400 end===="); + done(); + }); + + /* + * @tc.number : ActsGetAllAccountsNoParameter_0500 + * @tc.name : getAllAccounts callback + * @tc.desc : This application is added to obtain authorization after adding multiple application accounts + */ + it('ActsGetAllAccountsNoParameter_0500', 0, async function (done) { + console.debug("====>ActsGetAllAccountsNoParameter_0500 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("accessibleAccount_callback_first", (err)=>{ + console.debug("====>add account first time 0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.createAccount("accessibleAccount_callback_second", (err)=>{ + console.debug("====>add account second time 0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.createAccount("accessibleAccount_callback_third", (err)=>{ + console.debug("====>add account third time 0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAccounts((err, data)=>{ + console.debug("====>getAllAccounts 0500 err:" + JSON.stringify(err)); + console.debug("====>getAllAccounts 0500 data:" + JSON.stringify(data)); + console.debug("====>getAllAccounts 0500 data.length:" + data.length); + expect(err).assertEqual(null); + expect(data.length).assertEqual(3); + try{ + expect(data[0].name).assertEqual("accessibleAccount_callback_first"); + expect(data[0].owner).assertEqual("com.example.getallaccountsnoparameter"); + expect(data[1].name).assertEqual("accessibleAccount_callback_second"); + expect(data[1].owner).assertEqual("com.example.getallaccountsnoparameter"); + expect(data[2].name).assertEqual("accessibleAccount_callback_third"); + expect(data[2].owner).assertEqual("com.example.getallaccountsnoparameter"); + } + catch(err){ + console.error("====>check data 0500 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + appAccountManager.removeAccount("accessibleAccount_callback_first", (err)=>{ + console.debug("====>delete Account first 0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("accessibleAccount_callback_second", (err)=>{ + console.debug("====>delete Account second 0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("accessibleAccount_callback_third", (err)=>{ + console.debug("====>delete Account third 0500 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsGetAllAccountsNoParameter_0500 end===="); + done(); + }) + }) + }) + }); + }) + }) + }); + }); + + /* + * @tc.number : ActsGetAllAccountsNoParameter_0600 + * @tc.name : getAllAccounts promise + * @tc.desc : This application is added to obtain authorization after adding multiple application accounts + */ + it('ActsGetAllAccountsNoParameter_0600', 0, async function (done) { + console.debug("====>ActsGetAllAccountsNoParameter_0600 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>getAllAccounts for clean===="); + try{ + var acclist = await appAccountManager.getAllAccounts(SELFBUNDLE); + } + catch(err){ + console.error("====>getAllAccounts err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>account list length: " + acclist.length); + if(acclist.length > 0){ + for(var i = 0;i < acclist.length; i++){ + await appAccountManager.removeAccount(acclist[i].name); + } + } + console.debug("====>add first account 0600 start===="); + await appAccountManager.createAccount("accessibleAccount_promise_first"); + console.debug("====>add second account 0600 start===="); + await appAccountManager.createAccount("accessibleAccount_promise_second"); + console.debug("====>add third account 0600 start===="); + await appAccountManager.createAccount("accessibleAccount_promise_third"); + try{ + var data = await appAccountManager.getAllAccounts(); + } + catch(err){ + console.error("====>getAllAccounts 0600 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAllAccounts 0600 data:" + JSON.stringify(data)); + expect(data.length).assertEqual(3); + try{ + expect(data[0].name).assertEqual("accessibleAccount_promise_first"); + expect(data[0].owner).assertEqual("com.example.getallaccountsnoparameter"); + expect(data[1].name).assertEqual("accessibleAccount_promise_second"); + expect(data[1].owner).assertEqual("com.example.getallaccountsnoparameter"); + expect(data[2].name).assertEqual("accessibleAccount_promise_third"); + expect(data[2].owner).assertEqual("com.example.getallaccountsnoparameter"); + } + catch(err){ + console.error("====>check data 0600 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>delete first account 0600 start===="); + await appAccountManager.removeAccount("accessibleAccount_promise_first"); + console.debug("====>delete second account 0600 start===="); + await appAccountManager.removeAccount("accessibleAccount_promise_second"); + console.debug("====>delete third account 0600 start===="); + await appAccountManager.removeAccount("accessibleAccount_promise_third"); + console.debug("====>ActsGetAllAccountsNoParameter_0600 end===="); + done(); + }); + + /* + * @tc.number : ActsGetAllAccountsNoParameter_0700 + * @tc.name : getAllAccounts callback + * @tc.desc : This application adds different application accounts three times in a row, and obtains + * authorization after deleting the account added for the second time + */ + it('ActsGetAllAccountsNoParameter_0700', 0, async function (done) { + console.debug("====>ActsGetAllAccountsNoParameter_0700 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("accessibleAccount_callback_delete_first", (err)=>{ + console.debug("====>add first account 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.createAccount("accessibleAccount_callback_delete_second", (err)=>{ + console.debug("====>add second account 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.createAccount("accessibleAccount_callback_delete_third", (err)=>{ + console.debug("====>add third account 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("accessibleAccount_callback_delete_second", (err)=>{ + console.debug("====>delete second account 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAccounts((err, data)=>{ + console.debug("====>getAllAccounts 0700 err:" + JSON.stringify(err)); + console.debug("====>getAllAccounts 0700 data:" + JSON.stringify(data)); + console.debug("====>getAllAccounts 0700 data.length:" + data.length); + expect(err).assertEqual(null); + expect(data.length).assertEqual(2); + try{ + expect(data[0].name).assertEqual("accessibleAccount_callback_delete_first"); + expect(data[0].owner).assertEqual("com.example.getallaccountsnoparameter"); + expect(data[1].name).assertEqual("accessibleAccount_callback_delete_third"); + expect(data[1].owner).assertEqual("com.example.getallaccountsnoparameter"); + } + catch(err){ + console.error("====>check data 0700 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + appAccountManager.removeAccount("accessibleAccount_callback_delete_first", (err)=>{ + console.debug("====>delete first account 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("accessibleAccount_callback_delete_third", (err)=>{ + console.debug("====>delete third account 0700 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsGetAllAccountsNoParameter_0700 end===="); + done(); + }) + }) + }); + }) + }) + }) + }); + }); + + /* + * @tc.number : ActsGetAllAccountsNoParameter_0800 + * @tc.name : getAllAccounts promise + * @tc.desc : This application adds different application accounts three times in a row, and obtains + * authorization after deleting the account added for the second time + */ + it('ActsGetAllAccountsNoParameter_0800', 0, async function (done) { + console.debug("====>ActsGetAllAccountsNoParameter_0800 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>getAllAccounts for clean===="); + try{ + var acclist = await appAccountManager.getAllAccounts(SELFBUNDLE); + } + catch(err){ + console.error("====>getAllAccounts err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>account list length: " + acclist.length); + if(acclist.length > 0){ + for(var i = 0;i < acclist.length; i++){ + await appAccountManager.removeAccount(acclist[i].name); + } + } + console.debug("====>add first account 0800 start===="); + await appAccountManager.createAccount("accessibleAccount_promise_first"); + console.debug("====>add second account 0800 start===="); + await appAccountManager.createAccount("accessibleAccount_promise_second"); + console.debug("====>add third account 0800 start===="); + await appAccountManager.createAccount("accessibleAccount_promise_third"); + console.debug("====>delete second account 0800 start===="); + await appAccountManager.removeAccount("accessibleAccount_promise_second"); + try{ + var data = await appAccountManager.getAllAccounts(); + } + catch(err){ + console.error("====>getAllAccounts 0800 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAllAccounts 0800 data:" + JSON.stringify(data)); + expect(data.length).assertEqual(2); + try{ + expect(data[0].name).assertEqual("accessibleAccount_promise_first"); + expect(data[0].owner).assertEqual("com.example.getallaccountsnoparameter"); + expect(data[1].name).assertEqual("accessibleAccount_promise_third"); + expect(data[1].owner).assertEqual("com.example.getallaccountsnoparameter"); + } + catch(err){ + console.error("====>check data 0800 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>delete first account 0800 start===="); + await appAccountManager.removeAccount("accessibleAccount_promise_first"); + console.debug("====>delete third account 0800 start===="); + await appAccountManager.removeAccount("accessibleAccount_promise_third"); + console.debug("====>ActsGetAllAccountsNoParameter_0800 end===="); + done(); + }); + + /* + * @tc.number : ActsGetAllAccountsNoParameter_0900 + * @tc.name : getAllAccounts callback + * @tc.desc : This application adds different application accounts three times in a row, and then obtains + * authorization multiple times + */ + it('ActsGetAllAccountsNoParameter_0900', 0, async function (done) { + console.debug("====>ActsGetAllAccountsNoParameter_0900 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.createAccount("accessibleAccount_callback_multiple_first", (err)=>{ + console.debug("====>add first account 0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.createAccount("accessibleAccount_callback_multiple_second", (err)=>{ + console.debug("====>add third account 0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.getAllAccounts((err, data)=>{ + console.debug("====>getAllAccounts first 0900 err:" + JSON.stringify(err)); + console.debug("====>getAllAccounts first 0900 data:" + JSON.stringify(data)); + console.debug("====>getAllAccounts first 0900 data.length:" + data.length); + expect(err).assertEqual(null); + expect(data.length).assertEqual(2); + try{ + expect(data[0].name).assertEqual("accessibleAccount_callback_multiple_first"); + expect(data[0].owner).assertEqual("com.example.getallaccountsnoparameter"); + expect(data[1].name).assertEqual("accessibleAccount_callback_multiple_second"); + expect(data[1].owner).assertEqual("com.example.getallaccountsnoparameter"); + } + catch(err){ + console.error("====>check data first 0900 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + appAccountManager.getAllAccounts((err, data)=>{ + console.debug("====>getAllAccounts second 0900 err:" + JSON.stringify(err)); + console.debug("====>getAllAccounts second 0900 data:" + JSON.stringify(data)); + console.debug("====>getAllAccounts second 0900 data.length:" + data.length); + expect(err).assertEqual(null); + expect(data.length).assertEqual(2); + try{ + expect(data[0].name).assertEqual("accessibleAccount_callback_multiple_first"); + expect(data[0].owner).assertEqual("com.example.getallaccountsnoparameter"); + expect(data[1].name).assertEqual("accessibleAccount_callback_multiple_second"); + expect(data[1].owner).assertEqual("com.example.getallaccountsnoparameter"); + } + catch(err){ + console.error("====>check data second 0900 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + appAccountManager.removeAccount("accessibleAccount_callback_multiple_first", (err)=>{ + console.debug("====>delete first account 0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.removeAccount("accessibleAccount_callback_multiple_second", (err)=>{ + console.debug("====>delete second account 0900 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsGetAllAccountsNoParameter_0900 end===="); + done(); + }) + }) + }) + }) + }) + }); + }); + + /* + * @tc.number : ActsGetAllAccountsNoParameter_1000 + * @tc.name : getAllAccounts promise + * @tc.desc : This application adds different application accounts three times in a row, and then obtains + * authorization multiple times + */ + it('ActsGetAllAccountsNoParameter_1000', 0, async function (done) { + console.debug("====>ActsGetAllAccountsNoParameter_1000 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>getAllAccounts for clean===="); + try{ + var acclist = await appAccountManager.getAllAccounts(SELFBUNDLE); + } + catch(err){ + console.error("====>getAllAccounts err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>account list length: " + acclist.length); + if(acclist.length > 0){ + for(var i = 0;i < acclist.length; i++){ + await appAccountManager.removeAccount(acclist[i].name); + } + } + console.debug("====>add first account 1000 start===="); + await appAccountManager.createAccount("accessibleAccount_promise_multiple_first"); + console.debug("====>add second account 1000 start===="); + await appAccountManager.createAccount("accessibleAccount_promise_multiple_second"); + console.debug("====>getAllAccounts first 1000 start===="); + try{ + var data = await appAccountManager.getAllAccounts(); + } + catch(err){ + console.error("====>getAllAccounts first 1000 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAllAccounts 1000 data:" + JSON.stringify(data)); + expect(data.length).assertEqual(2); + try{ + expect(data[0].name).assertEqual("accessibleAccount_promise_multiple_first"); + expect(data[0].owner).assertEqual("com.example.getallaccountsnoparameter"); + expect(data[1].name).assertEqual("accessibleAccount_promise_multiple_second"); + expect(data[1].owner).assertEqual("com.example.getallaccountsnoparameter"); + } + catch(err){ + console.error("====>check data 1000 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAllAccounts second 1000 start===="); + try{ + var dataTwo = await appAccountManager.getAllAccounts(); + } + catch(err){ + console.error("====>getAllAccounts second 1000 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAllAccounts 1000 dataTwo:" + JSON.stringify(dataTwo)); + expect(data.length).assertEqual(2); + try{ + expect(dataTwo[0].name).assertEqual("accessibleAccount_promise_multiple_first"); + expect(dataTwo[0].owner).assertEqual("com.example.getallaccountsnoparameter"); + expect(dataTwo[1].name).assertEqual("accessibleAccount_promise_multiple_second"); + expect(dataTwo[1].owner).assertEqual("com.example.getallaccountsnoparameter"); + } + catch(err){ + console.error("====>check dataTwo 1000 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>delete first account 1000 start===="); + await appAccountManager.removeAccount("accessibleAccount_promise_multiple_first"); + console.debug("====>delete second account 1000 start===="); + await appAccountManager.removeAccount("accessibleAccount_promise_multiple_second"); + console.debug("====>ActsGetAllAccountsNoParameter_1000 end===="); + done(); + }); + + /* + * @tc.number : ActsGetAllAccountsNoParameter_1100 + * @tc.name : getAllAccounts + * @tc.desc : This application adds an account, other application authorizes an account to this application + * and this application obtains authorization + */ + it('ActsGetAllAccountsNoParameter_1100', 0, async function (done) { + console.debug("====>ActsGetAllAccountsNoParameter_1100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add account 1100 start===="); + await appAccountManager.createAccount("accessibleAccount_this_application"); + console.debug("====>startAbility 1100 start===="); + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.actsaccountsceneaccessible", + abilityName: "com.example.actsaccountsceneaccessible.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + ); + setTimeout(async function(){ + console.debug("====>getAllAccounts 1100 start===="); + try{ + var data = await appAccountManager.getAllAccounts(); + } + catch(err){ + console.error("====>getAllAccounts 1100 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAllAccounts 1100 data:" + JSON.stringify(data)); + expect(data.length).assertEqual(2); + try{ + expect(data[0].name).assertEqual("account_name_scene_single"); + expect(data[0].owner).assertEqual("com.example.actsaccountsceneaccessible"); + expect(data[1].name).assertEqual("accessibleAccount_this_application"); + expect(data[1].owner).assertEqual("com.example.getallaccountsnoparameter"); + } + catch(err){ + console.error("====>check data 1100 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>delete account 1100 start===="); + await appAccountManager.removeAccount("accessibleAccount_this_application"); + console.debug("====>ActsGetAllAccountsNoParameter_1100 end===="); + done(); + }, TIMEOUT); + }); + }) +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/test/List.test.js b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/test/List.test.js new file mode 100644 index 000000000..930f2dae4 --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ActsGetAllAccountsNoParameter from './Getallaccounts.test.js' + +export default function testsuite() { + ActsGetAllAccountsNoParameter() +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/resources/base/element/string.json b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/resources/base/element/string.json new file mode 100644 index 000000000..b8c402107 --- /dev/null +++ b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsGetAllAccessibleAccounts" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/resources/base/media/icon.png b/account/appaccount/getallaccounts/getallaccountsnoparameter/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpB<l@9sw zy?6dOXX?(K?>l$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4Zzg<l*k=3l5TH`42AmvHedhz{2z& z6+bsw7KML=Or~18Op0DUFeWj6aXtqjQ9&jNDSjbwK~XUwUM68dAqfFNF#$nwK0zU{ zpd?sWi0OZcMGl`y#>deKtgoc<KeET3EQ^bu9~>+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NF<BRd8kRWK(Sj#TLe+yTeK2Ztx00<htC~$&Jiig$@F-@Y!O%Vd ziMJ_uX(v5EDQ->YZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|AqlwuCD;w45K0@eqauiqWf7l&o)+YLHm~|L~ z7$0v5mkobriU!H<@mVJHLlmQqzQ3d6Rh_-|%Yy2li*tHO>_vcnuZ7OR_xkAIuIU&x z-|8Y0wj|6|a6_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n#GjI5i-AhnUE>Cr;jpCq<NG2-WoxlOPbfntZd`cG-kgX_H&`E zuk%ukIk14p{qK*fLz}vWOpIR?Cr;wWVd!|iw2F^$-Py&P3PO<cb(1)5fWITzL`2hW zxb?{>SrD~EwK_DqI^7%3#p5)%T_od!t3SOmH9MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-<tEu278X#CQp zQruTl^@@A;@99wA_Le>oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJL<k~a{}KP^0ew-EVGKm73>o%P>4I&$}y<EG|7-flk7U1byCfol%r zRq(+_wBzmq8c82N1TcaziET^jKK$H5cV$r;;CGKDIb+^eoOy*3L`cMt;?yr;9jVNq g9jT&p2BIGx8p5me=?Fj;|Gtl&DQhd$Ky4BK2beUY8~^|S literal 0 HcmV?d00001 diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/BUILD.gn b/account/appaccount/getallaccounts/getmultipleaccounts/BUILD.gn new file mode 100644 index 000000000..756d785f4 --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("GetMultipleAccountsTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "GetMultipleAccountsTest" + subsystem_name = "account" + part_name = "os_account" +} +ohos_js_assets("hjs_demo_js_assets") { + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" +} + +ohos_resources("hjs_demo_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/Test.json b/account/appaccount/getallaccounts/getmultipleaccounts/Test.json new file mode 100644 index 000000000..39380a5c0 --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/Test.json @@ -0,0 +1,21 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "60000", + "bundle-name": "com.example.getmultipleaccountstest", + "package-name": "com.example.getmultipleaccountstest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "GetMultipleAccountsTest.hap", + "ActsAccountAccessibleFirst.hap", + "ActsAccountAccessibleSecond.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/signature/openharmony_sx.p7b b/account/appaccount/getallaccounts/getmultipleaccounts/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..cc53179a48f88f20acc379c138a001e9a15838f6 GIT binary patch literal 3442 zcmcgvYj6|S6}BF>F-F+L*anwiBOa!J?7OmLOQwYEN~;%M$tz2?WlYUVT0LxOwU$<1 zS(Haa;)Zu=rr?H0Y#s&@105h3XNE^Z10^9aB$Vk;3~>l;p)@qbNk}NPE878^fghdB zpdZ>f=bn4-chC9Gcjtnbh)PPC(V}blR>Vu@x5Y$tASRm6=kXvBNKHyv*rMZ+0wJFV zVu@*w19@$+!~|hX_@71MCNdcE1}KRm;3UPR(5y!eituv|F;oB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ZVd8hB6(uYa3s&MdPBqrk{3yb@+fXTA4Plyg(hwN^7NMd+48+BKipCGx0~?PeBt$+ zx9)z*ELZK@o%GG#JNY>uU3x?G-jR|WOX%tqr<eSMKG4*0_^cUJ9lE@6dU5%?UHjkP zl(Tu~-4!d+?_Ow~wBp{<g@<P5-n(_CckTBQ>vjhqhKbWtIr4vS?5W~5?1m9|5&+2u z{wqIMEdMQYXX)?mm3r#-oG#va{aE_xOBvS}yV6ZJbk=JtmW}sx>HmH4R#)aHw=Rw0 z#Ol<D0K2C&*lzBcCb|D^b>{~gHl)Aro86NYoABWEtHw3K8*7Q{w2fKg{!sST?8^mE zj0bZho5Q^hK*Mt><KT@t^dZvb1>+t)L{bD0H}=Exg$E`)GEx$uH11O5u0)^&a(S_= zqy`i|9u-1jVcuFgr(k5xqD<o)ap%leTc`f@<eg%?EUR~iyN`C<JKhRLKDx>ILM=e~ zc{#;vD-tsmmGjTOa;B*7yD=xXwyzeC*e}ny+-|#O-3sw1C7i80M~^ssbgpv!d$W#+ YX9HpW+h1JFRc8v8e%3PML|^*<0J%6(*8l(j literal 0 HcmV?d00001 diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/config.json b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/config.json new file mode 100644 index 000000000..37e94203c --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/config.json @@ -0,0 +1,127 @@ +{ + "app": { + "bundleName": "com.example.getmultipleaccountstest", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.getmultipleaccountstest", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "defPermissions": [ + { + "availableScope": [], + "grantMode": "system_grant", + "name": "ohos.permission.GET_ALL_APP_ACCOUNTS" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.GET_ALL_APP_ACCOUNTS", + "reason": "ceshi" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO", + "reason":"need use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", + "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" + }, + { + "name":"ohos.permission.REMOVE_CACHE_FILES", + "reason":"need use ohos.permission.REMOVE_CACHE_FILES" + }, + { + "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", + "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" + } + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "js", + "srcPath": "MainAbility", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "label": "$string:MainAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + }, + { + "orientation": "unspecified", + "formsEnabled": false, + "name": ".TestAbility", + "srcLanguage": "js", + "srcPath": "TestAbility", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "label": "$string:TestAbility_label", + "type": "page", + "visible": true, + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } + } +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/app.js b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/app.js new file mode 100644 index 000000000..2a68c1992 --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/app.js @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/i18n/en-US.json b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 000000000..e63c70d97 --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/i18n/zh-CN.json b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 000000000..de6ee5748 --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/pages/index/index.css b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 000000000..2334ecfa2 --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/pages/index/index.hml b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 000000000..58fdc1444 --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,19 @@ +<!-- + Copyright (c) 2021 Huawei Device Co., Ltd. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<div class="container"> + <text class="title"> + {{title}} + </text> +</div> diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/pages/index/index.js b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 000000000..c4ec23182 --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "getAllAccessibleAccounts" + }, + onInit() { + this.title = "getAllAccessibleAccounts"; + }, + onShow() { + console.info('onShow finish') + }, + onReady() { + }, +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/app.js b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/app.js new file mode 100644 index 000000000..cdc31f3dc --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/app.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('TestApplication onCreate') + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/i18n/en-US.json b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/i18n/zh-CN.json b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/pages/index/index.css b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 000000000..1ba8e4e82 --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/pages/index/index.css @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} + + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/pages/index/index.hml b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 000000000..61ea59d93 --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,21 @@ +<!-- + Copyright (c) 2021 Huawei Device Co., Ltd. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<div class="container" onswipe="touchMove"> + <text class="title"> + {{ $t('strings.hello') }} {{title}} + </text> + <input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input> +</div> diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/pages/index/index.js b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 000000000..88b083a7f --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestAbility/pages/index/index.js @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} + + + diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 000000000..c5fa8620c --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/TestRunner/OpenHarmonyTestRunner.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package', '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + + export default { + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + }, + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters["-D"] + console.info('debug value : '+debug) + if (debug == 'true') + { + cmd += ' -D' + } + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + data.stdResult); + console.info('executeShellCommand : data : ' + data.exitCode); + }) + } +}; diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/test/Getmultipleaccounts.test.js b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/test/Getmultipleaccounts.test.js new file mode 100644 index 000000000..13632ba77 --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/test/Getmultipleaccounts.test.js @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import account from '@ohos.account.appAccount' +import featureAbility from '@ohos.ability.featureAbility' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +const TIMEOUT = 5000; +export default function ActsGetMultipleAccounts() { + describe('ActsGetMultipleAccounts', function () { + beforeAll(async function (done) { + console.debug("====>startAbility first start===="); + await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.actsaccountaccessiblefirst", + abilityName: "com.example.actsaccountaccessiblefirst.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + ); + sleep(TIMEOUT); + done(); + }); + + function sleep(delay) { + var start = (new Date()).getTime(); + while((new Date()).getTime() - start < delay) { + continue; + } + } + + /* + * @tc.number : ActsGetMultipleAccounts_0100 + * @tc.name : getAllAccounts + * @tc.desc : This application adds multiple account, other applications authorizes multiple accounts to this + * application and this application obtains authorization + */ + it('ActsGetMultipleAccounts_0100', 0, async function (done) { + console.debug("====>ActsGetMultipleAccounts_0100 start===="); + let dataMap = new Map(); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + console.debug("====>add first account 0100 start===="); + await appAccountManager.createAccount("accessibleAccount_this_application_first"); + console.debug("====>add second account 0100 start===="); + await appAccountManager.createAccount("accessibleAccount_this_application_second"); + console.debug("====>add third account 0100 start===="); + await appAccountManager.createAccount("accessibleAccount_this_application_third"); + console.debug("====>getAllAccounts 0100 start===="); + try{ + var data = await appAccountManager.getAllAccounts(); + } + catch(err){ + console.error("====>getAllAccounts 0100 fail err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>getAllAccounts 0100 data:" + JSON.stringify(data)); + expect(data.length).assertEqual(7); + console.debug("====>data.length:" + data.length); + for (let i = 0, len = data.length; i < len; i++) { + dataMap.set(data[i].name, data[i].owner) + } + expect(dataMap.has("account_name_scene_first_first")).assertTrue(); + if (dataMap.has("account_name_scene_first_first")) { + let data = dataMap.get("account_name_scene_first_first"); + console.debug("====>first account owner is: " + data); + expect(data).assertEqual("com.example.actsaccountaccessiblefirst"); + } + expect(dataMap.has("account_name_scene_first_second")).assertTrue(); + if (dataMap.has("account_name_scene_first_second")) { + let data = dataMap.get("account_name_scene_first_second"); + console.debug("====>second account owner is: " + data); + expect(data).assertEqual("com.example.actsaccountaccessiblefirst"); + } + expect(dataMap.has("account_name_scene_second_first")).assertTrue(); + if (dataMap.has("account_name_scene_second_first")) { + let data = dataMap.get("account_name_scene_second_first"); + console.debug("====>third account owner is: " + data); + expect(data).assertEqual("com.example.actsaccountaccessiblesecond"); + } + expect(dataMap.has("account_name_scene_second_second")).assertTrue(); + if (dataMap.has("account_name_scene_second_second")) { + let data = dataMap.get("account_name_scene_second_second"); + console.debug("====>fourth account owner is: " + data); + expect(data).assertEqual("com.example.actsaccountaccessiblesecond"); + } + expect(dataMap.has("accessibleAccount_this_application_first")).assertTrue(); + if (dataMap.has("accessibleAccount_this_application_first")) { + let data = dataMap.get("accessibleAccount_this_application_first"); + console.debug("====>fifth account owner is: " + data); + expect(data).assertEqual("com.example.actsgetallaccessiblemultiple"); + } + expect(dataMap.has("accessibleAccount_this_application_second")).assertTrue(); + if (dataMap.has("accessibleAccount_this_application_second")) { + let data = dataMap.get("accessibleAccount_this_application_second"); + console.debug("====>sixth account owner is: " + data); + expect(data).assertEqual("com.example.actsgetallaccessiblemultiple"); + } + expect(dataMap.has("accessibleAccount_this_application_third")).assertTrue(); + if (dataMap.has("accessibleAccount_this_application_third")) { + let data = dataMap.get("accessibleAccount_this_application_third"); + console.debug("====>seventh account owner is: " + data); + expect(data).assertEqual("com.example.actsgetallaccessiblemultiple"); + } + console.debug("====>delete account start===="); + await appAccountManager.removeAccount("accessibleAccount_this_application_first"); + await appAccountManager.removeAccount("accessibleAccount_this_application_second"); + await appAccountManager.removeAccount("accessibleAccount_this_application_third"); + console.debug("====>ActsGetAllAccessibleAccounts_0100 end===="); + done(); + }); + }) +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/test/List.test.js b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/test/List.test.js new file mode 100644 index 000000000..dd33ab1a2 --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ActsGetMultipleAccounts from './Getmultipleaccounts.test.js' + +export default function testsuite() { + ActsGetMultipleAccounts() +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/resources/base/element/string.json b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/resources/base/element/string.json new file mode 100644 index 000000000..e2244febf --- /dev/null +++ b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsGetAllAccessibleMultiple" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/account/appaccount/getallaccounts/getmultipleaccounts/src/main/resources/base/media/icon.png b/account/appaccount/getallaccounts/getmultipleaccounts/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpB<l@9sw zy?6dOXX?(K?>l$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4Zzg<l*k=3l5TH`42AmvHedhz{2z& z6+bsw7KML=Or~18Op0DUFeWj6aXtqjQ9&jNDSjbwK~XUwUM68dAqfFNF#$nwK0zU{ zpd?sWi0OZcMGl`y#>deKtgoc<KeET3EQ^bu9~>+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NF<BRd8kRWK(Sj#TLe+yTeK2Ztx00<htC~$&Jiig$@F-@Y!O%Vd ziMJ_uX(v5EDQ->YZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|AqlwuCD;w45K0@eqauiqWf7l&o)+YLHm~|L~ z7$0v5mkobriU!H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NnsI@mxnwm;tf5;_Uxg?jZ8m-m0}&6+DA!qam(p$mN5R})yA_7m$q@| zFEd|dpS595rxQr-n#GjI5i-AhnUE>Cr;jpCq<NG2-WoxlOPbfntZd`cG-kgX_H&`E zuk%ukIk14p{qK*fLz}vWOpIR?Cr;wWVd!|iw2F^$-Py&P3PO<cb(1)5fWITzL`2hW zxb?{>SrD~EwK_DqI^7%3#p5)%T_od!t3SOmH9MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-<tEu278X#CQp zQruTl^@@A;@99wA_Le>oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJL<k~a{}KP^0ew-EVGKm73>o%P>4I&$}y<EG|7-flk7U1byCfol%r zRq(+_wBzmq8c82N1TcaziET^jKK$H5cV$r;;CGKDIb+^eoOy*3L`cMt;?yr;9jVNq g9jT&p2BIGx8p5me=?Fj;|Gtl&DQhd$Ky4BK2beUY8~^|S literal 0 HcmV?d00001 diff --git a/account/appaccount/sceneProject/actsaccountaccessibleFirst/entry/src/main/js/default/pages/index/index.js b/account/appaccount/sceneProject/actsaccountaccessibleFirst/entry/src/main/js/default/pages/index/index.js index c884b7363..75afbfba4 100755 --- a/account/appaccount/sceneProject/actsaccountaccessibleFirst/entry/src/main/js/default/pages/index/index.js +++ b/account/appaccount/sceneProject/actsaccountaccessibleFirst/entry/src/main/js/default/pages/index/index.js @@ -14,6 +14,7 @@ */ import account from '@ohos.account.appAccount' import featureAbility from '@ohos.ability.featureAbility' +import app from '../../../../../../../../../getallaccounts/getallaccountsnoparameter/src/main/js/TestAbility/app' const injectRef = Object.getPrototypeOf(global) || global injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') @@ -29,29 +30,35 @@ export default { var appAccountManager = account.createAppAccountManager(); console.debug("====>creat first scene manager finish===="); var enableBundle = "com.example.actsgetallaccessiblemultiple"; + var enableBundle_2 = "com.example.getmultipleaccountstest" console.debug("====>add first account start===="); - appAccountManager.addAccount("account_name_scene_first_first", (err)=>{ + appAccountManager.createAccount("account_name_scene_first_first", (err)=>{ console.debug("====>add first account err:" + JSON.stringify(err)); - appAccountManager.enableAppAccess("account_name_scene_first_first", enableBundle, (err)=>{ + appAccountManager.setAppAccess("account_name_scene_first_first", enableBundle, true, (err)=>{ console.debug("====>enableAppAccess first account err:" + JSON.stringify(err)); - appAccountManager.addAccount("account_name_scene_first_second", (err)=>{ - console.debug("====>add second account err:" + JSON.stringify(err)); - appAccountManager.enableAppAccess("account_name_scene_first_second", enableBundle, (err)=>{ - console.debug("====>enableAppAccess second account err:" + JSON.stringify(err)); - console.debug("====>startAbility second start===="); - featureAbility.startAbility( - { - want: - { - deviceId: "", - bundleName: "com.example.actsaccountaccessiblesecond", - abilityName: "com.example.actsaccountaccessiblesecond.MainAbility", - action: "action1", - parameters: - {}, - }, - } - ); + appAccountManager.setAppAccess("account_name_scene_first_first", enableBundle_2, true, (err) => { + console.debug("====>enableAppAccess first account for enableBundle_2 err:" + JSON.stringify(err)); + appAccountManager.createAccount("account_name_scene_first_second", (err)=>{ + console.debug("====>add second account err:" + JSON.stringify(err)); + appAccountManager.setAppAccess("account_name_scene_first_second", enableBundle, true, (err)=>{ + appAccountManager.setAppAccess("account_name_scene_first_second", enableBundle_2, true, (err)=>{ + console.debug("====>enableAppAccess second account err:" + JSON.stringify(err)); + console.debug("====>startAbility second start===="); + featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.example.actsaccountaccessiblesecond", + abilityName: "com.example.actsaccountaccessiblesecond.MainAbility", + action: "action1", + parameters: + {}, + }, + } + ); + }) + }) }) }) }) diff --git a/account/appaccount/sceneProject/actsaccountaccessibleSecond/entry/src/main/js/default/pages/index/index.js b/account/appaccount/sceneProject/actsaccountaccessibleSecond/entry/src/main/js/default/pages/index/index.js index 6e4591a43..570d3d741 100755 --- a/account/appaccount/sceneProject/actsaccountaccessibleSecond/entry/src/main/js/default/pages/index/index.js +++ b/account/appaccount/sceneProject/actsaccountaccessibleSecond/entry/src/main/js/default/pages/index/index.js @@ -35,20 +35,25 @@ export default { var appAccountManager = account.createAppAccountManager(); console.debug("====>creat second scene manager finish===="); var enableBundle = "com.example.actsgetallaccessiblemultiple"; + var enableBundle_2 = "com.example.getmultipleaccountstest" console.debug("====>add second account start===="); - appAccountManager.addAccount("account_name_scene_second_first", (err)=>{ + appAccountManager.createAccount("account_name_scene_second_first", (err)=>{ console.debug("====>add second account err:" + JSON.stringify(err)); - appAccountManager.enableAppAccess("account_name_scene_second_first", enableBundle, (err)=>{ + appAccountManager.setAppAccess("account_name_scene_second_first", enableBundle, true, (err)=>{ console.debug("====>enableAppAccess second account err:" + JSON.stringify(err)); - appAccountManager.addAccount("account_name_scene_second_second", (err)=>{ - console.debug("====>add second account err:" + JSON.stringify(err)); - appAccountManager.enableAppAccess("account_name_scene_second_second", enableBundle, (err)=>{ - console.debug("====>enableAppAccess second account err:" + JSON.stringify(err)); - sleep(3000); - featureAbility.terminateSelf( - (err, data)=>{ - console.debug('====>Terminate Ability Success====') - }); + appAccountManager.setAppAccess("account_name_scene_second_first", enableBundle_2, true, (err) => { + appAccountManager.createAccount("account_name_scene_second_second", (err)=>{ + console.debug("====>add second account err:" + JSON.stringify(err)); + appAccountManager.setAppAccess("account_name_scene_second_second", enableBundle, true, (err)=>{ + appAccountManager.setAppAccess("account_name_scene_second_second", enableBundle_2, true, (err) => { + console.debug("====>enableAppAccess second account err:" + JSON.stringify(err)); + sleep(3000); + featureAbility.terminateSelf( + (err, data)=>{ + console.debug('====>Terminate Ability Success====') + }); + }) + }) }) }) }) diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js index 7fb28fa79..6e1179359 100644 --- a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js @@ -23,27 +23,34 @@ export default { this.title = this.$t('strings.world'); }, onShow() { - console.info('ServiceAbility onStart'); - var accountMgr = account_appAccount.createAppAccountManager(); - console.info('ServiceAbility lcc addAccount 01 onStart'); - accountMgr.addAccount("zhangsan", "",(data)=>{ - console.info('ServiceAbility lcc enableAppAccess 01 onStart'); - accountMgr.enableAppAccess("zhangsan", "com.example.actsaccounttest"); - console.info('ServiceAbility lcc addAccount 02 onStart'); - accountMgr.addAccount("lisi", "",(err)=>{ - console.info('ServiceAbility lcc enableAppAccess 02 onStart'); - accountMgr.enableAppAccess("lisi", "com.example.actsaccounttest"); - console.info('ServiceAbility lcc addAccount 03 onStart'); - accountMgr.addAccount("wangwu", "",(err)=>{ - console.info('ServiceAbility lcc enableAppAccess 03 onStart'); - accountMgr.enableAppAccess("wangwu", "com.example.actsaccounttest",(err)=>{ + console.info('====>ServiceAbility onStart'); + var accountMgr = account_appAccount.createAppAccountManager(); + accountMgr.createAccount("zhangsan", async(data)=>{ + console.info('====>ServiceAbility addAccount 01 onStart'); + console.info('====>ServiceAbility setAppAccess actsaccounttest zhangsan'); + await accountMgr.setAppAccess("zhangsan", "com.example.actsaccounttest", true); + console.info('====>ServiceAbility setAppAccess actsaccountoperatetest zhangsan'); + await accountMgr.setAppAccess("zhangsan", "com.example.actsaccountoperatetest", true); + console.info('====>ServiceAbility lcc addAccount 02 onStart'); + accountMgr.createAccount("lisi", async (err)=>{ + console.info('====>ServiceAbility setAppAccess actsaccounttest lisi'); + await accountMgr.setAppAccess("lisi", "com.example.actsaccounttest", true); + console.info('====>ServiceAbility setAppAccess actsaccountoperatetest lisi'); + await accountMgr.setAppAccess("lisi", "com.example.actsaccountoperatetest", true); + console.info('====>ServiceAbility lcc addAccount 03 onStart'); + accountMgr.createAccount("wangwu", async (err)=>{ + console.info('====>ServiceAbility lcc enableAppAccess 03 onStart'); + console.info('====>ServiceAbility setAppAccess actsaccounttest wangwu'); + await accountMgr.setAppAccess("wangwu", "com.example.actsaccounttest", true) + console.info('====>ServiceAbility setAppAccess actsaccountoperatetest wangwu'); + accountMgr.setAppAccess("wangwu", "com.example.actsaccountoperatetest", true, (err)=>{ featureAbility.terminateSelf(); - console.info('ServiceAbility add end'); + console.info('====>ServiceAbility add end'); }); }); }); }); - console.info('ServiceAbility onStart end'); + console.info('====>ServiceAbility onStart end'); }, onReady() { }, diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js index 4eb1de03b..5e15436cf 100644 --- a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js @@ -13,11 +13,165 @@ * limitations under the License. */ import account_appAccount from '@ohos.account.appAccount'; -import featureAbility from '@ohos.ability.featureAbility' -import {MyAuthenticator} from '../Common/utils' var TAG = "[AccountTest]" var authenticator = null +var accountLabels = { + "zhangsan": ["male", "30-40", "level4"], + "lisi": ["female"] +} +var accountCredentials = { + "zhangsan": { + "PIN": "123456", + "NUMBER": "12356789" + }, + "lisi": { + "FACE": "X00001" + } +} +var accountRemovability = { + "zhangsan": false, + "lisi": true +} +var properties = {} + +class MyAuthenticator extends account_appAccount.Authenticator { + + addAccountImplicitly(authType, callerBundleName, options, callback) { + console.log(TAG + "authType: " + authType + "callerBundleName: " + callerBundleName + ", options: " + JSON.stringify(options)) + let appAccountMgr = account_appAccount.createAppAccountManager(); + let newAccountName = "addNewAccountName" + appAccountMgr.createAccount(newAccountName, (err) => { + let authResult = { + name: newAccountName, + owner: "com.example.accountauthenticator" + } + callback.onResult(0, authResult); + }); + } + + authenticate(name, authType, callerBundleName, options, callback) { + console.log(TAG + "name: " + name + "authType: " + authType + "callerBundleName: " + callerBundleName + ", options: " + JSON.stringify(options)) + let appAccountMgr = account_appAccount.createAppAccountManager(); + appAccountMgr.createAccount(name, (err) => { + callback.onResult(0, { + name: name, + authType: authType, + token: "123456" + }); + }) + } + + createAccountImplicitly(options, callback) { + console.log(TAG + "options: " + JSON.stringify(options)) + let appAccountMgr = account_appAccount.createAppAccountManager(); + let newAccountName = "createNewAccountName" + appAccountMgr.createAccount(newAccountName, (err) => { + let authResult = { + accountInfo: { + name: newAccountName, + owner: "com.example.accountauthenticator" + } + } + callback.onResult(0, authResult); + }); + } + + auth(name, authType, options, callback) { + console.log(TAG + "name: " + name + "authType: " + authType + ", options: " + JSON.stringify(options)) + let authResult = { + accountInfo: { + name: name, + owner: "com.example.accountauthenticator" + }, + tokenInfo: { + authType: "getSocialData", + token: "xxxxxxxxx" + } + } + callback.onResult(0, authResult); + } + + verifyCredential(name, options, callback) { + console.log(TAG + "name: " + name + ", options: " + JSON.stringify(options)) + if (name == "xiaoming") { + callback.onRequestContinued() + return + } + var credentialInfo = undefined + try { + credentialInfo = accountCredentials[name] + } catch (err) { + console.log(TAG + " no credential") + callback.onResult(0, {"booleanResult": false}) + return + } + if (options.credentialType == undefined || options.credential == undefined) { + callback.onRequestRedirected({ + bundleName: "com.example.accountauthenticator", + abilityName: "VerifyAbility", + parameters: { + credentialType: options.credentialType, credential: options.credential + } + }) + return + } + try { + var credential = credentialInfo[options.credentialType.toUpperCase()] + if (credential == options.credential) { + callback.onResult(0, {"booleanResult": true}) + } else { + callback.onResult(0, {"booleanResult": false}) + } + } catch(err) { + console.log(TAG + " check credential error"); + callback.onResult(0, {"booleanResult": false}); + } + } + + checkAccountLabels(name, labels, callback) { + console.log(TAG + "name: " + name + ", labels: " + JSON.stringify(labels) + ", callback: " + callback) + if (labels.length == 0) { + callback.onResult(0, {"booleanResult": true}) + return + } + var allLabels = [] + try { + allLabels = accountLabels[name] + } catch (err) { + console.log("no labels") + allLabels == undefined + } + if (allLabels == undefined || allLabels.length == 0) { + callback.onResult(0, {"booleanResult": false}) + return + } + for (var i = 0; i < labels.length; ++i) { + if (allLabels.indexOf(labels[i]) == -1) { + callback.onResult(0, {"booleanResult": false}) + return + } + } + callback.onResult(0, {"booleanResult": true}) + } + + setProperties(options, callback) { + console.log(TAG + "options: " + JSON.stringify(options)) + callback.onResult(10016, {}) + } + + isAccountRemovable(name, callback) { + console.log(TAG + "name: " + name) + var isRemovable = false; + try { + isRemovable = accountRemovability[name] + } catch (err) { + console.log(TAG + "error: " + JSON.stringify(err)) + } + callback.onResult(0, {"booleanResult": isRemovable}) + } +} + export default { onStart(want) { console.info('ServiceAbility onStart'); diff --git a/account/appaccount/sceneProject/actsaccountoauthtoken/entry/src/main/config.json b/account/appaccount/sceneProject/actsaccountoauthtoken/entry/src/main/config.json index ad8171ba7..394691cb4 100644 --- a/account/appaccount/sceneProject/actsaccountoauthtoken/entry/src/main/config.json +++ b/account/appaccount/sceneProject/actsaccountoauthtoken/entry/src/main/config.json @@ -38,7 +38,7 @@ ] } ], - "name": "com.example.actsaccountOauthtoken.MainAbility", + "name": "com.example.actsaccountoauthtoken.MainAbility", "icon": "$media:icon", "description": "$string:mainability_description", "label": "$string:app_name", diff --git a/account/appaccount/sceneProject/actsaccountoauthtoken/entry/src/main/js/default/pages/index/index.js b/account/appaccount/sceneProject/actsaccountoauthtoken/entry/src/main/js/default/pages/index/index.js index 88cd36de9..bb8e01412 100644 --- a/account/appaccount/sceneProject/actsaccountoauthtoken/entry/src/main/js/default/pages/index/index.js +++ b/account/appaccount/sceneProject/actsaccountoauthtoken/entry/src/main/js/default/pages/index/index.js @@ -22,15 +22,30 @@ class MyAuthenticator extends appAccount.Authenticator authenticate(name, authType, callerBundleName, options, callback) { var randNumber = Math.ceil(Math.random()*10000) var newTokenData = "service/authenticate/tokenInfo" + randNumber; - console.log("Service authenticate name: " + name + ", authType: " + authType + ", options: "+ JSON.stringify(options)); + console.log("====>Service authenticate name: " + name + ", authType: " + authType + ", options: "+ JSON.stringify(options)); callback.onResult(0, {"name":name,"authType":authType,"token":newTokenData}); } addAccountImplicitly(authType, callerBundleName, options, callback) { - console.log("Service addAccountImplicitly authType: " + authType + " callerBundleName: " + callerBundleName + "options: "+ JSON.stringify(options)); + console.log("====>Service addAccountImplicitly authType: " + authType + " callerBundleName: " + callerBundleName + "options: "+ JSON.stringify(options)); callback.onRequestRedirected({ - bundleName: "com.huawei.openharmonyappdemo.service", - abilityName: "com.huawei.openharmonyappdemo.service.settingAbility", + bundleName: "com.ohos.openharmonyappdemo.service", + abilityName: "com.ohos.openharmonyappdemo.service.settingAbility", + }); + } + + auth(name, authType, callerBundleName, callback) { + var randNumber = Math.ceil(Math.random()*10000) + var newTokenData = "service/authenticate/tokenInfo" + randNumber; + console.log("====>Service authenticate name: " + name + ", authType: " + authType); + callback.onResult(0, {"name":name,"authType":authType,"token":newTokenData}); + } + + createAccountImplicitly(options, callback) { + console.log("====>Service createAccountImplicitly options: "+ JSON.stringify(options)); + callback.onRequestRedirected({ + bundleName: "com.ohos.openharmonyappdemo.service", + abilityName: "com.ohos.openharmonyappdemo.service.settingAbility", }); } } diff --git a/account/appaccount/sceneProject/actsaccountsceneaccessible/entry/src/main/js/default/pages/index/index.js b/account/appaccount/sceneProject/actsaccountsceneaccessible/entry/src/main/js/default/pages/index/index.js index de4974849..9122b50d2 100755 --- a/account/appaccount/sceneProject/actsaccountsceneaccessible/entry/src/main/js/default/pages/index/index.js +++ b/account/appaccount/sceneProject/actsaccountsceneaccessible/entry/src/main/js/default/pages/index/index.js @@ -28,10 +28,14 @@ export default { var appAccountManager = account.createAppAccountManager(); console.debug("====>creat scene manager finish===="); var enableBundle = "com.example.actsgetallaccessibleaccounts"; + var enableBundle2 = "com.example.getallaccountsnoparameter"; console.debug("====>add account scene start===="); - appAccountManager.addAccount("account_name_scene_single", (err)=>{ + appAccountManager.createAccount("account_name_scene_single", (err)=>{ console.debug("====>add account scene err:" + JSON.stringify(err)); - appAccountManager.enableAppAccess("account_name_scene_single", enableBundle, (err)=>{ + appAccountManager.setAppAccess("account_name_scene_single", enableBundle, true, (err)=>{ + console.debug("====>enableAppAccess scene err:" + JSON.stringify(err)); + }); + appAccountManager.setAppAccess("account_name_scene_single", enableBundle2, true, (err)=>{ console.debug("====>enableAppAccess scene err:" + JSON.stringify(err)); }); }); diff --git a/account/appaccount/sceneProject/actsaccountsceneappaccess/entry/src/main/js/default/pages/index/index.js b/account/appaccount/sceneProject/actsaccountsceneappaccess/entry/src/main/js/default/pages/index/index.js index efc3bc1fe..6b3319524 100755 --- a/account/appaccount/sceneProject/actsaccountsceneappaccess/entry/src/main/js/default/pages/index/index.js +++ b/account/appaccount/sceneProject/actsaccountsceneappaccess/entry/src/main/js/default/pages/index/index.js @@ -31,13 +31,13 @@ export default { console.debug("====>creat scene manager finish===="); var enableBundle = "com.example.actsaccountpressure"; console.debug("====>add first account start===="); - appAccountManager.addAccount("account_name_scene_first", (err)=>{ + appAccountManager.createAccount("account_name_scene_first", (err)=>{ console.debug("====>add first account err:" + JSON.stringify(err)); - appAccountManager.enableAppAccess("account_name_scene_first", enableBundle, (err)=>{ + appAccountManager.setAppAccess("account_name_scene_first", enableBundle, true, (err)=>{ console.debug("====>enableAppAccess first account err:" + JSON.stringify(err)); - appAccountManager.addAccount("account_name_scene_second", (err)=>{ + appAccountManager.createAccount("account_name_scene_second", (err)=>{ console.debug("====>add second account err:" + JSON.stringify(err)); - appAccountManager.enableAppAccess("account_name_scene_second", enableBundle, (err)=>{ + appAccountManager.setAppAccess("account_name_scene_second", enableBundle, true, (err)=>{ console.debug("====>enableAppAccess second account err:" + JSON.stringify(err)); featureAbility.terminateSelf( (err, data)=>{ diff --git a/account/appaccount/sceneProject/actsaccountsceneonoff/entry/src/main/js/default/pages/index/index.js b/account/appaccount/sceneProject/actsaccountsceneonoff/entry/src/main/js/default/pages/index/index.js index 769e6af03..47c8c50db 100755 --- a/account/appaccount/sceneProject/actsaccountsceneonoff/entry/src/main/js/default/pages/index/index.js +++ b/account/appaccount/sceneProject/actsaccountsceneonoff/entry/src/main/js/default/pages/index/index.js @@ -23,6 +23,12 @@ const ACCOUNT_TEST_ONOFF_DELETE = 4 const ACCOUNT_TEST_ONOFF_DELETEONLY = 5 const ACCOUNT_TEST_ONOFF_DISABLE = 6 const ACCOUNT_TEST_ONOFF_DISABLEONLY = 7 +const ACCOUNT_TEST_ONOFF_CUSTOMDATA = 8 +const ACCOUNT_TEST_ONOFF_SETCREDENTIAL = 9 +const ACCOUNT_TEST_ONOFF_REMOVE = 10 +const ACCOUNT_TEST_ONOFF_REMOVEONLY = 11 +const ACCOUNT_TEST_ONOFF_SETDISABLE = 12 +const ACCOUNT_TEST_ONOFF_SETDISABLEONLY = 13 const injectRef = Object.getPrototypeOf(global) || global injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') @@ -44,8 +50,10 @@ export default { function publishCallback(err){ console.debug("====>publish call back scene err:" + JSON.stringify(err)); console.debug("====>scene off start===="); - appAccountManager.off('change', function (){ - console.debug("====>scene off finish===="); + appAccountManager.off('accountChange', function (){ + appAccountManager.off('change', function (){ + console.debug("====>scene off finish===="); + }); }); featureAbility.terminateSelf() } @@ -98,6 +106,29 @@ export default { } } + function changeOnCustomData(data){ + console.debug("====>receive change 0200 data:" + JSON.stringify(data)); + try{ + if(data[0].owner == "com.example.actsaccountoperatetest" && data[0].name == "onoff_cunstomdata"){ + var commonEventPublishData = { + data: "SUCCESS" + } + commonevent.publish("account_on_change_cuntomdata", commonEventPublishData, publishCallback); + }else{ + var commonEventPublishData = { + data: "FAIL" + } + commonevent.publish("account_on_change_customdata", commonEventPublishData, publishCallback); + } + } + catch(err){ + var commonEventPublishData = { + data: "FAIL" + } + commonevent.publish("account_on_change_customdata", commonEventPublishData, publishCallback); + } + } + function changeOnCredential(data){ console.debug("====>receive change 0300 data:" + JSON.stringify(data)); try{ @@ -121,6 +152,29 @@ export default { } } + function changeOnSetCredential(data){ + console.debug("====>receive change 0300 data:" + JSON.stringify(data)); + try{ + if(data[0].owner == "com.example.actsaccountoperatetest" && data[0].name == "onoff_setcredential"){ + var commonEventPublishData = { + data: "SUCCESS" + } + commonevent.publish("account_on_change_setcredential", commonEventPublishData, publishCallback); + }else{ + var commonEventPublishData = { + data: "FAIL" + } + commonevent.publish("account_on_change_setcredential", commonEventPublishData, publishCallback); + } + } + catch(err){ + var commonEventPublishData = { + data: "FAIL" + } + commonevent.publish("account_on_change_setcredential", commonEventPublishData, publishCallback); + } + } + function changeOnDeleteAnother(data){ console.debug("====>receive change 0400 data:" + JSON.stringify(data)); try{ @@ -144,6 +198,29 @@ export default { } } + function changeOnRemoverAnother(data){ + console.debug("====>receive change 0400 data:" + JSON.stringify(data)); + try{ + if(data[0].owner == "com.example.actsaccountoperatetest" && data[0].name == "onoff_removeFir"){ + var commonEventPublishData = { + data: "SUCCESS" + } + commonevent.publish("account_on_remove_another", commonEventPublishData, publishCallback); + }else{ + var commonEventPublishData = { + data: "FAIL" + } + commonevent.publish("account_on_remove_another", commonEventPublishData, publishCallback); + } + } + catch(err){ + var commonEventPublishData = { + data: "FAIL" + } + commonevent.publish("account_on_remove_another", commonEventPublishData, publishCallback); + } + } + function changeOnDelete(data){ console.debug("====>receive change 0500 data:" + JSON.stringify(data)); try{ @@ -167,6 +244,29 @@ export default { } } + function changeOnRemove(data){ + console.debug("====>receive change 0500 data:" + JSON.stringify(data)); + try{ + if(data.length == 0){ + var commonEventPublishData = { + data: "SUCCESS" + } + commonevent.publish("account_on_change_remove", commonEventPublishData, publishCallback); + }else{ + var commonEventPublishData = { + data: "FAIL" + } + commonevent.publish("account_on_change_remove", commonEventPublishData, publishCallback); + } + } + catch(err){ + var commonEventPublishData = { + data: "FAIL" + } + commonevent.publish("account_on_change_remove", commonEventPublishData, publishCallback); + } + } + function changeOnDisableAnother(data){ console.debug("====>receive change 0600 data:" + JSON.stringify(data)); try{ @@ -190,6 +290,29 @@ export default { } } + function changeOnSetAnotherDisable(data){ + console.debug("====>receive change 1200 data:" + JSON.stringify(data)); + try{ + if(data[0].owner == "com.example.actsaccountoperatetest" && data[0].name == "onoff_disableFir"){ + var commonEventPublishData = { + data: "SUCCESS" + } + commonevent.publish("account_on_set_another_disable", commonEventPublishData, publishCallback); + }else{ + var commonEventPublishData = { + data: "FAIL" + } + commonevent.publish("account_on_set_another_disable", commonEventPublishData, publishCallback); + } + } + catch(err){ + var commonEventPublishData = { + data: "FAIL" + } + commonevent.publish("account_on_set_another_disable", commonEventPublishData, publishCallback); + } + } + function changeOnDisable(data){ console.debug("====>receive change 0700 data:" + JSON.stringify(data)); try{ @@ -213,6 +336,29 @@ export default { } } + function changeOnSetDisable(data){ + console.debug("====>receive change 1300 data:" + JSON.stringify(data)); + try{ + if(data.length == 0){ + var commonEventPublishData = { + data: "SUCCESS" + } + commonevent.publish("account_on_set_disable", commonEventPublishData, publishCallback); + }else{ + var commonEventPublishData = { + data: "FAIL" + } + commonevent.publish("account_on_set_disable", commonEventPublishData, publishCallback); + } + } + catch(err){ + var commonEventPublishData = { + data: "FAIL" + } + commonevent.publish("account_on_set_disable", commonEventPublishData, publishCallback); + } + } + // Receive events sent by the test application to correspond to different test cases function subscriberCallback(err, data){ console.debug("====>receive event err:" + JSON.stringify(err)); @@ -246,6 +392,30 @@ export default { console.debug("====>receive event 0700 event:" + data.event); appAccountManager.on('change', ["com.example.actsaccounttest"], changeOnDisable); break; + case ACCOUNT_TEST_ONOFF_CUSTOMDATA: + console.debug("====>receive event 0800 event:" + data.event); + appAccountManager.on('accountChange', ["com.example.actsaccountoperatetest"], changeOnCustomData); + break; + case ACCOUNT_TEST_ONOFF_SETCREDENTIAL: + console.debug("====>receive event 0900 event:" + data.event); + appAccountManager.on('accountChange', ["com.example.actsaccountoperatetest"], changeOnSetCredential); + break; + case ACCOUNT_TEST_ONOFF_REMOVE: + console.debug("====>receive event 1000 event:" + data.event); + appAccountManager.on('accountChange', ["com.example.actsaccountoperatetest"], changeOnRemoverAnother); + break; + case ACCOUNT_TEST_ONOFF_REMOVEONLY: + console.debug("====>receive event 1100 event:" + data.event); + appAccountManager.on('accountChange', ["com.example.actsaccountoperatetest"], changeOnRemove); + break; + case ACCOUNT_TEST_ONOFF_SETDISABLE: + console.debug("====>receive event 1200 event:" + data.event); + appAccountManager.on('accountChange', ["com.example.actsaccountoperatetest"], changeOnSetAnotherDisable); + break; + case ACCOUNT_TEST_ONOFF_SETDISABLEONLY: + console.debug("====>receive event 1300 event:" + data.event); + appAccountManager.on('accountChange', ["com.example.actsaccountoperatetest"], changeOnSetDisable); + break; default: console.debug("====>receive event enter default===="); break; diff --git a/account/appaccount/sceneProject/actsscenegetallaccounts/entry/src/main/js/default/pages/index/index.js b/account/appaccount/sceneProject/actsscenegetallaccounts/entry/src/main/js/default/pages/index/index.js index 172e91fc0..7538c63b9 100755 --- a/account/appaccount/sceneProject/actsscenegetallaccounts/entry/src/main/js/default/pages/index/index.js +++ b/account/appaccount/sceneProject/actsscenegetallaccounts/entry/src/main/js/default/pages/index/index.js @@ -29,12 +29,16 @@ export default { var appAccountManager = account.createAppAccountManager(); console.debug("====>creat scene manager finish===="); var enableBundle = "com.example.actsgetallaaccounts"; + var enableBundle2 = "com.example.actsgetaccountsbyowner"; console.debug("====>add account scene start===="); - appAccountManager.addAccount("account_name_scene_single", (err)=>{ + appAccountManager.createAccount("account_name_scene_single", (err)=>{ console.debug("====>add account scene err:" + JSON.stringify(err)); - appAccountManager.enableAppAccess("account_name_scene_single", enableBundle, (err)=>{ + appAccountManager.setAppAccess("account_name_scene_single", enableBundle, true, (err)=>{ console.debug("====>enableAppAccess scene err:" + JSON.stringify(err)); - featureAbility.terminateSelf() + appAccountManager.setAppAccess("account_name_scene_single", enableBundle2, true, (err)=>{ + console.debug("====>enableAppAccess scene err:" + JSON.stringify(err)); + featureAbility.terminateSelf() + }) }); }); }, diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/List.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/List.test.js index 714b5ea8f..26827cdcf 100755 --- a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/List.test.js +++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/List.test.js @@ -14,7 +14,11 @@ */ import ActsOsAccountThirdPartyTest_third_2 from './OsAccountGet.test.js' import ActsOsAccountThirdPartyTest_third_1 from './OsAccountIs.test.js' +import ActsOsAccountThirdPartyTest_third_4 from './OsAccountQuery.test.js' +import ActsOsAccountThirdPartyTest_third_3 from './OsAccountCheck.test.js' export default function testsuite() { ActsOsAccountThirdPartyTest_third_2() ActsOsAccountThirdPartyTest_third_1() + ActsOsAccountThirdPartyTest_third_4() + ActsOsAccountThirdPartyTest_third_3() } \ No newline at end of file diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountCheck.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountCheck.test.js new file mode 100644 index 000000000..d876a4ba5 --- /dev/null +++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountCheck.test.js @@ -0,0 +1,520 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import osAccount from '@ohos.account.osAccount' +import distributedAccount from '@ohos.account.distributedAccount' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +const TIMEOUT = 1000; +const ERR_PERMISSION_DENIED = 201; +const ERR_PARAMETER_CHECK_FAILED = 401; +const ERR_SYSTEM_SERVICE_ABNORMAL = 12300001; +const ERR_INVALID_PARAMETER = 12300002; +const ERR_ACCOUNT_NOT_EXIST = 12300003; +export default function ActsOsAccountThirdPartyTest_third_3() { + describe('ActsOsAccountThirdPartyTest_third_3', function () { + /* + * @tc.number : ActsOsAccountDeviceId_0100 + * @tc.name : queryDistributedVirtualDeviceId callback + * @tc.desc : get distributed virtual device ID + */ + it('ActsOsAccountDeviceId_0100', 0, async function(done){ + console.debug("====>ActsOsAccountDeviceId_0100 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + const deviceId = '5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5'; + const accountAbility = distributedAccount.getDistributedAccountAbility(); + accountAbility.updateOsAccountDistributedInfo( + { + name: 'ZhangSan', + id: '12345', + event: "Ohos.account.event.LOGIN" + }, (err)=>{ + console.debug("====>update distributedInfo err:" + JSON.stringify(err)); + AccountManager.queryDistributedVirtualDeviceId((err, id)=>{ + console.debug("====>queryDistributedVirtualDeviceId err:" + JSON.stringify(err)); + console.debug("====>queryDistributedVirtualDeviceId deviceId:" + id); + expect(err).assertEqual(null); + expect(id).assertEqual(deviceId); + console.debug("====>ActsOsAccountDeviceId_0100 end===="); + done(); + }) + }) + }) + + /* + * @tc.number : ActsOsAccountDeviceId_0200 + * @tc.name : queryDistributedVirtualDeviceId promise + * @tc.desc : get distributed virtual device ID + */ + it('ActsOsAccountDeviceId_0200', 0, async function(done){ + console.debug("====>ActsOsAccountDeviceId_0200 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + const deviceId = '5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5'; + const accountAbility = distributedAccount.getDistributedAccountAbility(); + accountAbility.updateOsAccountDistributedInfo( + { + name: 'ZhangSan', + id: '12345', + event: "Ohos.account.event.LOGIN" + }, async (err)=>{ + console.debug("====>update distributedInfo err:" + JSON.stringify(err)); + console.debug("====>queryDistributedVirtualDeviceId start===="); + var id = await AccountManager.queryDistributedVirtualDeviceId(); + console.debug("====>queryDistributedVirtualDeviceId:" + id); + expect(id).assertEqual(deviceId); + console.debug("====>ActsOsAccountDeviceId_0200 end===="); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountCheckActived_0100 + * @tc.name : checkOsAccountActivated callback + * @tc.desc : Verify query 0 user status is true + */ + it('ActsOsAccountCheckActived_0100', 0, async function(done){ + console.debug("====>ActsOsAccountCheckActived_0100 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + AccountManager.checkOsAccountActivated(0, (err, isActived)=>{ + console.debug("====>checkOsAccountActivated err:" + JSON.stringify(err)); + console.debug("====>checkOsAccountActivated isActived:" + isActived); + expect(err).assertEqual(null); + expect(isActived).assertEqual(true); + console.debug("====>ActsOsAccountCheckActived_0100 end"); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountCheckActived_0200 + * @tc.name : checkOsAccountActivated promise + * @tc.desc : Verify query 0 user status is true + */ + it('ActsOsAccountCheckActived_0200', 0, async function(done){ + console.debug("====>ActsOsAccountCheckActived_0200 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + try{ + var isActived = await AccountManager.checkOsAccountActivated(0); + } + catch(err){ + console.debug("====>catch checkOsAccountActivated err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>checkOsAccountActivated:" + isActived); + expect(isActived).assertEqual(true); + console.debug("====>ActsOsAccountCheckActived_0200 end"); + done(); + }) + + /* + * @tc.number : ActsOsAccountCheckActived_0300 + * @tc.name : checkOsAccountActivated callback + * @tc.desc : Authentication failed to query the active status of the user that does not exist + */ + it('ActsOsAccountCheckActived_0300', 0, async function(done){ + console.debug("====>ActsOsAccountCheckActived_0300 start"); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var nonExistLocalId = 1000; + AccountManager.checkOsAccountActivated(nonExistLocalId, (err)=>{ + console.debug("====>checkOsAccountActivated err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_ACCOUNT_NOT_EXIST); + console.debug("====>ActsOsAccountCheckActived_0300 end"); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountCheckActived_0400 + * @tc.name : checkOsAccountActivated promise + * @tc.desc : Authentication failed to query the active status of the user that does not exist + */ + it('ActsOsAccountCheckActived_0400', 0, async function(done){ + console.debug("====>ActsOsAccountCheckActived_0400 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var nonExistLocalId = 1000; + try{ + await AccountManager.checkOsAccountActivated(nonExistLocalId); + } + catch(err){ + console.debug("====>checkOsAccountActivated err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_ACCOUNT_NOT_EXIST); + console.debug("====>ActsOsAccountCheckActived_0400 end"); + done(); + } + }) + + /* + * @tc.number : ActsOsAccountCheckActived_0500 + * @tc.name : checkOsAccountActivated callback + * @tc.desc : Verify that the query active state is not received with parameter type mismatch + */ + it('ActsOsAccountCheckActived_0500', 0, async function(done){ + console.debug("====>ActsOsAccountCheckActived_0500 start"); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var localIdStr = "100"; + try{ + AccountManager.checkOsAccountActivated(localIdStr, ()=>{ + expect().assertFail(); + done(); + }) + }catch(err){ + expect(err.code).assertEqual(ERR_PARAMETER_CHECK_FAILED) + done(); + } + }) + + /* + * @tc.number : ActsOsAccountCheckActived_0600 + * @tc.name : checkOsAccountActivated promise + * @tc.desc : Verify that the query active state is not received with parameter type mismatch + */ + it('ActsOsAccountCheckActived_0600', 0, async function(done){ + console.debug("====>ActsOsAccountCheckActived_0600 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var localIdStr = "100"; + try{ + AccountManager.checkOsAccountActivated(localIdStr).then(()=>{ + expect().assertFail(); + done(); + }) + }catch(err){ + expect(err.code).assertEqual(ERR_PARAMETER_CHECK_FAILED) + done(); + } + }) + + /* + * @tc.number : ActsOsAccountCheckActived_0700 + * @tc.name : checkOsAccountActivated callback + * @tc.desc : Verify that the query active state is not received with parameter undefined + */ + it('ActsOsAccountCheckActived_0700', 0, async function(done){ + console.debug("====>ActsOsAccountCheckActived_0700 start"); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + try{ + AccountManager.checkOsAccountActivated(undefined, ()=>{ + expect().assertFail(); + done(); + }) + }catch(err){ + expect(err.code).assertEqual(ERR_PARAMETER_CHECK_FAILED) + done(); + } + }) + + /* + * @tc.number : ActsOsAccountCheckActived_0800 + * @tc.name : checkOsAccountActivated promise + * @tc.desc : Verify that the query active state is not received with parameter undefined + */ + it('ActsOsAccountCheckActived_0800', 0, async function(done){ + console.debug("====>ActsOsAccountCheckActived_0800 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>ActsOsAccountCheckActived_0800 get os AccountManager finish===="); + try{ + AccountManager.checkOsAccountActivated(undefined).then(()=>{ + expect().assertFail(); + done(); + }) + }catch(err){ + expect(err.code).assertEqual(ERR_PARAMETER_CHECK_FAILED) + done(); + } + }) + + /* + * @tc.number : ActsOsAccountCheckMulty_0100 + * @tc.name : checkMultiOsAccountEnabled callback + * @tc.desc : Check whether the function of supporting multiple os account is enabled + */ + it('ActsOsAccountCheckMulty_0100', 0, async function(done){ + console.debug("====>ActsOsAccountCheckMulty_0100 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + AccountManager.checkMultiOsAccountEnabled((err, data)=>{ + console.debug("====>checkMultiOsAccountEnabled err:" + JSON.stringify(err)); + console.debug("====>checkMultiOsAccountEnabled data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual(true); + console.debug("====>ActsOsAccountCheckMulty_0100 end===="); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountCheckMulty_0200 + * @tc.name : checkMultiOsAccountEnabled promise + * @tc.desc : Check whether the function of supporting multiple os account is enabled + */ + it('ActsOsAccountCheckMulty_0200', 0, async function(done){ + console.debug("====>ActsOsAccountCheckMulty_0200 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + try{ + var data = await AccountManager.checkMultiOsAccountEnabled(); + } + catch(err){ + console.debug("====>catch checkMultiOsAccountEnabled err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + } + console.debug("====>checkMultiOsAccountEnabled data:" + JSON.stringify(data)); + expect(data).assertEqual(true); + console.debug("====>ActsOsAccountCheckMulty_0200 end===="); + done(); + }) + + /* + * @tc.number : ActsOsAccountCheckVerified_0100 + * @tc.name : checkOsAccountVerified callback + * @tc.desc : Verify that the initial state query is unlocked to false + */ + it('ActsOsAccountCheckVerified_0100', 0, async function(done){ + console.debug("====>checkOsAccountVerified_0100 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + AccountManager.checkOsAccountVerified((err, data)=>{ + console.debug("====>checkOsAccountVerified err:" + JSON.stringify(err)); + console.debug("====>checkOsAccountVerified data:" + data); + expect(err).assertEqual(null); + expect(data).assertEqual(false); + console.debug("====>ActsOsAccountCheckVerified_0100 end===="); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountCheckVerified_0200 + * @tc.name : checkOsAccountVerified promise + * @tc.desc : Verify that the initial state query is unlocked to false + */ + it('ActsOsAccountCheckVerified_0200', 0, async function(done){ + console.debug("====>checkOsAccountVerified_0200 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var checkOsAccountVerified = await AccountManager.checkOsAccountVerified(); + console.debug("====>checkOsAccountVerified data:" + JSON.stringify(checkOsAccountVerified)); + expect(checkOsAccountVerified).assertEqual(false); + console.debug("====>ActsOsAccountCheckVerified_0200 end===="); + done(); + }) + + /* + * @tc.number : ActsOsAccountCheckVerified_0300 + * @tc.name : checkOsAccountVerified callback + * @tc.desc : Verify that the initial state query 0 user is unlocked to false + */ + it('ActsOsAccountCheckVerified_0300', 0, async function(done){ + console.debug("====>ActsOsAccountCheckVerified_0300 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + AccountManager.checkOsAccountVerified(0, (err, data)=>{ + console.debug("====>checkOsAccountVerified err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + expect(data).assertFalse(); + console.debug("====>ActsOsAccountCheckVerified_0300 end===="); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountCheckVerified_0400 + * @tc.name : checkOsAccountVerified promise + * @tc.desc : Verify that the initial state query 0 user is unlocked to false + */ + it('ActsOsAccountCheckVerified_0400', 0, async function(done){ + console.debug("====>ActsOsAccountCheckVerified_0400 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var checkOsAccountVerified = await AccountManager.checkOsAccountVerified(0); + console.debug("====>checkOsAccountVerified data:" + JSON.stringify(checkOsAccountVerified)); + expect(checkOsAccountVerified).assertFalse(); + console.debug("====>ActsOsAccountCheckVerified_0400 end===="); + done(); + }) + + /* + * @tc.number : ActsOsAccountCheckVerified_0500 + * @tc.name : checkOsAccountVerified callback + * @tc.desc : Verify query "100" user is unlocked failed + */ + it('ActsOsAccountCheckVerified_0500', 0, async function(done){ + console.debug("====>ActsOsAccountCheckVerified_0500 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var localIdStr = "100"; + try{ + AccountManager.checkOsAccountVerified(localIdStr, ()=>{ + expect().assertFail(); + done(); + }) + }catch(err){ + expect(err.code).assertEqual(ERR_PARAMETER_CHECK_FAILED); + console.debug("====>ActsOsAccountCheckVerified_0500 end===="); + done(); + } + }) + + /* + * @tc.number : ActsOsAccountCheckVerified_0600 + * @tc.name : checkOsAccountVerified promise + * @tc.desc : Verify query "100" user is unlocked failed + */ + it('ActsOsAccountCheckVerified_0600', 0, async function(done){ + console.debug("====>ActsOsAccountCheckVerified_0600 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var localIdStr = "100"; + try{ + AccountManager.checkOsAccountVerified(localIdStr).then(()=>{ + expect().assertFail(); + done(); + }) + }catch(err){ + expect(err.code).assertEqual(ERR_PARAMETER_CHECK_FAILED) + console.debug("====>ActsOsAccountCheckVerified_0600 end===="); + done(); + } + }) + + /* + * @tc.number : ActsOsAccountCheckVerified_0700 + * @tc.name : checkOsAccountVerified callback + * @tc.desc : Verify query undefined user is unlocked failed + */ + it('ActsOsAccountCheckVerified_0700', 0, async function(done){ + console.debug("====>ActsOsAccountCheckVerified_0700 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var localIdUndefined = undefined; + try{ + AccountManager.checkOsAccountVerified(localIdUndefined, ()=>{ + expect().assertFail(); + done(); + }) + }catch(err){ + expect(err.code).assertEqual(ERR_PARAMETER_CHECK_FAILED); + console.debug("====>ActsOsAccountCheckVerified_0700 end===="); + done(); + } + }) + + /* + * @tc.number : ActsOsAccountCheckVerified_0800 + * @tc.name : checkOsAccountVerified promise + * @tc.desc : Verify query undefined user is unlocked failed + */ + it('ActsOsAccountCheckVerified_0800', 0, async function(done){ + console.debug("====>ActsOsAccountCheckVerified_0800 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var localIdUndefined = undefined; + try{ + AccountManager.checkOsAccountVerified(localIdUndefined).then(()=>{ + expect().assertFail(); + done(); + }) + }catch(err){ + expect(err.code).assertEqual(ERR_PARAMETER_CHECK_FAILED) + console.debug("====>ActsOsAccountCheckVerified_0800 end===="); + done(); + } + }) + + /* + * @tc.number : ActsOsAccountCheckVerified_0900 + * @tc.name : checkOsAccountVerified callback + * @tc.desc : Verify query does not exist user unlock failed + */ + it('ActsOsAccountCheckVerified_0900', 0, async function(done){ + console.debug("====>ActsOsAccountCheckVerified_0900 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var osAccountLocalId = 1000; + AccountManager.checkOsAccountVerified(osAccountLocalId, (err)=>{ + console.debug("====>checkOsAccountVerified err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_ACCOUNT_NOT_EXIST) + console.debug("====>ActsOsAccountCheckVerified_0900 end===="); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountCheckVerified_1000 + * @tc.name : checkOsAccountVerified promise + * @tc.desc : Verify query does not exist user unlock failed + */ + it('ActsOsAccountCheckVerified_1000', 0, async function(done){ + console.debug("====>ActsOsAccountCheckVerified_1000 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var osAccountLocalId = 1000; + try{ + await AccountManager.checkOsAccountVerified(osAccountLocalId); + } + catch(err){ + console.debug("====>checkOsAccountVerified err:" + JSON.stringify(err)); + expect(err.code).assertEqual(ERR_ACCOUNT_NOT_EXIST) + console.debug("====>ActsOsAccountCheckVerified_1000 end===="); + done(); + } + }) + + /* + * @tc.number : ActsOsAccountCheckTest_0100 + * @tc.name : checkOsAccountTestable callback + * @tc.desc : check whether this OS account is a test OS account + */ + it('ActsOsAccountCheckTest_0100', 0, async function(done){ + console.debug("====>ActsOsAccountCheckTest_0100 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + AccountManager.checkOsAccountTestable((err, data)=>{ + console.debug("====>checkOsAccountTestable err:" + JSON.stringify(err)); + console.debug("====>checkOsAccountTestable data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data).assertEqual(false); + console.debug("====>ActsOsAccountCheckTest_0100 end===="); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountCheckTest_0200 + * @tc.name : checkOsAccountTestable promise + * @tc.desc : check whether this OS account is a test OS account + */ + it('ActsOsAccountCheckTest_0200', 0, async function(done){ + console.debug("====>ActsOsAccountCheckTest_0200 start===="); + var AccountManager = osAccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var isTest = await AccountManager.checkOsAccountTestable(); + expect(isTest).assertFalse(); + console.debug("====>ActsOsAccountCheckTest_0200 end===="); + done(); + }) + + + }) +} \ No newline at end of file diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountQuery.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountQuery.test.js new file mode 100644 index 000000000..7c6759d51 --- /dev/null +++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountQuery.test.js @@ -0,0 +1,698 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import osaccount from '@ohos.account.osAccount' +import bundle from '@ohos.bundle' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + + +const ERR_INVALID_PARAMETER = 12300002; +export default function ActsOsAccountThirdPartyTest_third_4() { + describe('ActsOsAccountThirdPartyTest_third_4', function () { + afterEach(async function (done) { + console.debug("====>afterEach start===="); + var osAccountManager = osaccount.getAccountManager(); + var accounts = await osAccountManager.queryAllCreatedOsAccounts() + for (i=0;i<accounts.length;i++){ + var localId = accounts[i].localId + if(localId!=100){ + await osAccountManager.removeOsAccount(localId) + } + } + done(); + }) + /* + * @tc.number : ActsOsAccountQueryIdFormUid_0100 + * @tc.name : queryOsAccountLocalIdFromUid callback + * @tc.desc : Verify that the user localId is obtained by uid + */ + it('ActsOsAccountQueryIdFormUid_0100', 0, async function (done) { + console.debug("====>ActsOsAccountQueryIdFormUid_0100 start===="); + var osAccountManager = osaccount.getAccountManager(); + var testLocalId = await osAccountManager.queryOsAccountLocalIdFromProcess(); + console.debug("====>testLocalId:" + testLocalId) + console.debug("====>get AccountManager finish===="); + var bundleName = "com.example.actsosaccountthirdpartytest"; + var bundleInfo = await bundle.getBundleInfo(bundleName, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES); + var uid = bundleInfo.uid; + console.debug("====>obtained uid:" + uid); + osAccountManager.queryOsAccountLocalIdFromUid(uid, (err, localId)=>{ + console.debug("====>get localId err: " + JSON.stringify(err)); + console.debug("====>localId obtained by uid:" + localId); + expect(err).assertEqual(null); + expect(localId).assertEqual(testLocalId); + console.debug("====>ActsOsAccountQueryIdFormUid_0100 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsOsAccountQueryIdFormUid_0200 + * @tc.name : queryOsAccountLocalIdFromUid promise + * @tc.desc : Verify that the user localId is obtained by uid + */ + it('ActsOsAccountQueryIdFormUid_0200', 0, async function (done) { + console.debug("====>ActsOsAccountQueryIdFormUid_0200 start===="); + var osAccountManager = osaccount.getAccountManager(); + var testLocalId = await osAccountManager.queryOsAccountLocalIdFromProcess(); + console.debug("====>get AccountManager finish===="); + var bundleName = "com.example.actsosaccountthirdpartytest"; + var bundleInfo = await bundle.getBundleInfo(bundleName, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES); + var uid = bundleInfo.uid; + console.debug("====>obtained uid:" + uid); + var localId = await osAccountManager.queryOsAccountLocalIdFromUid(uid); + console.debug("====>localId obtained by uid:" + localId); + expect(localId).assertEqual(testLocalId); + console.debug("====>ActsOsAccountQueryIdFormUid_0200 end===="); + done(); + }); + + /* + * @tc.number : ActsOsAccountQueryIdFormUid_0300 + * @tc.name : queryOsAccountLocalIdFromUid callback + * @tc.desc : Authentication failed to query user by uid -1 + */ + it('ActsOsAccountQueryIdFormUid_0300', 0, async function (done) { + console.debug("====>ActsOsAccountQueryIdFormUid_0300 start===="); + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + var incorrectUid = -1; + osAccountManager.queryOsAccountLocalIdFromUid(incorrectUid, (err, localId)=>{ + console.debug("====>get localId err: " + JSON.stringify(err)); + console.debug("====>localId obtained by uid:" + localId); + expect(err.code).assertEqual(ERR_INVALID_PARAMETER); + expect(localId).assertEqual(null); + console.debug("====>ActsOsAccountQueryIdFormUid_0300 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsOsAccountQueryIdFormUid_0400 + * @tc.name : queryOsAccountLocalIdFromUid promise + * @tc.desc : Authentication failed to query user by uid -1 + */ + it('ActsOsAccountQueryIdFormUid_0400', 0, async function (done) { + console.debug("====>ActsOsAccountQueryIdFormUid_0400 start===="); + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + var incorrectUid = -1; + try{ + await osAccountManager.queryOsAccountLocalIdFromUid(incorrectUid); + }catch(err){ + console.debug("====>get localId by uid err:" +JSON.stringify(err)); + expect(err.code).assertEqual(ERR_INVALID_PARAMETER); + console.debug("====>ActsOsAccountQueryIdFormUid_0400 end===="); + done(); + } + }); + + /* + * @tc.number : ActsOsAccountQueryIdFormUid_0500 + * @tc.name : queryOsAccountLocalIdFromUid callback + * @tc.desc : Authentication failed to query user by uid 2147483648 + */ + it('ActsOsAccountQueryIdFormUid_0500', 0, async function (done) { + console.debug("====>ActsOsAccountQueryIdFormUid_0500 start===="); + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + var incorrectUid = 2147483648; + osAccountManager.queryOsAccountLocalIdFromUid(incorrectUid, (err, localId)=>{ + console.debug("====>get localId err: " + JSON.stringify(err)); + console.debug("====>localId obtained by uid:" + localId); + expect(err.code).assertEqual(ERR_INVALID_PARAMETER); + expect(localId).assertEqual(null); + console.debug("====>ActsOsAccountQueryIdFormUid_0500 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsOsAccountQueryIdFormUid_0600 + * @tc.name : queryOsAccountLocalIdFromUid promise + * @tc.desc : Authentication failed to query user by uid 2147483648 + */ + it('ActsOsAccountQueryIdFormUid_0600', 0, async function (done) { + console.debug("====>ActsOsAccountQueryIdFormUid_0600 start===="); + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + var incorrectUid = 2147483648; + try{ + await osAccountManager.queryOsAccountLocalIdFromUid(incorrectUid); + }catch(err){ + console.debug("====>get localId by uid err:" +JSON.stringify(err)); + expect(err.code).assertEqual(ERR_INVALID_PARAMETER); + console.debug("====>ActsOsAccountQueryIdFormUid_0600 end===="); + done(); + } + }); + + /* + * @tc.number : ActsOsAccountQueryIdFormProcess_0100 + * @tc.name : queryOsAccountLocalIdFromProcess callback + * @tc.desc : Verify that the user localId obtained from the current process uid + */ + it('ActsOsAccountQueryIdFormProcess_0100', 0, async function (done) { + console.debug("====>ActsOsAccountQueryIdFormProcess_0100 start===="); + var osAccountManager = osaccount.getAccountManager(); + var bundleName = "com.example.actsosaccountthirdpartytest"; + var bundleInfo = await bundle.getBundleInfo(bundleName, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES); + var uid = bundleInfo.uid; + var testLocalId = await osAccountManager.queryOsAccountLocalIdFromUid(uid) + console.debug("====>get AccountManager finish===="); + osAccountManager.queryOsAccountLocalIdFromProcess((err, localId)=>{ + console.debug("====>get localId err: " + JSON.stringify(err)); + console.debug("====>localId obtained by process:" + localId); + expect(err).assertEqual(null); + expect(localId).assertEqual(testLocalId); + console.debug("====>ActsOsAccountQueryIdFormProcess_0100 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsOsAccountQueryIdFormProcess_0200 + * @tc.name : queryOsAccountLocalIdFromProcess promise + * @tc.desc : Verify that the user localId obtained from the current process uid + */ + it('ActsOsAccountQueryIdFormProcess_0200', 0, async function (done) { + console.debug("====>ActsOsAccountQueryIdFormProcess_0200 start===="); + var osAccountManager = osaccount.getAccountManager(); + var bundleName = "com.example.actsosaccountthirdpartytest"; + var bundleInfo = await bundle.getBundleInfo(bundleName, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES); + var uid = bundleInfo.uid; + var testLocalId = await osAccountManager.queryOsAccountLocalIdFromUid(uid) + console.debug("====>testLocalId obtained by process:" + testLocalId) + console.debug("====>get AccountManager finish===="); + var localId = await osAccountManager.queryOsAccountLocalIdFromProcess(); + console.debug("====>localId obtained by process:" + localId); + expect(localId).assertEqual(testLocalId); + console.debug("====>ActsOsAccountQueryIdFormProcess_0200 end===="); + done(); + }); + + /* + * @tc.number : ActsOsAccountgetType_0100 + * @tc.name : getOsAccountType callback + * @tc.desc : Verify that the user type obtained from the current process uid + */ + it('ActsOsAccountgetType_0100', 0, async function (done) { + console.debug("====>ActsOsAccountgetType_0100 start===="); + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + osAccountManager.getOsAccountType((err, accountType)=>{ + console.debug("====>get type err: " + JSON.stringify(err)); + console.debug("====>type obtained by process:" + JSON.stringify(accountType)); + expect(err).assertEqual(null); + expect(accountType.ADMIN).assertEqual(0); + console.debug("====>ActsOsAccountgetType_0100 end===="); + done(); + }); + }); + + /* + * @tc.number : ActsOsAccountgetType_0200 + * @tc.name : getOsAccountType promise + * @tc.desc : Verify that the user type obtained from the current process uid + */ + it('ActsOsAccountgetType_0200', 0, async function (done) { + console.debug("====>ActsOsAccountgetType_0200 start===="); + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + var accountType = await osAccountManager.getOsAccountType(); + console.debug("====>type obtained by process:" + JSON.stringify(accountType)); + expect(accountType.ADMIN).assertEqual(0); + console.debug("====>ActsOsAccountgetType_0200 end===="); + done(); + }); + + /* + * @tc.number : ActsOsAccountQueryLocalIdSerial_0100 + * @tc.name : querySerialNumberByOsAccountLocalId callback + * @tc.desc : Verify query serialNumber by 100 user and query 100 user by serialNumber + */ + it('ActsOsAccountQueryLocalIdSerial_0100', 0, async function (done) { + console.debug("====>ActsOsAccountQueryLocalIdSerial_0100 start===="); + var osAccountManager = osaccount.getAccountManager(); + var testLocalId = await osAccountManager.queryOsAccountLocalIdFromProcess(); + console.debug("====>get AccountManager finish===="); + osAccountManager.querySerialNumberByOsAccountLocalId(testLocalId, (err, serialNumber)=>{ + console.debug("====>ger serialNumber err:" + JSON.stringify(err)); + console.debug("====>get serialNumber:" + serialNumber + " by localId: 100" ); + expect(err).assertEqual(null); + var serialNumberStr = serialNumber.toString(); + var serialIntercept = serialNumberStr.substring(8); + console.debug("====>truncate the last eight characters: " + serialIntercept); + expect(serialIntercept).assertEqual("00000001"); + osAccountManager.queryOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{ + console.debug("====>ger localId err:" + JSON.stringify(err)); + console.debug("====>get localId:" + localId + " by serialNumber: " + serialNumber); + expect(err).assertEqual(null); + expect(localId).assertEqual(testLocalId); + console.debug("====>ActsOsAccountQueryLocalIdSerial_0100 end===="); + done(); + }) + }) + }); + + /* + * @tc.number : ActsOsAccountQueryLocalIdSerial_0200 + * @tc.name : querySerialNumberByOsAccountLocalId promise + * @tc.desc : Verify query serialNumber by 100 user and query 100 user by serialNumber + */ + it('ActsOsAccountQueryLocalIdSerial_0200', 0, async function (done) { + console.debug("====>ActsOsAccountQueryLocalIdSerial_0200 start===="); + var osAccountManager = osaccount.getAccountManager(); + var testLocalId = await osAccountManager.queryOsAccountLocalIdFromProcess(); + console.debug("====>get AccountManager finish===="); + var serialNumber = await osAccountManager.querySerialNumberByOsAccountLocalId(testLocalId); + console.debug("====>get serialNumber:" + serialNumber + " by localId: 100" ); + var serialNumberStr = serialNumber.toString(); + var serialIntercept = serialNumberStr.substring(8); + console.debug("====>truncate the last eight characters: " + serialIntercept); + expect(serialIntercept).assertEqual("00000001"); + var localId = await osAccountManager.queryOsAccountLocalIdBySerialNumber(serialNumber); + console.debug("====>get localId:" + localId + " by serialNumber: " + serialNumber); + expect(localId).assertEqual(testLocalId); + console.debug("====>ActsOsAccountQueryLocalIdSerial_0200 end===="); + done(); + }); + + /* + * @tc.number : ActsOsAccountQueryLocalIdSerial_0300 + * @tc.name : queryOsAccountLocalIdBySerialNumber callback + * @tc.desc : Verify query serialNumber by 0 user and query 0 user by serialNumber + */ + it('ActsOsAccountQueryLocalIdSerial_0300', 0, async function (done) { + console.debug("====>ActsOsAccountQueryLocalIdSerial_0300 start===="); + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + osAccountManager.querySerialNumberByOsAccountLocalId(0, (err, serialNumber)=>{ + console.debug("====>ger serialNumber err:" + JSON.stringify(err)); + console.debug("====>get serialNumber:" + serialNumber + " by localId: 0" ); + expect(err).assertEqual(null); + var serialNumberStr = serialNumber.toString(); + var serialIntercept = serialNumberStr.substring(8); + console.debug("====>truncate the last eight characters: " + serialIntercept); + expect(serialIntercept).assertEqual("00000000"); + osAccountManager.queryOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{ + console.debug("====>ger localId err:" + JSON.stringify(err)); + console.debug("====>get localId:" + localId + " by serialNumber: " + serialNumber); + expect(err).assertEqual(null); + expect(localId).assertEqual(0); + console.debug("====>ActsOsAccountQueryLocalIdSerial_0300 end===="); + done(); + }) + }) + }); + + /* + * @tc.number : ActsOsAccountQueryLocalIdSerial_0400 + * @tc.name : queryOsAccountLocalIdBySerialNumber promise + * @tc.desc : Verify query serialNumber by 0 user and query 0 user by serialNumber + */ + it('ActsOsAccountQueryLocalIdSerial_0400', 0, async function (done) { + console.debug("====>ActsOsAccountQueryLocalIdSerial_0400 start===="); + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + var serialNumber = await osAccountManager.querySerialNumberByOsAccountLocalId(0); + console.debug("====>get serialNumber:" + serialNumber + " by localId: 0" ); + var serialNumberStr = serialNumber.toString(); + var serialIntercept = serialNumberStr.substring(8); + console.debug("====>truncate the last eight characters: " + serialIntercept); + expect(serialIntercept).assertEqual("00000000"); + var localId = await osAccountManager.queryOsAccountLocalIdBySerialNumber(serialNumber); + console.debug("====>get localId:" + localId + " by serialNumber: " + serialNumber); + expect(localId).assertEqual(0); + console.debug("====>ActsOsAccountQueryLocalIdSerial_0400 end===="); + done(); + }); + + /* + * @tc.number : ActsOsAccountQueryLocalIdSerial_0500 + * @tc.name : querySerialNumberByOsAccountLocalId callback + * @tc.desc : Verify the query for the newly created user serialNumber and query the owning user through the + * serialNumber + */ + it('ActsOsAccountQueryLocalIdSerial_0500', 0, async function (done) { + console.debug("====>ActsOsAccountQueryLocalIdSerial_0500 start===="); + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + var localId; + osAccountManager.createOsAccount("osAccountNameIdSerialA", osaccount.OsAccountType.NORMAL, (err, data)=>{ + console.debug("====>create os account err: " + JSON.stringify(err)); + console.debug("====>create os account OsAccountInfo: " + JSON.stringify(data)); + expect(err).assertEqual(null); + expect(data.localName).assertEqual("osAccountNameIdSerialA"); + expect(data.domainInfo.accountName == "").assertEqual(true) + expect(data.type.NORMAL).assertEqual(1); + expect(data.constraints.length > 0).assertEqual(true); + expect(data.isVerified).assertEqual(false); + expect(data.distributedInfo.name != null).assertEqual(true); + expect(data.domainInfo.domain == "").assertEqual(true); + expect(data.photo == "").assertEqual(true); + expect(data.createTime != "").assertEqual(true); + expect(data.lastLoginTime>=0).assertEqual(true); + expect(data.serialNumber.toString().length == 16).assertEqual(true); + expect(data.isActived).assertEqual(false); + expect(data.isCreateCompleted).assertEqual(true) + localId = data.localId; + osAccountManager.querySerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{ + console.debug("====>queryOsAccountById err:" + JSON.stringify(err)); + console.debug("====>get serialNumber:" + serialNumber + " by localId: " + localId); + expect(err).assertEqual(null); + osAccountManager.queryOsAccountLocalIdBySerialNumber(serialNumber, (err, getlocalId)=>{ + console.debug("====>ger localId err:" + JSON.stringify(err)); + console.debug("====>get localId:" + getlocalId + " by serialNumber: " + serialNumber); + expect(err).assertEqual(null); + expect(getlocalId).assertEqual(localId); + osAccountManager.removeOsAccount(localId, (err)=>{ + console.debug("====>remove localId: " + localId + " err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsOsAccountQueryLocalIdSerial_0500 end===="); + done(); + }) + }) + }) + }) + }); + + /* + * @tc.number : ActsOsAccountQueryLocalIdSerial_0600 + * @tc.name : queryOsAccountLocalIdBySerialNumber promise + * @tc.desc : Verify the query for the newly created user serialNumber and query the owning user through the + * serialNumber + */ + it('ActsOsAccountQueryLocalIdSerial_0600', 0, async function (done) { + console.debug("====>ActsOsAccountQueryLocalIdSerial_0600 start===="); + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + var localId; + var OsAccountInfo = await osAccountManager.createOsAccount("accountIdSerialB", osaccount.OsAccountType.GUEST); + console.debug("====>create os account OsAccountInfo: " + JSON.stringify(OsAccountInfo)); + expect(OsAccountInfo.localName).assertEqual("accountIdSerialB"); + localId = OsAccountInfo.localId; + var serialNumber = await osAccountManager.querySerialNumberByOsAccountLocalId(localId); + console.debug("====>get serialNumber:" + serialNumber + " by localId: " + localId); + var getlocalId = await osAccountManager.queryOsAccountLocalIdBySerialNumber(serialNumber); + console.debug("====>get localId:" + getlocalId + " by serialNumber: " + serialNumber); + expect(getlocalId).assertEqual(localId); + await osAccountManager.removeOsAccount(localId); + console.debug("====>ActsOsAccountQueryLocalIdSerial_0600 end===="); + done(); + }); + + /* + * @tc.number : ActsOsAccountQueryCounts_0100 + * @tc.name : getOsAccountCount callback + * @tc.desc : Verify to obtain the number os all os accounts created + */ + it('ActsOsAccountQueryCounts_0100', 0, async function (done) { + console.debug("====>ActsOsAccountQueryCounts_0100 start===="); + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + var obtainCount = 0; + var localIdFir; + var localIdSec; + osAccountManager.getOsAccountCount((err, data)=>{ + console.debug("====>obtains the number of all os accounts created err:" + JSON.stringify(err)); + console.debug("====>obtains the number of all os accounts created data:" + data); + expect(err).assertEqual(null); + obtainCount = data; + osAccountManager.createOsAccount("osAccountNameIdSerialE", osaccount.OsAccountType.NORMAL, (err, data)=>{ + console.debug("====>create first os account err: " + JSON.stringify(err)); + console.debug("====>create first os account OsAccountInfo: " + JSON.stringify(data)); + localIdFir = data.localId; + expect(err).assertEqual(null); + expect(data.localName).assertEqual("osAccountNameIdSerialE"); + osAccountManager.createOsAccount("osAccountIdSerialF", osaccount.OsAccountType.NORMAL, (err, data)=>{ + console.debug("====>create second os account err: " + JSON.stringify(err)); + console.debug("====>create second os account OsAccountInfo: " + JSON.stringify(data)); + localIdSec = data.localId; + expect(err).assertEqual(null); + expect(data.localName).assertEqual("osAccountIdSerialF"); + osAccountManager.getOsAccountCount((err, count)=>{ + console.debug("====>obtains the number of all os accounts created err:" + JSON.stringify(err)); + console.debug("====>obtains the number of all os accounts created count:" + count); + expect(err).assertEqual(null); + count = count - 2; + expect(count).assertEqual(obtainCount); + osAccountManager.removeOsAccount(localIdFir, (err)=>{ + console.debug("====>remove localId: " + localIdFir + " err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + osAccountManager.getOsAccountCount((err, data)=>{ + console.debug("====>obtains the number accounts created err:" + JSON.stringify(err)); + console.debug("====>obtains the number accounts created data:" + data); + expect(err).assertEqual(null); + data = data - 1; + expect(data).assertEqual(obtainCount); + osAccountManager.removeOsAccount(localIdSec, (err)=>{ + console.debug("====>remove localId: " + localIdSec + " err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsOsAccountQueryCounts_0100 end===="); + done(); + }) + }) + }) + }) + }) + }) + }) + }) + + /* + * @tc.number : ActsOsAccountQueryCounts_0200 + * @tc.name : getOsAccountCount promise + * @tc.desc : Verify to obtain the number os all os accounts created + */ + it('ActsOsAccountQueryCounts_0200', 0, async function (done) { + console.debug("====>ActsOsAccountQueryCounts_0200 start===="); + var osAccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + var obtainCount = await osAccountManager.getOsAccountCount(); + console.debug("====>obtains the number of all os accounts created:" + obtainCount); + var osAccountFir = await osAccountManager.createOsAccount("osAccountIdSerialG", osaccount.OsAccountType.NORMAL); + console.debug("====>create first os account OsAccountInfo: " + JSON.stringify(osAccountFir)); + var localIdFir = osAccountFir.localId; + expect(osAccountFir.localName).assertEqual("osAccountIdSerialG"); + var osAccountSec = await osAccountManager.createOsAccount("osAccountIdSerialH", osaccount.OsAccountType.NORMAL); + console.debug("====>create second os account OsAccountInfo: " + JSON.stringify(osAccountSec)); + var localIdSec = osAccountSec.localId; + expect(osAccountSec.localName).assertEqual("osAccountIdSerialH"); + var countFir = await osAccountManager.getOsAccountCount(); + console.debug("====>obtains the number of all os accounts created count:" + countFir); + countFir = countFir - 2; + expect(countFir).assertEqual(obtainCount); + await osAccountManager.removeOsAccount(localIdFir); + console.debug("====>remove localId: " + localIdFir); + var countSec = await osAccountManager.getOsAccountCount(); + console.debug("====>obtains the number accounts created count:" + countSec); + countSec = countSec - 1; + expect(countSec).assertEqual(obtainCount); + await osAccountManager.removeOsAccount(localIdSec); + console.debug("====>remove localId: " + localIdSec); + console.debug("====>ActsOsAccountQueryCounts_0200 end===="); + done(); + }) + + /* + * @tc.number : ActsOsAccountGetActivedOsAccountIds_0100 + * @tc.name : getActivatedOsAccountIds callback + * @tc.desc : query activated osAccount Ids + */ + it('ActsOsAccountGetActivedOsAccountIds_0100', 0, async function (done) { + console.debug("====>ActsOsAccountGetActivedOsAccountIds_0100 start===="); + var osAccountManager = osaccount.getAccountManager(); + osAccountManager.getActivatedOsAccountIds((err,dataArray)=>{ + console.info("====>ActsOsAccountGQueryActicedOsAccountIds_0100 err :" + JSON.stringify(err)); + expect(err).assertEqual(null) + console.info("====>ActsOsAccountGQueryActicedOsAccountIds_0100 dataArray:" + dataArray); + expect(dataArray.length).assertEqual(1) + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountGetActivedOsAccountIds_0200 + * @tc.name : getActivatedOsAccountIds promise + * @tc.desc : query activated osAccount Ids + */ + it('ActsOsAccountGetActivedOsAccountIds_0200', 0, async function (done) { + console.debug("====>ActsOsAccountGetActivedOsAccountIds_0200 start===="); + var osAccountManager = osaccount.getAccountManager(); + osAccountManager.getActivatedOsAccountIds().then((dataArray)=>{ + console.debug("====>ActsOsAccountGetActivedOsAccountIds_0200 data" + JSON.stringify(dataArray)) + expect(dataArray.length).assertEqual(1) + done(); + }).catch((err)=>{ + console.info("====>ActsOsAccountGetActivedOsAccountIds_0200 err " + JSON.stringify(err)); + expect(err).assertFalse(null) + done(); + }); + }) + + + /* + * @tc.number : ActsOsAccountCheckConstraints_0300 + * @tc.name : Constraints callback + * @tc.desc : get 0 local user all constraints + */ + it('ActsOsAccountCheckConstraints_3100', 0, async function(done){ + console.debug("====>ActsOsAccountCheckConstraints_3100 start===="); + var AccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + AccountManager.getOsAccountConstraints(0, (err, constraints)=>{ + console.debug("====>getOsAccountConstraints err:" + JSON.stringify(err)); + console.debug("====>getOsAccountConstraints:" + JSON.stringify(constraints)); + expect(err).assertEqual(null); + expect(constraints.length).assertEqual(0); + console.debug("====>ActsOsAccountCheckConstraints_3100 end===="); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountCheckConstraints_0400 + * @tc.name : Constraints promise + * @tc.desc : get 0 local user all constraints + */ + it('ActsOsAccountCheckConstraints_3200', 0, async function(done){ + console.debug("====>ActsOsAccountCheckConstraints_3200 start===="); + var AccountManager = osaccount.getAccountManager(); + console.debug("get AccountManager finish===="); + AccountManager.getOsAccountConstraints(0).then((data)=>{ + console.debug("====>ActsOsAccountCheckConstraints_3200 getOsAccountConstraints data:" + data); + done(); + }).catch((err)=>{ + console.debug("====>ActsOsAccountCheckConstraints_3200 getOsAccountConstraints err:" + JSON.stringify(err)); + expect().assertFalse() + done(); + }) + }) + + /** + * @tc.number ActsOsAccountQueryDomainTest_0300 + * @tc.name Test createOsAccountForDomain queryOsAccountLocalIdFromDomain callback + * @tc.desc Test createOsAccountForDomain queryOsAccountLocalIdFromDomain API functionality + */ + it('ActsOsAccountQueryDomainTest_0300', 0, async function (done) { + console.debug("====>ActsOsAccountQueryDomainTest_0100 start===="); + var osAccountManager = osaccount.getAccountManager(); + osAccountManager.queryOsAccountLocalIdFromDomain({domain: "", accountName: ""}, (err)=>{ + console.debug("====>ActsOsAccountQueryDomainTest_0300 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true) + console.debug("====>ActsOsAccountQueryDomainTest_0300 end===="); + done(); + }) + }); + + /** + * @tc.number ActsOsAccountQueryDomainTest_0400 + * @tc.name Test createOsAccountForDomain queryOsAccountLocalIdFromDomain pormise + * @tc.desc Test createOsAccountForDomain queryOsAccountLocalIdFromDomain API functionality + */ + it('ActsOsAccountQueryDomainTest_0400', 0, async function (done) { + console.debug("====>ActsOsAccountQueryDomainTest_0400 start===="); + var osAccountManager = osaccount.getAccountManager(); + osAccountManager.queryOsAccountLocalIdFromDomain({domain: "", accountName: ""}).then((accountID)=>{ + console.debug("ActsOsAccountQueryDomainTest_0400 accountID:" + JSON.stringify(accountID)) + done(); + }).catch((err)=>{ + console.debug("ActsOsAccountQueryDomainTest_0400 err:" + JSON.stringify(err)) + expect(err.code != 0).assertEqual(true) + done(); + }) + }); + + /* + * @tc.number : ActsOsAccountGetCurrent_2100 + * @tc.name : getCurrentOsAccount callback + * @tc.desc : Get the os account information to which the application belongs + */ + it('ActsOsAccountGetCurrent_2100', 0, async function(done){ + console.debug("====>ActsOsAccountGetCurrent_2100 start===="); + var AccountManager = osaccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + AccountManager.getCurrentOsAccount((err, data)=>{ + console.debug("====>getCurrentOsAccount err:" + JSON.stringify(err)); + console.debug("====>getCurrentOsAccount data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + console.debug("====>ActsOsAccountGetCurrent_2100 end===="); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountGetCurrent_1800 + * @tc.name : getCurrentOsAccount promise + * @tc.desc : Get the os account information to which the application belongs + */ + it('ActsOsAccountGetCurrent_2200', 0, async function(done){ + console.debug("====>ActsOsAccountGetCurrent_2200 start===="); + var AccountManager = osaccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var data = await AccountManager.getCurrentOsAccount(); + console.debug("====>getCurrentOsAccount data:" + JSON.stringify(data)); + expect(data.localId).assertEqual(100); + expect(data.type.ADMIN).assertEqual(0); + var serialNumberStr = data.serialNumber.toString(); + var serialIntercept = serialNumberStr.substring(8); + console.debug("====>truncate the last eight characters: " + serialIntercept); + expect(serialIntercept).assertEqual("00000001"); + expect(data.isCreateCompleted).assertTrue(); + console.debug("====>ActsOsAccountGetCurrent_2200 end===="); + done(); + }) + + + /* + * @tc.number : ActsOsAccountCheckConstraints_3300 + * @tc.name : checkConstraintEnabled callback + * @tc.desc : the application call interface does not meet the permissions + */ + it('ActsOsAccountCheckConstraints_3300', 0, async function(done){ + console.debug("====>ActsOsAccountCheckConstraints_3300 start===="); + var AccountManager = osaccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + AccountManager.checkConstraintEnabled(100, "constraint.bluetooth", (err, result)=>{ + console.debug("====>checkConstraintEnabled err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + expect(result).assertTrue(); + console.debug("====>ActsOsAccountCheckConstraints_3300 end===="); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountPermission_3400 + * @tc.name : checkConstraintEnabled promise + * @tc.desc : the application call interface does not meet the permissions + */ + it('ActsOsAccountCheckConstraints_3400', 0, async function(done){ + console.debug("====>ActsOsAccountCheckConstraints_3400 start===="); + var AccountManager = osaccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + try{ + await AccountManager.checkConstraintEnabled(100, "constraint.bluetooth"); + done(); + } + catch(err){ + console.debug("====>checkConstraintEnabled err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsOsAccountCheckConstraints_3400 end===="); + done(); + } + }) + }) +} \ No newline at end of file -- GitLab