From 3b8e77a4faa896592cda1a644cdc248d12707016 Mon Sep 17 00:00:00 2001 From: lichenchen Date: Fri, 11 Nov 2022 16:06:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E9=94=99=E8=AF=AF=E7=A0=81?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=8Cxts=E7=94=A8=E4=BE=8B=E9=A2=84?= =?UTF-8?q?=E6=9C=9F=E7=BB=93=E6=9E=9C=E5=90=8C=E6=AD=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lichenchen --- .../actsaccountoperatetest/src/main/config.json | 3 ++- .../src/main/js/test/AccountCredential.test.js | 5 +++-- .../src/main/js/test/AuthToken.test.js | 4 ++-- .../src/main/js/test/Authenticator.test.js | 14 +++++++++++--- .../src/main/js/test/CreateAccount.test.js | 6 +++--- .../actsaccounttest/src/main/config.json | 5 ++--- .../src/main/js/MainAbility/pages/index/index.js | 6 +++--- 7 files changed, 26 insertions(+), 17 deletions(-) diff --git a/account/appaccount/actsaccountoperatetest/src/main/config.json b/account/appaccount/actsaccountoperatetest/src/main/config.json index 90decaf4c..57e7b450a 100644 --- a/account/appaccount/actsaccountoperatetest/src/main/config.json +++ b/account/appaccount/actsaccountoperatetest/src/main/config.json @@ -17,7 +17,8 @@ "package": "com.example.actsaccountoperatetest", "name": ".MyApplication", "deviceType": [ - "phone" + "tablet", + "default" ], "distro": { "deliveryWithInstall": true, diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/AccountCredential.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/AccountCredential.test.js index 934129765..4bb7bcf47 100644 --- a/account/appaccount/actsaccountoperatetest/src/main/js/test/AccountCredential.test.js +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/AccountCredential.test.js @@ -17,6 +17,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from const TIMEOUT = 5000; const EACHTIMEOUT = 500; +const ERR_JS_CREDENTIAL_NOT_EXIST = 12300102; export default function ActsAppAccountCredential() { describe('ActsAppAccountCredential', function () { function sleep(delay) { @@ -458,7 +459,7 @@ export default function ActsAppAccountCredential() { 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); + expect(err.code == ERR_JS_CREDENTIAL_NOT_EXIST).assertEqual(true); appAccountManager.removeAccount("account_name_1500", (err)=>{ console.debug("====>delete Account ActsAppAccountCredential_1500 err:" + JSON.stringify(err)); expect(err).assertEqual(null); @@ -485,7 +486,7 @@ export default function ActsAppAccountCredential() { } catch(err){ console.debug("====>getCredential ActsAppAccountCredential_1600 err:" + JSON.stringify(err)); - expect(err.code == 12300019).assertEqual(true); + expect(err.code == ERR_JS_CREDENTIAL_NOT_EXIST).assertEqual(true); console.debug("====>delete account ActsAppAccountCredential_1600 start===="); await appAccountManager.removeAccount("account_name_1600"); console.debug("====>ActsAppAccountCredential_1600 end===="); diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/AuthToken.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/AuthToken.test.js index 1d1aff3e9..79ca1a2ec 100644 --- a/account/appaccount/actsaccountoperatetest/src/main/js/test/AuthToken.test.js +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/AuthToken.test.js @@ -25,7 +25,7 @@ const LENGTHLIMIT = 512; const TOKENLENGTHLIMIT = 1024; const AUTHTYPELENGTHLIMIT = 1024; const OWNERLENGTHLIMIT = 1024; - +const ERR_JS_AUTH_TYPE_NOT_FOUND = 12300107; const OWNERSELF = "com.example.actsaccountoperatetest"; export default function ActsAccountAuthToken() { describe('ActsAccountAuthToken', function () { @@ -1335,7 +1335,7 @@ export default function ActsAccountAuthToken() { await appAccountManager.deleteAuthToken("account_promise_repeatDelete",OWNERSELF,"aythType","promise_repeatDelete_token"); }catch(err){ console.debug("====>deleteAuthToken second ActsAccountAuthToken_2200 err:" + JSON.stringify(err)); - expect(err.code == 12400004).assertEqual(true); + expect(err.code == ERR_JS_AUTH_TYPE_NOT_FOUND).assertEqual(true); } try{ console.debug("====>getAuthToken ActsAccountAuthToken_2200 start===="); diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/Authenticator.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/Authenticator.test.js index 6cba69820..9f0ab9010 100644 --- a/account/appaccount/actsaccountoperatetest/src/main/js/test/Authenticator.test.js +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/Authenticator.test.js @@ -33,8 +33,9 @@ export default function ActsAccountAppAccess() { console.info(`sleep #{time} over ...`) }) } - beforeAll(async function (done) { - await featureAbility.startAbility( + beforeAll(async function (done) { + console.debug("====>ActsAccountAuthenticator beforeAll start===="); + await featureAbility.startAbilityForResult( { want: { @@ -47,7 +48,8 @@ export default function ActsAccountAppAccess() { }, }, ) - await sleep(1500) + await sleep(1500); + console.debug("====>ActsAccountAuthenticator beforeAll end===="); done(); }); beforeEach(async (done)=>{ @@ -619,7 +621,9 @@ export default function ActsAccountAppAccess() { expect(data.length).assertEqual(1) } catch(err) { console.debug("====>ActsAccountSelectAccountByOptions_0100 err:" + JSON.stringify(err)); + await appAccountManager.removeAccount(name); expect(err).assertEqual(null) + done(); } try{ await appAccountManager.removeAccount(name) @@ -654,7 +658,9 @@ export default function ActsAccountAppAccess() { expect(data.length).assertEqual(3) } catch(err) { console.debug("====>ActsAccountSelectAccountByOptions_0200 err:" + JSON.stringify(err)); + await appAccountManager.removeAccount(name); expect(err).assertEqual(null) + done(); } try{ await appAccountManager.removeAccount(name) @@ -690,7 +696,9 @@ export default function ActsAccountAppAccess() { expect(data.length).assertEqual(1) } catch(err) { console.debug("====>ActsAccountSelectAccountByOptions_0300 err:" + JSON.stringify(err)); + await appAccountManager.removeAccount(name); expect(err).assertEqual(null) + done(); } try{ await appAccountManager.removeAccount(name) diff --git a/account/appaccount/actsaccountoperatetest/src/main/js/test/CreateAccount.test.js b/account/appaccount/actsaccountoperatetest/src/main/js/test/CreateAccount.test.js index 4a6d48f99..c0ca011f2 100644 --- a/account/appaccount/actsaccountoperatetest/src/main/js/test/CreateAccount.test.js +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/CreateAccount.test.js @@ -19,7 +19,7 @@ const NAMELIMIT = 512; const LENGTHLIMIT = 1024; const ERR_PARAMETER_CHECK_FAILD =401 const ERR_INVALID_PARAMETER = 12300002 -const ERR_ACCOUNT_EXIST = 12300008 +const ERR_ACCOUNT_EXIST = 12300004 const createAccountOptions = {customData:{age:'12'}} //k and v length 1024 ,k and v size 1024 const createAccountOptionsDiff = {customData:{sex:'male'}} export default function ActsAccountCreateAccount() { @@ -521,7 +521,7 @@ export default function ActsAccountCreateAccount() { 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); + expect(err.code).assertEqual(ERR_ACCOUNT_EXIST); appAccountManager.removeAccount("account_name_callback_same", (err)=>{ console.debug("====>delete Account ActsAccountCreateAccount_2300 err:" + JSON.stringify(err)); expect(err).assertEqual(null); @@ -548,7 +548,7 @@ export default function ActsAccountCreateAccount() { } catch(err){ console.debug("====>add account for the second time err:" + JSON.stringify(err)); - expect(err.code).assertEqual(12300008); + expect(err.code).assertEqual(ERR_ACCOUNT_EXIST); appAccountManager.removeAccount("account_name_promise_same"); console.debug("====>ActsAccountCreateAccount_2400 end===="); done(); diff --git a/account/appaccount/actsaccounttest/src/main/config.json b/account/appaccount/actsaccounttest/src/main/config.json index 743798549..b758218b0 100644 --- a/account/appaccount/actsaccounttest/src/main/config.json +++ b/account/appaccount/actsaccounttest/src/main/config.json @@ -17,9 +17,8 @@ "package": "com.example.actsaccounttest", "name": ".MyApplication", "deviceType": [ - "tablet", - "default", - "phone" + "tablet", + "default" ], "distro": { "deliveryWithInstall": true, 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 6e1179359..c5186cf9c 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 @@ -31,15 +31,15 @@ export default { 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'); + console.info('====>ServiceAbility 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'); + console.info('====>ServiceAbility addAccount 03 onStart'); accountMgr.createAccount("wangwu", async (err)=>{ - console.info('====>ServiceAbility lcc enableAppAccess 03 onStart'); + console.info('====>ServiceAbility enableAppAccess 03 onStart'); console.info('====>ServiceAbility setAppAccess actsaccounttest wangwu'); await accountMgr.setAppAccess("wangwu", "com.example.actsaccounttest", true) console.info('====>ServiceAbility setAppAccess actsaccountoperatetest wangwu'); -- GitLab