From ede4c825283eebf30e4601a44e271609ada11442 Mon Sep 17 00:00:00 2001 From: 15829070344 Date: Tue, 18 Oct 2022 14:59:52 +0800 Subject: [PATCH] =?UTF-8?q?fixed=207e29ccc=20from=20https://gitee.com/murp?= =?UTF-8?q?hy1984/acts/pulls/5948=20=E3=80=90=E8=B4=A6=E5=8F=B7=E3=80=91os?= =?UTF-8?q?Account=E4=B8=89=E6=96=B9=E6=8E=A5=E5=8F=A3=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E5=BD=92=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 15829070344 --- .../src/main/js/test/OsAccountGet.test.js | 32 +++++++++++++------ .../src/main/js/test/OsAccountIs.test.js | 10 +++--- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js index dd89d0c57..23ba58d28 100644 --- a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js +++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js @@ -16,10 +16,20 @@ import osaccount from '@ohos.account.osAccount' import bundle from '@ohos.bundle' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -const ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR = 4653057; export default function ActsOsAccountThirdPartyTest_third_2() { describe('ActsOsAccountThirdPartyTest_third_2', function () { - + afterEach(async function (done) { + console.debug("====>afterEach start===="); + var osAccountManager = osaccount.getAccountManager(); + var accounts = await osAccountManager.queryAllCreatedOsAccounts() + for (i=0;i{ console.debug("====>get localId err: " + JSON.stringify(err)); console.debug("====>localId obtained by uid:" + localId); - expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR); + expect(err.code !=0 ).assertEqual(true); expect(localId).assertEqual(null); console.debug("====>ActsOsAccountGetIdFormUid_0300 end===="); done(); @@ -100,7 +110,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { await osAccountManager.getOsAccountLocalIdFromUid(incorrectUid); }catch(err){ console.debug("====>get localId by uid err:" +JSON.stringify(err)); - expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR); + expect(err.code !=0 ).assertEqual(true); console.debug("====>ActsOsAccountGetIdFormUid_0400 end===="); done(); } @@ -119,7 +129,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { osAccountManager.getOsAccountLocalIdFromUid(incorrectUid, (err, localId)=>{ console.debug("====>get localId err: " + JSON.stringify(err)); console.debug("====>localId obtained by uid:" + localId); - expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR); + expect(err.code !=0 ).assertEqual(true); expect(localId).assertEqual(null); console.debug("====>ActsOsAccountGetIdFormUid_0500 end===="); done(); @@ -140,7 +150,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { await osAccountManager.getOsAccountLocalIdFromUid(incorrectUid); }catch(err){ console.debug("====>get localId by uid err:" +JSON.stringify(err)); - expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR); + expect(err.code !=0 ).assertEqual(true); console.debug("====>ActsOsAccountGetIdFormUid_0600 end===="); done(); } @@ -387,7 +397,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { var osAccountManager = osaccount.getAccountManager(); console.debug("====>get AccountManager finish===="); var localId; - var OsAccountInfo = await osAccountManager.createOsAccount("accountIdSerialB", osaccount.OsAccountType.Guest); + 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; @@ -505,7 +515,8 @@ export default function ActsOsAccountThirdPartyTest_third_2() { osAccountManager.queryActivatedOsAccountIds((err,dataArray)=>{ console.info("====>ActsOsAccountGQueryActicedOsAccountIds_0100 err :" + JSON.stringify(err)); expect(err).assertEqual(null) - console.info("====>ActsOsAccountGQueryActicedOsAccountIds_0100 dataArray" + dataArray.length); + console.info("====>ActsOsAccountGQueryActicedOsAccountIds_0100 dataArray:" + dataArray); + expect(dataArray.length).assertEqual(1) done(); }) }) @@ -518,8 +529,9 @@ export default function ActsOsAccountThirdPartyTest_third_2() { it('ActsOsAccountQueryActivedOsAccountIds_0200', 0, async function (done) { console.debug("====>ActsOsAccountQueryActivedOsAccountIds_0200 start===="); var osAccountManager = osaccount.getAccountManager(); - osAccountManager.queryActivatedOsAccountIds().then((data)=>{ - console.debug("====>ActsOsAccountQueryActivedOsAccountIds_0200 data" + JSON.stringify(data)) + osAccountManager.queryActivatedOsAccountIds().then((dataArray)=>{ + console.debug("====>ActsOsAccountQueryActivedOsAccountIds_0200 data" + JSON.stringify(dataArray)) + expect(dataArray.length).assertEqual(1) done(); }).catch((err)=>{ console.info("====>ActsOsAccountQueryActivedOsAccountIds_0200 err " + JSON.stringify(err)); diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js index b4966c76e..969c36f94 100755 --- a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js +++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js @@ -17,8 +17,6 @@ import distributedAccount from '@ohos.account.distributedAccount' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' const TIMEOUT = 1000; -const ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR = 4587542; -const ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR = 4587545; export default function ActsOsAccountThirdPartyTest_third_1() { describe('ActsOsAccountThirdPartyTest_third_1', function () { @@ -132,7 +130,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { var nonExistLocalId = 1000; AccountManager.isOsAccountActived(nonExistLocalId, (err)=>{ console.debug("====>isOsAccountActived err:" + JSON.stringify(err)); - expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR); + expect(err.code !=0 ).assertEqual(true); console.debug("====>ActsOsAccountIsActived_0300 end"); done(); }) @@ -153,7 +151,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { } catch(err){ console.debug("====>isOsAccountActived err:" + JSON.stringify(err)); - expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR); + expect(err.code !=0 ).assertEqual(true); console.debug("====>ActsOsAccountIsActived_0400 end"); done(); } @@ -439,7 +437,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { var osAccountLocalId = 1000; AccountManager.isOsAccountVerified(osAccountLocalId, (err)=>{ console.debug("====>isOsAccountVerified err:" + JSON.stringify(err)); - expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR); + expect(err.code !=0 ).assertEqual(true); console.debug("====>ActsOsAccountIsVerified_0900 end===="); done(); }) @@ -460,7 +458,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { } catch(err){ console.debug("====>isOsAccountVerified err:" + JSON.stringify(err)); - expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR); + expect(err.code !=0 ).assertEqual(true); console.debug("====>ActsOsAccountIsVerified_1000 end===="); done(); } -- GitLab