未验证 提交 46bb5b4b 编写于 作者: O openharmony_ci 提交者: Gitee

!5102 【账号】XTS冻结适配,NoPermission_0700/0800

Merge pull request !5102 from 何海涛/0823_Unavailable
......@@ -198,7 +198,8 @@ export default function ActsAccountNoPermission() {
expect(err).assertEqual(null);
appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
console.debug("====>getAllAccounts 0700 err:" + JSON.stringify(err));
expect(err.code).assertEqual(account.ResultCode.ERROR_PERMISSION_DENIED);
expect(err).assertEqual(null);
expect(data.length>0).assertEqual(true);
appAccountManager.deleteAccount("getAll_callback_nopermission", (err)=>{
console.debug("====>delete account 0700 err:" + JSON.stringify(err));
expect(err).assertEqual(null);
......
......@@ -30,7 +30,11 @@ export default function ActsAccountChangeOnOff() {
console.info(`sleep #{time} over ...`)
})
}
beforeAll(async function (done) {
beforeAll(async function (done) {
done();
});
async function testInit(){
console.debug("====>startAbility start====");
await featureAbility.startAbility(
{
......@@ -46,8 +50,7 @@ export default function ActsAccountChangeOnOff() {
},
);
await sleep(TIMEOUT);
done();
});
}
/*
* @tc.number : ActsAccountChangeOnOff_0100
......@@ -56,6 +59,7 @@ export default function ActsAccountChangeOnOff() {
* the additional information
*/
it('ActsAccountChangeOnOff_0100', 0, async function (done) {
testInit();
console.debug("====>ActsAccountChangeOnOff_0100 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -124,6 +128,7 @@ export default function ActsAccountChangeOnOff() {
* the associatal data
*/
it('ActsAccountChangeOnOff_0200', 0, async function (done) {
testInit();
console.debug("====>ActsAccountChangeOnOff_0200 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -187,6 +192,7 @@ export default function ActsAccountChangeOnOff() {
* the credential
*/
it('ActsAccountChangeOnOff_0300', 0, async function (done) {
testInit();
console.debug("====>ActsAccountChangeOnOff_0300 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -250,6 +256,7 @@ export default function ActsAccountChangeOnOff() {
* authorized account
*/
it('ActsAccountChangeOnOff_0400', 0, async function (done) {
testInit();
console.debug("====>ActsAccountChangeOnOff_0400 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -317,6 +324,7 @@ export default function ActsAccountChangeOnOff() {
* the only authorized account
*/
it('ActsAccountChangeOnOff_0500', 0, async function (done) {
testInit();
console.debug("====>ActsAccountChangeOnOff_0500 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -325,7 +333,7 @@ export default function ActsAccountChangeOnOff() {
console.debug("====>enableAppAccess ActsAccountChangeOnOff_0500 start");
await appAccountManager.enableAppAccess("onoff_delete", "com.example.actsaccountsceneonoff");
function unSubscriberCallback(err){
console.debug("====>unsubscribe 0500 err:" + JSON.stringify(err));
console.debug("====>unsubscribe 0500 err:" + JSON.stringify(err));
}
function subscriberCallback(err, data){
console.debug("====>subscriberCallback 0500 data:" + JSON.stringify(data));
......@@ -375,6 +383,7 @@ export default function ActsAccountChangeOnOff() {
* authorized account
*/
it('ActsAccountChangeOnOff_0600', 0, async function (done) {
testInit();
console.debug("====>ActsAccountChangeOnOff_0600 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -446,6 +455,7 @@ export default function ActsAccountChangeOnOff() {
* the only authorized account
*/
it('ActsAccountChangeOnOff_0700', 0, async function (done) {
testInit();
console.debug("====>ActsAccountChangeOnOff_0700 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......
......@@ -459,6 +459,8 @@ export default function ActsGetAllAccounts() {
var nonexistentBundle = "com.example.actsgetallaccountsnonexistent";
try{
var data = await appAccountManager.getAllAccounts(nonexistentBundle);
expect().assertFail();
done();
}
catch(err){
console.debug("====>getAllAccounts 1400 err:" + JSON.stringify(err));
......
......@@ -14,6 +14,7 @@
*/
import account from '@ohos.account.appAccount'
import commonevent from '@ohos.commonEvent'
import featureAbility from '@ohos.ability.featureAbility'
const ACCOUNT_TEST_ONOFF_EXTRA = 1
const ACCOUNT_TEST_ONOFF_ASSOCIATEDDATA = 2
......@@ -46,6 +47,7 @@ export default {
appAccountManager.off('change', function (){
console.debug("====>scene off finish====");
});
featureAbility.terminateSelf()
}
// Subscribe to the callback of account information changes, verify the received account information, and send
......@@ -247,7 +249,7 @@ export default {
default:
console.debug("====>receive event enter default====");
break;
}
}
}
var subscriber
commonevent.createSubscriber(commonEventSubscribeInfo).then(function (data){
......
......@@ -13,6 +13,7 @@
* limitations under the License.
*/
import account from '@ohos.account.appAccount'
import featureAbility from '@ohos.ability.featureAbility'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
......@@ -33,6 +34,7 @@ export default {
console.debug("====>add account scene err:" + JSON.stringify(err));
appAccountManager.enableAppAccess("account_name_scene_single", enableBundle, (err)=>{
console.debug("====>enableAppAccess scene err:" + JSON.stringify(err));
featureAbility.terminateSelf()
});
});
},
......
......@@ -235,7 +235,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() {
var osAccountManager = osaccount.getAccountManager();
var testLocalId = await osAccountManager.getOsAccountLocalIdFromProcess();
console.debug("====>get AccountManager finish====");
osAccountManager.getSerialNumberByOsAccountLocalId(100, (err, serialNumber)=>{
osAccountManager.getSerialNumberByOsAccountLocalId(testLocalId, (err, serialNumber)=>{
console.debug("====>ger serialNumber err:" + JSON.stringify(err));
console.debug("====>get serialNumber:" + serialNumber + " by localId: 100" );
expect(err).assertEqual(null);
......@@ -349,6 +349,12 @@ export default function ActsOsAccountThirdPartyTest_third_2() {
expect(data.isVerified).assertEqual(false);
expect(data.distributedInfo.name != null).assertEqual(true);
expect(data.domainInfo.domain == "").assertEqual(true);
expect(data.photo == "").assertEqual(true);
expect(data.createTime != "").assertEqual(true);
expect(data.lastLoginTime>=0).assertEqual(true);
expect(data.serialNumber.toString().length == 16).assertEqual(true);
expect(data.isActived).assertEqual(false);
expect(data.isCreateCompleted).assertEqual(true)
localId = data.localId;
osAccountManager.getSerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{
console.debug("====>queryOsAccountById err:" + JSON.stringify(err));
......@@ -487,5 +493,192 @@ export default function ActsOsAccountThirdPartyTest_third_2() {
console.debug("====>ActsOsAccountGetCount_0200 end====");
done();
})
/*
* @tc.number : ActsOsAccountQueryActivedOsAccountIds_0100
* @tc.name : queryActivatedOsAccountIds callback
* @tc.desc : query activated osAccount Ids
*/
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).assertEqual(null)
console.info("====>ActsOsAccountGQueryActicedOsAccountIds_0100 dataArray" + dataArray.length);
done();
})
})
/*
* @tc.number : ActsOsAccountQueryActivedOsAccountIds_0200
* @tc.name : queryActivatedOsAccountIds promise
* @tc.desc : query activated osAccount Ids
*/
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))
done();
}).catch((err)=>{
console.info("====>ActsOsAccountQueryActivedOsAccountIds_0200 err " + JSON.stringify(err));
expect(err).assertEqual(null)
done();
});
})
/*
* @tc.number : ActsOsAccountConstraints_0300
* @tc.name : Constraints callback
* @tc.desc : get 0 local user all constraints
*/
it('ActsOsAccountConstraints_3100', 0, async function(done){
console.debug("====>ActsOsAccountConstraints_3100 start====");
var AccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
AccountManager.getOsAccountAllConstraints(0, (err, constraints)=>{
console.debug("====>getOsAccountAllConstraints err:" + JSON.stringify(err));
console.debug("====>getOsAccountAllConstraints:" + JSON.stringify(constraints));
expect(err).assertEqual(null);
expect(constraints.length).assertEqual(0);
console.debug("====>ActsOsAccountConstraints_3100 end====");
done();
})
})
/*
* @tc.number : ActsOsAccountConstraints_0400
* @tc.name : Constraints promise
* @tc.desc : get 0 local user all constraints
*/
it('ActsOsAccountConstraints_3200', 0, async function(done){
console.debug("====>ActsOsAccountConstraints_3200 start====");
var AccountManager = osaccount.getAccountManager();
console.debug("get AccountManager finish====");
AccountManager.getOsAccountAllConstraints(0).then((data)=>{
console.debug("====>ActsOsAccountConstraints_3200 getOsAccountAllConstraints data:" + data);
done();
}).catch((err)=>{
console.debug("====>ActsOsAccountConstraints_3200 getOsAccountAllConstraints err:" + JSON.stringify(err));
expect().assertFalse()
done();
})
})
/**
* @tc.number ActsAccountDomainTest_0300
* @tc.name Test createOsAccountForDomain getOsAccountLocalIdFromDomain callback
* @tc.desc Test createOsAccountForDomain getOsAccountLocalIdFromDomain API functionality
*/
it('ActsOsAccountDomainTest_0300', 0, async function (done) {
console.debug("====>ActsOsAccountDomainTest_0100 start====");
var osAccountManager = osaccount.getAccountManager();
osAccountManager.getOsAccountLocalIdFromDomain({domain: "", accountName: ""}, (err)=>{
console.debug("====>ActsOsAccountDomainTest_0300 err:" + JSON.stringify(err));
expect(err.code != 0).assertEqual(true)
console.debug("====>ActsOsAccountDomainTest_0300 end====");
done();
})
});
/**
* @tc.number ActsAccountDomainTest_0400
* @tc.name Test createOsAccountForDomain getOsAccountLocalIdFromDomain pormise
* @tc.desc Test createOsAccountForDomain getOsAccountLocalIdFromDomain API functionality
*/
it('ActsOsAccountDomainTest_0400', 0, async function (done) {
console.debug("====>ActsOsAccountDomainTest_0400 start====");
var osAccountManager = osaccount.getAccountManager();
osAccountManager.getOsAccountLocalIdFromDomain({domain: "", accountName: ""}).then((accountID)=>{
console.debug("ActsOsAccountDomainTest_0400 accountID:" + JSON.stringify(accountID))
done();
}).catch((err)=>{
console.debug("ActsOsAccountDomainTest_0400 err:" + JSON.stringify(err))
expect(err.code != 0).assertEqual(true)
done();
})
});
/*
* @tc.number : ActsOsAccountQuery_1700
* @tc.name : queryCurrentOsAccount callback
* @tc.desc : Get the os account information to which the application belongs
*/
it('ActsOsAccountQuery_2100', 0, async function(done){
console.debug("====>ActsOsAccountQuery_2100 start====");
var AccountManager = osaccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
AccountManager.queryCurrentOsAccount((err, data)=>{
console.debug("====>queryCurrentOsAccount err:" + JSON.stringify(err));
console.debug("====>queryCurrentOsAccount data:" + JSON.stringify(data));
expect(err).assertEqual(null);
console.debug("====>ActsOsAccountQuery_2100 end====");
done();
})
})
/*
* @tc.number : ActsOsAccountQuery_1800
* @tc.name : queryCurrentOsAccount promise
* @tc.desc : Get the os account information to which the application belongs
*/
it('ActsOsAccountQuery_2200', 0, async function(done){
console.debug("====>ActsOsAccountQuery_2200 start====");
var AccountManager = osaccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
var data = await AccountManager.queryCurrentOsAccount();
console.debug("====>queryCurrentOsAccount data:" + JSON.stringify(data));
expect(data.localId).assertEqual(100);
expect(data.type.ADMIN).assertEqual(0);
var serialNumberStr = data.serialNumber.toString();
var serialIntercept = serialNumberStr.substring(8);
console.debug("====>truncate the last eight characters: " + serialIntercept);
expect(serialIntercept).assertEqual("00000001");
expect(data.isCreateCompleted).assertTrue();
console.debug("====>ActsOsAccountQuery_2200 end====");
done();
})
/*
* @tc.number : ActsOsAccountPermission_3300
* @tc.name : isOsAccountConstraintEnable callback
* @tc.desc : the application call interface does not meet the permissions
*/
it('ActsOsAccountConstraints_3300', 0, async function(done){
console.debug("====>ActsOsAccountConstraints_3300 start====");
var AccountManager = osaccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
AccountManager.isOsAccountConstraintEnable(100, "constraint.bluetooth", (err, result)=>{
console.debug("====>isOsAccountConstraintEnable err:" + JSON.stringify(err));
expect(err).assertEqual(null);
expect(result).assertTrue();
console.debug("====>ActsOsAccountConstraints_3300 end====");
done();
})
})
/*
* @tc.number : ActsOsAccountPermission_3400
* @tc.name : isOsAccountConstraintEnable promise
* @tc.desc : the application call interface does not meet the permissions
*/
it('ActsOsAccountConstraints_3400', 0, async function(done){
console.debug("====>ActsOsAccountConstraints_3400 start====");
var AccountManager = osaccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
try{
await AccountManager.isOsAccountConstraintEnable(100, "constraint.bluetooth");
done();
}
catch(err){
console.debug("====>isOsAccountConstraintEnable err:" + JSON.stringify(err));
expect(err).assertEqual(null);
console.debug("====>ActsOsAccountConstraints_3400 end====");
done();
}
})
})
}
\ No newline at end of file
......@@ -499,5 +499,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() {
console.debug("====>ActsOsAccountIsTest_0200 end====");
done();
})
})
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册