提交 97c045ba 编写于 作者: 1 15829070344

【OpenHarmony-3.1-Release】【账号】接口属性覆盖

Signed-off-by: N15829070344 <hehaitao5@huawei.com>
上级 d0459cc3
......@@ -23,13 +23,6 @@
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS"
}
],
"reqPermissions": [
{
"name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS",
......
......@@ -84,7 +84,8 @@ describe('AccountTest', function () {
it('account_queryOsAccountDistributedInfo_test002', 0, function () {
const accountAbility = account.getDistributedAccountAbility()
accountAbility.queryOsAccountDistributedInfo(function (data) {
expect(data.name).assertEqual('anonymous')
expect(data.name).assertEqual('anonymous')
expect(data.scalableData).assertEqual(null)
});
})
......
# 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("ActsAccountPressure") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAccountPressure"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1500000",
"package": "com.example.actsaccountpressure",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAccountPressure.hap",
"ActsAccountSceneAppAccess.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsaccountpressure",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsaccountpressure",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS"
},
{
"availableScope": [],
"grantMode": "user_grant",
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason": "ceshi"
},
{
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS",
"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"
]
}
],
"name": "com.example.actsaccountpressure.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* 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');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{title}}
</text>
</div>
/*
* 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 file from '@system.file'
import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: "account pressure test"
},
onInit() {
this.title = "account pressure test";
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
this.timeout = 180000;
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "ActsAccountPressure"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* 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.
*/
require('./Pressure.test.js')
\ No newline at end of file
......@@ -30,25 +30,22 @@ const OWNERSELF = "com.example.actsaccounttest";
describe('ActsAccountOAuthToken', function () {
function sleep(delay) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, delay)
}).then(() => {
console.info(`sleep #{time} over ...`)
})
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
beforeAll(async function (done) {
console.debug("====>beforeAll start====");
await sleep(TIMEOUT);
sleep(TIMEOUT);
console.debug("====>beforeAll end====");
done();
});
beforeEach(async function (done) {
console.debug("====>beforeAll enter====");
await sleep(EACHTIMEOUT);
sleep(EACHTIMEOUT);
done();
});
......@@ -511,14 +508,15 @@ describe('ActsAccountOAuthToken', function () {
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);
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) {
......@@ -2458,12 +2456,14 @@ describe('ActsAccountOAuthToken', function () {
it('ActsAccountOAuthToken_9200', 0, async function (done) {
console.debug("====>ActsAccountOAuthToken_9200 start====");
var appAccountManager = account.createAppAccountManager();
appAccountManager.getAuthenticatorCallback("test_sessionId",(err,databack)=>{
appAccountManager.getAuthenticatorCallback("test_sessionId").then((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(undefined);
done();
});
})
});
it('ActsAccountOAuthToken_9300', 0, async function (done) {
......@@ -2494,6 +2494,25 @@ describe('ActsAccountOAuthToken', function () {
appAccountManager.getAuthenticatorInfo(OWNERSELF,(err,databack)=>{
console.debug("====>ActsAccountOAuthToken_9500 getAuthenticatorInfo err:" + JSON.stringify(err));
expect(err.code!=0).assertEqual(true);
expect(account.ResultCode.SUCCESS).assertEqual(0);
expect(account.ResultCode.ERROR_ACCOUNT_NOT_EXIST).assertEqual(10001);
expect(account.ResultCode.ERROR_APP_ACCOUNT_SERVICE_EXCEPTION).assertEqual(10002);
expect(account.ResultCode.ERROR_INVALID_PASSWORD).assertEqual(10003);
expect(account.ResultCode.ERROR_INVALID_REQUEST).assertEqual(10004);
expect(account.ResultCode.ERROR_INVALID_RESPONSE).assertEqual(10005);
expect(account.ResultCode.ERROR_NETWORK_EXCEPTION).assertEqual(10006);
expect(account.ResultCode.ERROR_OAUTH_AUTHENTICATOR_NOT_EXIST).assertEqual(10007);
expect(account.ResultCode.ERROR_OAUTH_CANCELED).assertEqual(10008);
expect(account.ResultCode.ERROR_OAUTH_LIST_TOO_LARGE).assertEqual(10009);
expect(account.ResultCode.ERROR_OAUTH_SERVICE_BUSY).assertEqual(10010);
expect(account.ResultCode.ERROR_OAUTH_SERVICE_EXCEPTION).assertEqual(10011);
expect(account.ResultCode.ERROR_OAUTH_SESSION_NOT_EXIST).assertEqual(10012);
expect(account.ResultCode.ERROR_OAUTH_TIMEOUT).assertEqual(10013);
expect(account.ResultCode.ERROR_OAUTH_TOKEN_NOT_EXIST).assertEqual(10014);
expect(account.ResultCode.ERROR_OAUTH_TOKEN_TOO_MANY).assertEqual(10015);
expect(account.ResultCode.ERROR_OAUTH_UNSUPPORT_ACTION).assertEqual(10016);
expect(account.ResultCode.ERROR_OAUTH_UNSUPPORT_AUTH_TYPE).assertEqual(10017);
expect(account.ResultCode.ERROR_PERMISSION_DENIED).assertEqual(10018);
done();
});
});
......@@ -2504,6 +2523,17 @@ describe('ActsAccountOAuthToken', function () {
appAccountManager.getAuthenticatorInfo("",(err,databack)=>{
console.debug("====>ActsAccountOAuthToken_9600 getAuthenticatorInfo err:" + JSON.stringify(err));
expect(err.code!=0).assertEqual(true);
expect(account.Constants.ACTION_ADD_ACCOUNT_IMPLICITLY).assertEqual('addAccountImplicitly');
expect(account.Constants.ACTION_AUTHENTICATE).assertEqual('authenticate');
expect(account.Constants.KEY_NAME).assertEqual('name');
expect(account.Constants.KEY_OWNER).assertEqual('owner');
expect(account.Constants.KEY_TOKEN).assertEqual('token');
expect(account.Constants.KEY_ACTION).assertEqual('action');
expect(account.Constants.KEY_AUTH_TYPE).assertEqual('authType');
expect(account.Constants.KEY_SESSION_ID).assertEqual('sessionId');
expect(account.Constants.KEY_CALLER_PID).assertEqual('callerPid');
expect(account.Constants.KEY_CALLER_UID).assertEqual('callerUid');
expect(account.Constants.KEY_CALLER_BUNDLE_NAME).assertEqual('callerBundleName');
done();
});
});
......@@ -2538,9 +2568,7 @@ describe('ActsAccountOAuthToken', function () {
appAccountManager.addAccount("account_setOAuthTokenVisibility_name",(err,)=>{
console.debug("====>ActsAccountOAuthToken_9900 addAccount err:" + JSON.stringify(err));
expect(err.code).assertEqual(0);
appAccountManager.setOAuthTokenVisibility("account_setOAuthTokenVisibility_name","authType","test_BundleName",true,(err)=>{
console.debug("====>ActsAccountOAuthToken_9900 setOAuthTokenVisibility err:" + JSON.stringify(err));
expect(err.code).assertEqual(0);
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);
......@@ -2560,7 +2588,10 @@ describe('ActsAccountOAuthToken', function () {
});
});
});
});
}).catch((err)=>{
expect(err.code).assertEqual(0);
done();
})
});
});
......@@ -3227,13 +3258,14 @@ describe('ActsAccountOAuthToken', function () {
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));
expect(err.code!=0).assertEqual(true);
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);
done();
})
});
it('ActsAccountOAuthToken_12800', 0, async function (done) {
......@@ -3337,6 +3369,8 @@ describe('ActsAccountOAuthToken', function () {
console.debug("====>ActsAccountOAuthToken_13200 getAuthenticatorInfo err:" + JSON.stringify(err));
console.debug("====>ActsAccountOAuthToken_13200 getAuthenticatorInfo dataInfo:" + JSON.stringify(dataInfo));
expect(err.code).assertEqual(0);
expect(isNaN(dataInfo.iconId)).assertFalse();
expect(isNaN(dataInfo.labelId)).assertFalse();
done();
});
});
......@@ -3385,16 +3419,4 @@ describe('ActsAccountOAuthToken', function () {
});
done();
});
it('ActsAccountOAuthToken_28500', 0, async function (done) {
console.debug("====>ActsAccountOAuthToken_28500 start====");
var appAccountManager = account.createAppAccountManager();
var dataInfo = await appAccountManager.getAuthenticatorInfo
("com.example.actsaccountOauthtoken").catch((err)=>{
console.debug("====>ActsAccountOAuthToken_28500 getAuthenticatorInfo err:" + JSON.stringify(err));
expect(err.code).assertEqual(0);
});
console.debug("====>ActsAccountOAuthToken_28500 getAuthenticatorInfo dataInfo:"
+ JSON.stringify(dataInfo));
done();
});
})
\ No newline at end of file
})
......@@ -24,13 +24,6 @@
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS",
......
......@@ -24,13 +24,6 @@
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "user_grant",
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
......
......@@ -24,13 +24,6 @@
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS",
......
......@@ -24,13 +24,6 @@
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS",
......
......@@ -24,18 +24,6 @@
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS"
},
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
}
],
"reqPermissions": [
{
"name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS",
......
......@@ -328,6 +328,11 @@ describe('ActsOsAccountThirdPartyTest_third1', function () {
console.debug("====>create os account OsAccountInfo: " + JSON.stringify(data));
expect(err.code).assertEqual(0);
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);
localId = data.localId;
osAccountManager.getSerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{
console.debug("====>queryOsAccountById err:" + JSON.stringify(err));
......@@ -466,4 +471,30 @@ describe('ActsOsAccountThirdPartyTest_third1', function () {
console.debug("====>ActsOsAccountGetCount_0200 end====");
done();
})
it('ActsOsAccountQueryActivedOsAccountIds_0100', 0, async function (done) {
console.debug("====>ActsOsAccountQueryActivedOsAccountIds_0100 start====");
var osAccountManager = osaccount.getAccountManager();
osAccountManager.queryActivatedOsAccountIds((err,dataArray)=>{
console.info("ActsOsAccountGQueryActicedOsAccountIds_0100 err :" + JSON.stringify(err));
expect(err.code).assertEqual(0)
console.info("ActsOsAccountGQueryActicedOsAccountIds_0100 dataArray" + dataArray.length);
done();
})
})
it('ActsOsAccountQueryActivedOsAccountIds_0200', 0, async function (done) {
console.debug("====>ActsOsAccountQueryActivedOsAccountIds_0200 start====");
var osAccountManager = osaccount.getAccountManager();
osAccountManager.queryActivatedOsAccountIds().catch((err)=>{
console.info("====>ActsOsAccountQueryActivedOsAccountIds_0200 err " + JSON.stringify(err));
expect(err.code).assertEqual(0)
done();
}).then((data)=>{
console.debug("====>ActsOsAccountQueryActivedOsAccountIds_0200 data" + JSON.stringify(data))
done();
});
})
})
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册