diff --git a/account/appaccount/actsaccounttest/src/main/js/test/AppAccess.test.js b/account/appaccount/actsaccounttest/src/main/js/test/AppAccess.test.js old mode 100755 new mode 100644 index ecf3d1530e7f5e44244d6ecf973503e8e0a25144..55a5347a3492d471c031b64b34b96db4c9595386 --- a/account/appaccount/actsaccounttest/src/main/js/test/AppAccess.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/AppAccess.test.js @@ -204,6 +204,7 @@ export default function ActsAccountAppAccess() { console.debug("====>enableAppAccess 0700 err:" + JSON.stringify(err)); expect(err).assertEqual(null); appAccountManager.disableAppAccess("AppAccess_callback_account", enableBundle, (err)=>{ + console.debug("====>disableAppAccess 0700 err:" + JSON.stringify(err)); expect(err).assertEqual(null) appAccountManager.deleteAccount("AppAccess_callback_account", (err)=>{ console.debug("====>delete Account ActsAccountAppAccess_0700 err:" + JSON.stringify(err)); 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 d2cce008fb80567db2a704ca0fc9c59c81ac050a..6de90a72c8e9be2d23aadccb2a3d9526f9b85faf 100644 --- a/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js @@ -376,7 +376,7 @@ export default function ActsAccountAppAccess() { appAccountManager.getAccountCredential(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)); //expect undefined assertEqual true + console.debug("====>ActsAccountDeleteAccountCredential_0200 data:" + JSON.stringify(data)); try{ appAccountManager.deleteAccount(name) console.debug('====>ActsAccountDeleteAccountCredential_0200 deleteAccount_success') 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 5475e3c244783f7f3a7d8de311d6a97d0800ab28..bde7732bc85db1ac66bfed5e65cdc67eb7311dd4 100644 --- a/account/appaccount/actsaccounttest/src/main/js/test/OAuthToken.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/OAuthToken.test.js @@ -503,37 +503,37 @@ export default function ActsAccountOAuthToken() { - it('ActsAccountOAuthToken_8100', 0, async function (done) { - var limitName = ''; - for(var i = 0;i < LENGTHLIMIT + 1; i++){ - limitName += 'c'; - } - console.debug("====>ActsAccountOAuthToken_8100 start===="); - var appAccountManager = account.createAppAccountManager(); - console.debug("====>ActsAccountOAuthToken_8100 getAllOAuthTokens start===="); - appAccountManager.getAllOAuthTokens(limitName, OWNERSELF,(err,ArrayData)=>{ - console.debug("====>ActsAccountOAuthToken_8100 getAllOAuthTokens err:" + JSON.stringify(err)); - console.debug("====>ActsAccountOAuthToken_8100 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); - expect(err.code!=0).assertEqual(true); - expect(ArrayData).assertEqual(null); - console.debug("====>ActsAccountOAuthToken_8100 ===="); - done(); - }); - }); - - it('ActsAccountOAuthToken_8200', 0, async function (done) { - console.debug("====>ActsAccountOAuthToken_8200 start===="); - var appAccountManager = account.createAppAccountManager(); - console.debug("====>ActsAccountOAuthToken_8200 getAllOAuthTokens start===="); - appAccountManager.getAllOAuthTokens("", OWNERSELF,(err,ArrayData)=>{ - console.debug("====>ActsAccountOAuthToken_8200 getAllOAuthTokens err:" + JSON.stringify(err)); - console.debug("====>ActsAccountOAuthToken_8200 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); - expect(err.code!=0).assertEqual(true); - expect(ArrayData).assertEqual(null); - console.debug("====>ActsAccountOAuthToken_8200 ===="); - done(); - }); + it('ActsAccountOAuthToken_8100', 0, async function (done) { + var limitName = ''; + for(var i = 0;i < LENGTHLIMIT + 1; i++){ + limitName += 'c'; + } + console.debug("====>ActsAccountOAuthToken_8100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountOAuthToken_8100 getAllOAuthTokens start===="); + appAccountManager.getAllOAuthTokens(limitName, OWNERSELF).then((ArrayData)=>{ + console.debug("====>ActsAccountOAuthToken_8100 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(ArrayData.length).assertEqual(0); + console.debug("====>ActsAccountOAuthToken_8100 ===="); + done(); + }).catch((err)=>{ + expect(err.code!=0).assertEqual(true); + done(); + }) + }); + + it('ActsAccountOAuthToken_8200', 0, async function (done) { + console.debug("====>ActsAccountOAuthToken_8200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>ActsAccountOAuthToken_8200 getAllOAuthTokens start===="); + appAccountManager.getAllOAuthTokens("", OWNERSELF,(err,ArrayData)=>{ + console.debug("====>ActsAccountOAuthToken_8200 getAllOAuthTokens err:" + JSON.stringify(err)); + console.debug("====>ActsAccountOAuthToken_8200 getAllOAuthTokens ArrayData:" + JSON.stringify(ArrayData)); + expect(err.code!=0).assertEqual(true); + console.debug("====>ActsAccountOAuthToken_8200 ===="); + done(); }); + }); it('ActsAccountOAuthToken_8300', 0, async function (done) { console.debug("====>ActsAccountOAuthToken_8300 start===="); @@ -1053,13 +1053,13 @@ export default function ActsAccountOAuthToken() { await appAccountManager.setOAuthToken("account_promise_setDeleteGet","new_authType","promise_setDeleteGet_token"); console.debug("====>getOAuthToken ActsAccountOAuthToken_1200 start===="); - var data1_beforeDel = await appAccountManager.getOAuthToken("account_promise_setDeleteGet",OWNERSELF,"old_authType"); - console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1200 data1_beforeDel:" + data1_beforeDel); + var data1BeforeDel = await appAccountManager.getOAuthToken("account_promise_setDeleteGet",OWNERSELF,"old_authType"); + console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1200 data1BeforeDel:" + data1BeforeDel); expect(data1_beforeDel).assertEqual("promise_setDeleteGet_token"); console.debug("====>getOAuthToken ActsAccountOAuthToken_1200 start===="); - var data2_beforeDel = await appAccountManager.getOAuthToken("account_promise_setDeleteGet",OWNERSELF,"new_authType"); - console.debug("====>getOAuthToken getNew ActsAccountOAuthToken_1200 data2_beforeDel:" + data2_beforeDel); - expect(data2_beforeDel).assertEqual("promise_setDeleteGet_token"); + var data2BeforeDel = await appAccountManager.getOAuthToken("account_promise_setDeleteGet",OWNERSELF,"new_authType"); + console.debug("====>getOAuthToken getNew ActsAccountOAuthToken_1200 data2BeforeDel:" + data2BeforeDel); + expect(data2beforeDel).assertEqual("promise_setDeleteGet_token"); console.debug("====>deleteOAuthToken deleteOld ActsAccountOAuthToken_1200 start===="); try{ @@ -1072,8 +1072,8 @@ export default function ActsAccountOAuthToken() { console.debug("====>getOAuthToken ActsAccountOAuthToken_1200 start===="); try{ - var data1_AfterDel = await appAccountManager.getOAuthToken("account_promise_setDeleteGet",OWNERSELF,"old_authType",); - console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1200 data1_AfterDel:" + data1_AfterDel); + var data1AfterDel = await appAccountManager.getOAuthToken("account_promise_setDeleteGet",OWNERSELF,"old_authType",); + console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1200 data1_AfterDel:" + data1AfterDel); expect().assertFail(); } catch(err){ @@ -1083,8 +1083,8 @@ export default function ActsAccountOAuthToken() { console.debug("====>getOAuthToken ActsAccountOAuthToken_1200 start===="); try{ var data2_AfterDel = await appAccountManager.getOAuthToken("account_promise_setDeleteGet",OWNERSELF,"new_authType",); - console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1200 data2_AfterDel:" + data2_AfterDel); - expect(data2_AfterDel).assertEqual("promise_setDeleteGet_token"); + console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1200 data2_AfterDel:" + data2AfterDel); + expect(data2AfterDel).assertEqual("promise_setDeleteGet_token"); } catch(err){ console.debug("====>getOAuthToken getNew ActsAccountOAuthToken_1200 err:" + JSON.stringify(err)); @@ -1101,8 +1101,8 @@ export default function ActsAccountOAuthToken() { console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1200 start===="); try{ - var data1_AgainDel = await appAccountManager.getOAuthToken("account_promise_setDeleteGet",OWNERSELF,"old_authType",); - console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1200 data1_AgainDel:" + data1_AgainDel); + var data1AgainDel = await appAccountManager.getOAuthToken("account_promise_setDeleteGet",OWNERSELF,"old_authType",); + console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1200 data1_AgainDel:" + data1AgainDel); expect().assertFail(); } catch(err){ @@ -1111,8 +1111,8 @@ export default function ActsAccountOAuthToken() { } console.debug("====>getOAuthToken getNew ActsAccountOAuthToken_1200 start===="); try{ - var data2_AgainDel = await appAccountManager.getOAuthToken("account_promise_setDeleteGet",OWNERSELF,"new_authType",); - console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1200 data2_AgainDel:" + data2_AgainDel); + var data2AgainDel = await appAccountManager.getOAuthToken("account_promise_setDeleteGet",OWNERSELF,"new_authType",); + console.debug("====>getOAuthToken getOld ActsAccountOAuthToken_1200 data2_AgainDel:" + data2AgainDel); expect().assertFail(); } catch(err){ @@ -2457,13 +2457,16 @@ export default function ActsAccountOAuthToken() { it('ActsAccountOAuthToken_9200', 0, async function (done) { console.debug("====>ActsAccountOAuthToken_9200 start===="); - var appAccountManager = account.createAppAccountManager(); - appAccountManager.getAuthenticatorCallback("test_sessionId",(err,databack)=>{ + var appAccountManager = account.createAppAccountManager(); + appAccountManager.getAuthenticatorCallback("test_sessionId").then((databack)=>{ + console.debug("====>ActsAccountOAuthToken_9200 getAuthenticatorCallback data:" + JSON.stringify(databack)) + expect(databack).assertEqual(undefined); + done(); + }).catch((err)=>{ console.debug("====>ActsAccountOAuthToken_9200 getAuthenticatorCallback err:" + JSON.stringify(err)); expect(err.code!=0).assertEqual(true); - expect(databack).assertEqual(null); done(); - }); + }) }); it('ActsAccountOAuthToken_9300', 0, async function (done) { @@ -2564,33 +2567,33 @@ export default function ActsAccountOAuthToken() { it('ActsAccountOAuthToken_9900', 0, async function (done) { console.debug("====>ActsAccountOAuthToken_9900 start===="); - var appAccountManager = account.createAppAccountManager(); - appAccountManager.addAccount("account_setOAuthTokenVisibility_name",(err,)=>{ + var appAccountManager = account.createAppAccountManager(); + appAccountManager.addAccount("account_setOAuthTokenVisibility_name",(err,)=>{ console.debug("====>ActsAccountOAuthToken_9900 addAccount err:" + JSON.stringify(err)); - expect(err).assertEqual(null); - appAccountManager.setOAuthTokenVisibility("account_setOAuthTokenVisibility_name","authType","test_BundleName",true,(err)=>{ - console.debug("====>ActsAccountOAuthToken_9900 setOAuthTokenVisibility err:" + JSON.stringify(err)); - expect(err).assertEqual(null); + expect(err).assertEqual(null); + appAccountManager.setOAuthTokenVisibility("account_setOAuthTokenVisibility_name","authType","test_BundleName",true).then(()=>{ appAccountManager.getOAuthToken("account_setOAuthTokenVisibility_name",OWNERSELF,"authType",(err,data)=>{ console.debug("====>ActsAccountOAuthToken_9900 getOAuthToken err:" + JSON.stringify(err)); console.debug("====>ActsAccountOAuthToken_9900 getOAuthToken data:" + data); - expect(err.code!=0).assertEqual(true); - expect(data).assertEqual(null); + expect(err.code!=0).assertEqual(true); appAccountManager.getOAuthList("account_setOAuthTokenVisibility_name","authType",(err,dataArray)=>{ console.debug("====>ActsAccountOAuthToken_9900 getOAuthList err:" + JSON.stringify(err)); - expect(err).assertEqual(null); + expect(err).assertEqual(null); console.debug("====>ActsAccountOAuthToken_9900 getOAuthList dataArray:" + JSON.stringify(dataArray)); expect(dataArray.length).assertEqual(1); - expect(dataArray[0]).assertEqual("test_BundleName"); - appAccountManager.deleteAccount("account_setOAuthTokenVisibility_name",(err)=>{ + expect(dataArray[0]).assertEqual("test_BundleName"); + appAccountManager.deleteAccount("account_setOAuthTokenVisibility_name",(err)=>{ console.debug("====>ActsAccountOAuthToken_9900 deleteAccount err:" + JSON.stringify(err)); - expect(err).assertEqual(null); + expect(err).assertEqual(null); console.debug("====>ActsAccountOAuthToken_9900 end===="); done(); }); }); }); - }); + }).catch((err)=>{ + expect(err).assertEqual(null); + done(); + }) }); }); @@ -3257,13 +3260,14 @@ export default function ActsAccountOAuthToken() { it('ActsAccountOAuthToken_12700', 0, async function (done) { console.debug("====>ActsAccountOAuthToken_12700 start===="); var appAccountManager = account.createAppAccountManager(); - appAccountManager.getOAuthList("","authType",(err,dataArray)=>{ - console.debug("====>ActsAccountOAuthToken_12700 getOAuthList err:" + JSON.stringify(err)); - console.debug("====>ActsAccountOAuthToken_12700 getOAuthList dataArray:" + JSON.stringify(dataArray)); + appAccountManager.getOAuthList("","authType").then((dataArray)=>{ + console.debug("====>ActsAccountOAuthToken_12700 getOAuthList dataArray:" + JSON.stringify(dataArray)); + expect(dataArray.length).assertEqual(0); + done(); + }).catch((err)=>{ expect(err.code!=0).assertEqual(true); - expect(dataArray).assertEqual(null); done(); - }); + }) }); it('ActsAccountOAuthToken_12800', 0, async function (done) { diff --git a/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js b/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js old mode 100755 new mode 100644 index d9f63fb7cd9a2149ad6cd1fce288503f5417e67b..971f5a097b5534c9c96c72813c5a72c8c69d7137 --- a/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js @@ -326,7 +326,7 @@ export default function ActsAccountChangeOnOff() { await appAccountManager.enableAppAccess("onoff_delete", "com.example.actsaccountsceneonoff"); function unSubscriberCallback(err){ console.debug("====>unsubscribe 0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); + expect(err).assertEqual(null); done(); } function subscriberCallback(err, data){ diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/Common/utils.js b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/Common/utils.js index 6766a02b8391d8d3ce5b58f0c0f346fea8fcc73a..92f80e40eb35ccb3cec2e0e05042ece5451d3df5 100644 --- a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/Common/utils.js +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/Common/utils.js @@ -1,3 +1,18 @@ +/* + * 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_appAccount from '@ohos.account.appAccount'; import rpc from '@ohos.rpc'; diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/app.js b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/app.js index b1165a8da16707c5f2d32f1c82f1611f42bc5d83..ea320e50e5439a97c27fc72c209b838e9e87ae91 100644 --- a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/app.js +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/app.js @@ -1,3 +1,17 @@ +/* + * 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("Application onCreate"); 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 db31ed160be748315a0cc2730a9771207d132713..dfb69f41b7cacdad4716664c5796c47096b6d287 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 @@ -1,3 +1,18 @@ +/* + * 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 { data: { title: "Hello World" 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 f87f2dc07e2ec53171710f5721be6c9a820067c8..2f531f3bbc0c731c45f8fcc156f89dcb1c1e2060 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 @@ -1,3 +1,17 @@ +/* + * 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_appAccount from '@ohos.account.appAccount'; import {MyAuthenticator} from '../Common/utils'