提交 07d2849f 编写于 作者: 1 15829070344

【账号】XTS冻结适配,NoPermissi_0700/0800

Signed-off-by: N15829070344 <hehaitao5@huawei.com>
上级 3bf08d68
......@@ -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);
......
......@@ -596,6 +596,10 @@ export default function ActsAccountOAuthToken() {
expect(ArrayData.length).assertEqual(1);
expect(ArrayData[0].authType).assertEqual("authType");
expect(ArrayData[0].token).assertEqual("test_token");
expect(ArrayData[0].account).assertEqual(undefined);
expect(ArrayData[0].accounts).assertEqual(undefined);
console.debug("====>test1" + JSON.stringify(ArrayData[0].account))
console.debug("====>test2" + JSON.stringify(ArrayData[0].accounts))
appAccountManager.deleteAccount(limitName,(err)=>{
console.debug("====>ActsAccountOAuthToken_8500 deleteAccount 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 test_init(){
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) {
test_init();
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) {
test_init();
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) {
test_init();
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) {
test_init();
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) {
test_init();
console.debug("====>ActsAccountChangeOnOff_0500 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -326,14 +334,13 @@ 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).assertEqual(null);
done();
}
function subscriberCallback(err, data){
console.debug("====>subscriberCallback 0500 data:" + JSON.stringify(data));
expect(data.event).assertEqual("account_on_change_delete");
expect(data.data).assertEqual("SUCCESS");
commonevent.unsubscribe(subscriber, unSubscriberCallback);
done();
}
function publishCallback(err){
console.debug("====>publish call back err:" + JSON.stringify(err));
......@@ -376,6 +383,7 @@ export default function ActsAccountChangeOnOff() {
* authorized account
*/
it('ActsAccountChangeOnOff_0600', 0, async function (done) {
test_init();
console.debug("====>ActsAccountChangeOnOff_0600 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish");
......@@ -447,6 +455,7 @@ export default function ActsAccountChangeOnOff() {
* the only authorized account
*/
it('ActsAccountChangeOnOff_0700', 0, async function (done) {
test_init();
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.
先完成此消息的编辑!
想要评论请 注册