From 39c6c879355d2751e14cea9c0f65f6752e618a2c Mon Sep 17 00:00:00 2001 From: zhaimengchao Date: Wed, 5 Jul 2023 18:53:55 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90Account=E3=80=91=E3=80=90Master?= =?UTF-8?q?=E3=80=91ExtensionAbility=20API=20Attribute=20verification=20&?= =?UTF-8?q?=20testcases=20adaptation=20and=20modification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhaimengchao --- .../src/main/js/test/AuthToken.test.js | 13 ++++++ .../src/main/js/test/OAuthToken.test.js | 13 ++++++ .../ets/test/actsAALoginPluginTest.test.ets | 42 ++++++++++++++++--- 3 files changed, 62 insertions(+), 6 deletions(-) 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 2387afcb4..d92f23391 100644 --- a/account/appaccount/actsaccountoperatetest/src/main/js/test/AuthToken.test.js +++ b/account/appaccount/actsaccountoperatetest/src/main/js/test/AuthToken.test.js @@ -3331,6 +3331,19 @@ export default function ActsAccountAuthToken() { done(); }); }); + + it('ActsAccountOAuthToken_13201', 0, async function (done) { + console.debug("====>ActsAccountOAuthToken_13201 start===="); + var appAccountManager = account.createAppAccountManager(); + await appAccountManager.queryAuthenticatorInfo("com.example.actsaccountOauthtoken").then((dataInfo) =>{ + console.debug("====>ActsAccountOAuthToken_13201 queryAuthenticatorInfo dataInfo:" + JSON.stringify(dataInfo)); + expect(isNaN(dataInfo.iconId)).assertFalse(); + expect(isNaN(dataInfo.labelId)).assertFalse(); + done(); + }).catch((err) => { + console.debug("====>ActsAccountOAuthToken_13201 queryAuthenticatorInfo err:" + JSON.stringify(err)); + }); + }); it('ActsAccountAuthToken_13300', 0, async function (done) { console.debug("====>ActsAccountAuthToken_13300 start===="); 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 c4b24715b..e994af82e 100644 --- a/account/appaccount/actsaccounttest/src/main/js/test/OAuthToken.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/OAuthToken.test.js @@ -3367,6 +3367,19 @@ export default function ActsAccountOAuthToken() { done(); }); }); + + it('ActsAccountOAuthToken_13201', 0, async function (done) { + console.debug("====>ActsAccountOAuthToken_13201 start===="); + var appAccountManager = account.createAppAccountManager(); + await appAccountManager.getAuthenticatorInfo("com.example.actsaccountOauthtoken").then((dataInfo) =>{ + console.debug("====>ActsAccountOAuthToken_13201 getAuthenticatorInfo dataInfo:" + JSON.stringify(dataInfo)); + expect(isNaN(dataInfo.iconId)).assertFalse(); + expect(isNaN(dataInfo.labelId)).assertFalse(); + done(); + }).catch((err) => { + console.debug("====>ActsAccountOAuthToken_13201 getAuthenticatorInfo err:" + JSON.stringify(err)); + }); + }); it('ActsAccountOAuthToken_13300', 0, async function (done) { console.debug("====>ActsAccountOAuthToken_13300 start===="); diff --git a/account/appaccount/actsappaccountplugintest/entry/src/main/ets/test/actsAALoginPluginTest.test.ets b/account/appaccount/actsappaccountplugintest/entry/src/main/ets/test/actsAALoginPluginTest.test.ets index 5dbe9c91e..3c7054e7b 100644 --- a/account/appaccount/actsappaccountplugintest/entry/src/main/ets/test/actsAALoginPluginTest.test.ets +++ b/account/appaccount/actsappaccountplugintest/entry/src/main/ets/test/actsAALoginPluginTest.test.ets @@ -272,7 +272,7 @@ export default function ActsAALoginPlugin() { let scheduler = new appAccount.AccountCapabilityScheduler(); scheduler.executeRequest(request, async (err, data) => { console.debug("====>SUB_ACCOUNT_APPACCOUNT_ExecuteRequest_1700 err: " + JSON.stringify(err)); - expect(err).assertEqual(12300002); + expect(err.code).assertEqual(12300002); console.debug("====>SUB_ACCOUNT_APPACCOUNT_ExecuteRequest_1700 end===="); await sleep(200) done(); @@ -303,7 +303,7 @@ export default function ActsAALoginPlugin() { done(); }).catch(async (err) => { console.debug("====>SUB_ACCOUNT_APPACCOUNT_ExecuteRequest_1800 err: " + JSON.stringify(err)); - expect(err).assertEqual(12300002); + expect(err.code).assertEqual(12300002); console.debug("====>SUB_ACCOUNT_APPACCOUNT_ExecuteRequest_1800 end===="); await sleep(200) done(); @@ -331,7 +331,7 @@ export default function ActsAALoginPlugin() { let scheduler = new appAccount.AccountCapabilityScheduler(); scheduler.executeRequest(request, async (err, data) => { console.debug("====>SUB_ACCOUNT_APPACCOUNT_ExecuteRequest_1900 err: " + JSON.stringify(err)); - expect(err).assertEqual(12300002); + expect(err.code).assertEqual(12300002); console.debug("====>SUB_ACCOUNT_APPACCOUNT_ExecuteRequest_1900 end===="); await sleep(200) done(); @@ -362,7 +362,7 @@ export default function ActsAALoginPlugin() { done(); }).catch(async (err) => { console.debug("====>SUB_ACCOUNT_APPACCOUNT_ExecuteRequest_2000 err: " + JSON.stringify(err)); - expect(err).assertEqual(12300002); + expect(err.code).assertEqual(12300002); console.debug("====>SUB_ACCOUNT_APPACCOUNT_ExecuteRequest_2000 end===="); await sleep(200) done(); @@ -388,7 +388,7 @@ export default function ActsAALoginPlugin() { let scheduler = new appAccount.AccountCapabilityScheduler(); scheduler.executeRequest(request, async (err, data) => { console.debug("====>SUB_ACCOUNT_APPACCOUNT_ExecuteRequest_2100 err: " + JSON.stringify(err)); - expect(err).assertEqual(12300002); + expect(err.code).assertEqual(12300002); console.debug("====>SUB_ACCOUNT_APPACCOUNT_ExecuteRequest_2100 end===="); await sleep(200) done(); @@ -419,7 +419,7 @@ export default function ActsAALoginPlugin() { done(); }).catch(async (err) => { console.debug("====>SUB_ACCOUNT_APPACCOUNT_ExecuteRequest_2200 err: " + JSON.stringify(err)); - expect(err).assertEqual(12300002); + expect(err.code).assertEqual(12300002); console.debug("====>SUB_ACCOUNT_APPACCOUNT_ExecuteRequest_2200 end===="); await sleep(200) done(); @@ -431,6 +431,36 @@ export default function ActsAALoginPlugin() { done() } }) + + /* + * @tc.number : SUB_ACCOUNT_APPACCOUNT_EXTENSION_ABILITY_0100 + * @tc.name : ExtensionAbility Attribute verification test_0100 + * @tc.desc : capabilityType & request + */ + it('SUB_ACCOUNT_APPACCOUNT_EXTENSION_ABILITY_0100', 0, async function (done) { + console.debug("====>SUB_ACCOUNT_APPACCOUNT_EXTENSION_ABILITY_0100 start===="); + try { + let capabilityType = appAccount.AccountCapabilityType.AUTHORIZATION + let testProvider = new appAccount.AccountCapabilityProvider(capabilityType) + let request = new TestAuthRequest(testProvider) + let testResponse = new appAccount.AccountCapabilityResponse(request) + let result_1 = (testProvider instanceof appAccount.AccountCapabilityProvider) + let result_2 = (testResponse instanceof appAccount.AccountCapabilityResponse) + console.debug("====>SUB_ACCOUNT_APPACCOUNT_EXTENSION_ABILITY_0100 testProvider result: " + JSON.stringify(result_1)); + console.debug("====>SUB_ACCOUNT_APPACCOUNT_EXTENSION_ABILITY_0100 testResponse result: " + JSON.stringify(result_2)); + expect(result_1).assertTrue() + expect(result_2).assertTrue() + console.debug("====>SUB_ACCOUNT_APPACCOUNT_EXTENSION_ABILITY_0100 end===="); + await sleep(200) + done(); + } catch (err) { + console.debug("====>SUB_ACCOUNT_APPACCOUNT_EXTENSION_ABILITY_0100 exception: " + JSON.stringify(err)); + console.debug("====>SUB_ACCOUNT_APPACCOUNT_EXTENSION_ABILITY_0100 err===="); + expect().assertFail(); + await sleep(200) + done() + } + }); /* * @tc.number : SUB_ACCOUNT_APPACCOUNT_Enum_AccountCapabilityType_0100 -- GitLab