提交 f51ba516 编写于 作者: G gaoxi785

Update osaccount test code

Signed-off-by: Ngaoxi785 <gaoxi785@huawei.com>
上级 b0037be7
......@@ -15,6 +15,8 @@
import osaccount from '@ohos.account.osAccount'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
const TIMEOUT = 1000;
const ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR = 4587571;
describe('ActsOsAccountSystemTest', function () {
/*
......@@ -26,17 +28,29 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>ActsOsAccountActivate_0100 start====");
var osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
osAccountManager.isOsAccountActived(100, (err, data)=>{
osAccountManager.isOsAccountActived(100, (err, isActived)=>{
console.debug("====>isOsAccountActived err:" + JSON.stringify(err));
console.debug("====>isOsAccountActived data:" + data);
console.debug("====>isOsAccountActived data:" + isActived);
expect(err.code).assertEqual(0);
expect(data).assertTrue();
osAccountManager.activateOsAccount(100, (err)=>{
console.debug("====>activateOsAccount err:" + JSON.stringify(err));
expect(err.code != 0).assertTrue();
console.debug("====>ActsOsAccountActivate_0100 end====");
done();
})
if(isActived){
osAccountManager.activateOsAccount(100, (err)=>{
console.debug("====>activateOsAccount err:" + JSON.stringify(err));
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR);
console.debug("====>ActsOsAccountActivate_0100 end====");
done();
})
}else{
osAccountManager.activateOsAccount(100, (err)=>{
console.debug("====>activateOsAccount first err:" + JSON.stringify(err));
expect(err.code).assertEqual(0);
osAccountManager.activateOsAccount(100, (err)=>{
console.debug("====>activateOsAccount second err:" + JSON.stringify(err));
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR);
console.debug("====>ActsOsAccountActivate_0100 end====");
done();
})
})
}
})
});
......@@ -49,23 +63,29 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>ActsOsAccountActivate_0200 start====");
var osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
try{
var isActived = await osAccountManager.isOsAccountActived(100);
}catch(err){
console.error("====>catch isOsAccountActived 0200 err:" + JSON.stringify(err));
expect().assertFail();
done();
}
var isActived = await osAccountManager.isOsAccountActived(100);
console.debug("====>isOsAccountActived err:" + JSON.stringify(isActived));
expect(isActived).assertTrue();
try{
if(isActived){
try{
await osAccountManager.activateOsAccount(100);
}catch(err){
console.debug("====>catch activateOsAccount 0200 err:" + JSON.stringify(err));
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR);
console.debug("====>ActsOsAccountActivate_0200 end====");
done();
}
}else{
console.debug("====>switch to 100 user====");
await osAccountManager.activateOsAccount(100);
}catch(err){
console.debug("====>catch activateOsAccount 0200 err:" + JSON.stringify(err));
expect(err.code != 0).assertTrue();
console.debug("====>ActsOsAccountActivate_0200 end====");
done();
}
try{
await osAccountManager.activateOsAccount(100);
}catch(err){
console.debug("====>catch activateOsAccount 0200 err:" + JSON.stringify(err));
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR);
console.debug("====>ActsOsAccountActivate_0200 end====");
done();
}
}
});
/*
......@@ -158,7 +178,7 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>get AccountManager finish====");
osAccountManager.activateOsAccount(0, (err)=>{
console.debug("====>activateOsAccount to 0 user err:" + JSON.stringify(err));
expect(err.code != 0).assertTrue();
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR);
console.debug("====>ActsOsAccountActivate_0500 end====");
done();
})
......@@ -177,7 +197,7 @@ describe('ActsOsAccountSystemTest', function () {
await osAccountManager.activateOsAccount(0);
}catch(err){
console.debug("====>activateOsAccount to 0 user err:" + JSON.stringify(err));
expect(err.code != 0).assertTrue();
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR);
console.debug("====>ActsOsAccountActivate_0600 end====");
done();
}
......@@ -194,7 +214,7 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>get AccountManager finish====");
osAccountManager.activateOsAccount(-1, (err)=>{
console.debug("====>activateOsAccount to -1 user err:" + JSON.stringify(err));
expect(err.code != 0).assertTrue();
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR);
console.debug("====>ActsOsAccountActivate_0700 end====");
done();
})
......@@ -213,7 +233,7 @@ describe('ActsOsAccountSystemTest', function () {
await osAccountManager.activateOsAccount(-1);
}catch(err){
console.debug("====>activateOsAccount to -1 user err:" + JSON.stringify(err));
expect(err.code != 0).assertTrue();
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR);
console.debug("====>ActsOsAccountActivate_0800 end====");
done();
}
......@@ -228,12 +248,18 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>ActsOsAccountActivate_0900 start====");
var osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
osAccountManager.activateOsAccount("Abc", (err)=>{
console.debug("====>activateOsAccount to 'Abc' user err:" + JSON.stringify(err));
expect(err.code != 0).assertTrue();
var localIdStr = "100";
function funcActivateCallback(err){
console.debug("====>error received callback====");
console.debug("====>receive activateOsAccount err: " + JSON.stringify(err));
expect().assertFail();
done();
}
osAccountManager.activateOsAccount(localIdStr, funcActivateCallback);
setTimeout(()=>{
console.debug("====>ActsOsAccountActivate_0900 end====");
done();
})
}, TIMEOUT);
});
/*
......@@ -245,14 +271,11 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>ActsOsAccountActivate_1000 start====");
var osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
try{
await osAccountManager.activateOsAccount("Abc");
}catch(err){
console.debug("====>activateOsAccount to 'Abc' user err:" + JSON.stringify(err));
expect(err.code != 0).assertTrue();
console.debug("====>ActsOsAccountActivate_1000 end====");
done();
}
var localIdStr = "100";
var activateResult = await osAccountManager.activateOsAccount(localIdStr);
expect(activateResult).assertEqual(null);
console.debug("====>ActsOsAccountActivate_1000 end====");
done();
});
/*
......@@ -264,12 +287,17 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>ActsOsAccountActivate_1100 start====");
var osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
osAccountManager.activateOsAccount(undefined, (err)=>{
console.debug("====>activateOsAccount to undefined user err:" + JSON.stringify(err));
expect(err.code != 0).assertTrue();
function funcActivateCallback(err){
console.debug("====>error received callback====");
console.debug("====>receive activateOsAccount err: " + JSON.stringify(err));
expect().assertFail();
done();
}
osAccountManager.activateOsAccount(undefined, funcActivateCallback);
setTimeout(()=>{
console.debug("====>ActsOsAccountActivate_1100 end====");
done();
})
}, TIMEOUT);
});
/*
......@@ -281,14 +309,10 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>ActsOsAccountActivate_1200 start====");
var osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
try{
await osAccountManager.activateOsAccount(undefined);
}catch(err){
console.debug("====>activateOsAccount to undefined user err:" + JSON.stringify(err));
expect(err.code != 0).assertTrue();
console.debug("====>ActsOsAccountActivate_1200 end====");
done();
}
var activateResult = await osAccountManager.activateOsAccount(undefined);
expect(activateResult).assertEqual(null);
console.debug("====>ActsOsAccountActivate_1200 end====");
done();
});
/*
......@@ -303,7 +327,7 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>get AccountManager finish====");
osAccountManager.activateOsAccount(nonExistentLocalId, (err)=>{
console.debug("====>activateOsAccount to nonexist user err:" + JSON.stringify(err));
expect(err.code != 0).assertTrue();
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR);
console.debug("====>ActsOsAccountActivate_1300 end====");
done();
})
......@@ -323,7 +347,7 @@ describe('ActsOsAccountSystemTest', function () {
await osAccountManager.activateOsAccount(nonExistentLocalId);
}catch(err){
console.debug("====>activateOsAccount to nonexist user err:" + JSON.stringify(err));
expect(err.code != 0).assertTrue();
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR);
console.debug("====>ActsOsAccountActivate_1400 end====");
done();
}
......
......@@ -245,7 +245,7 @@ describe('ActsOsAccountSystemTest', function () {
/*
* @tc.number : ActsOsAccountOnOff_0700
* @tc.name : Subscribe and unsubscribing local multi-user
* @tc.desc : Verification cannot cancel activating type not subscribed
* @tc.desc : Validate subscription callback with parameter name as empty string
*/
it('ActsOsAccountOnOff_0700', 0, async function (done) {
console.debug("====>ActsOsAccountOnOff_0700 start====");
......@@ -269,7 +269,7 @@ describe('ActsOsAccountSystemTest', function () {
expect(err.code).assertEqual(0);
expect(osAccountInfo.localName).assertEqual("osAccountNameE");
osAccountManager.activateOsAccount(localId, (err)=>{
console.debug("====>activateOsAccount err:" + JSON.stringify(err));
console.debug("====>activateOsAccount errcode:" + JSON.stringify(err));
expect(err.code).assertEqual(0);
setTimeout(()=>{
osAccountManager.removeOsAccount(localId, (err)=>{
......@@ -286,7 +286,7 @@ describe('ActsOsAccountSystemTest', function () {
/*
* @tc.number : ActsOsAccountOnOff_0800
* @tc.name : Subscribe and unsubscribing local multi-user
* @tc.desc : Verification cannot cancel activating type not subscribed
* @tc.desc : Validate subscription promise with parameter name as empty string
*/
it('ActsOsAccountOnOff_0800', 0, async function (done) {
console.debug("====>ActsOsAccountOnOff_0800 start====");
......
......@@ -12,10 +12,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import osaccount from '@ohos.account.osAccount'
import osaccount from '@ohos.account.osaccount'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
const TIMEOUT = 1000;
const OSACCOUNTMAXNUMBER = 999;
const ERR_OSACCOUNT_KIT_QUERY_OS_ACCOUNT_BY_ID_ERROR = 4587554;
describe('ActsOsAccountSystemTest', function () {
/*
......@@ -68,15 +70,23 @@ describe('ActsOsAccountSystemTest', function () {
/*
* @tc.number : ActsOsAccountQuery_0300
* @tc.name : queryOsAccountById callback
* @tc.desc : Authenticate failed to obtain local user 0 information
* @tc.desc : Authenticate to get local user 0 information and compare
*/
it('ActsOsAccountQuery_0300', 0, async function (done) {
console.debug("====>ActsOsAccountQuery_0300 start====");
var osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
osAccountManager.queryOsAccountById(0, (err)=>{
osAccountManager.queryOsAccountById(0, (err, data)=>{
console.debug("====>queryOsAccountById err:" + JSON.stringify(err));
expect(err.code != 0).assertEqual(true);
console.debug("====>queryOsAccountById data:" + JSON.stringify(data));
expect(err.code).assertEqual(0);
expect(data.localId).assertEqual(0);
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("00000000");
expect(data.isCreateCompleted).assertTrue();
console.debug("====>ActsOsAccountQuery_0300 end====");
done();
})
......@@ -85,20 +95,23 @@ describe('ActsOsAccountSystemTest', function () {
/*
* @tc.number : ActsOsAccountQuery_0400
* @tc.name : queryOsAccountById promise
* @tc.desc : Authenticate failed to obtain local user 0 information
* @tc.desc : Authenticate to get local user 0 information and compare
*/
it('ActsOsAccountQuery_0400', 0, async function (done) {
console.debug("====>ActsOsAccountQuery_0400 start====");
var osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
try{
await osAccountManager.queryOsAccountById(0);
}catch(err){
console.debug("====>queryOsAccountById err:" + JSON.stringify(err));
expect(err.code != 0).assertEqual(true);
console.debug("====>ActsOsAccountQuery_0400 end====");
done();
}
var osAccountInfo = await osAccountManager.queryOsAccountById(0);
console.debug("====>queryOsAccountById osAccountInfo:" + JSON.stringify(osAccountInfo));
expect(osAccountInfo.localId).assertEqual(0);
expect(osAccountInfo.type.ADMIN).assertEqual(0);
var serialNumberStr = osAccountInfo.serialNumber.toString();
var serialIntercept = serialNumberStr.substring(8);
console.debug("====>truncate the last eight characters: " + serialIntercept);
expect(serialIntercept).assertEqual("00000000");
expect(osAccountInfo.isCreateCompleted).assertTrue();
console.debug("====>ActsOsAccountQuery_0400 end====");
done();
});
/*
......@@ -112,7 +125,7 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>get AccountManager finish====");
osAccountManager.queryOsAccountById(-1, (err)=>{
console.debug("====>queryOsAccountById err:" + JSON.stringify(err));
expect(err.code != 0).assertEqual(true);
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_QUERY_OS_ACCOUNT_BY_ID_ERROR);
console.debug("====>ActsOsAccountQuery_0500 end====");
done();
})
......@@ -121,7 +134,7 @@ describe('ActsOsAccountSystemTest', function () {
/*
* @tc.number : ActsOsAccountQuery_0600
* @tc.name : queryOsAccountById promise
* @tc.desc : Authenticate failed to obtain local user 0 information
* @tc.desc : Authenticate failed to obtain local user -1 information
*/
it('ActsOsAccountQuery_0600', 0, async function (done) {
console.debug("====>ActsOsAccountQuery_0600 start====");
......@@ -131,7 +144,7 @@ describe('ActsOsAccountSystemTest', function () {
await osAccountManager.queryOsAccountById(-1);
}catch(err){
console.debug("====>queryOsAccountById err:" + JSON.stringify(err));
expect(err.code != 0).assertEqual(true);
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_QUERY_OS_ACCOUNT_BY_ID_ERROR);
console.debug("====>ActsOsAccountQuery_0600 end====");
done();
}
......@@ -146,12 +159,19 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>ActsOsAccountQuery_0700 start====");
var osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
osAccountManager.queryOsAccountById("100", (err)=>{
console.debug("====>queryOsAccountById err:" + JSON.stringify(err));
expect(err.code != 0).assertEqual(true);
var localIdStr = "100";
function funcQueryById(err, data){
console.debug("====>error received callback====");
console.debug("====>receive queryOsAccountById err: " + JSON.stringify(err));
console.debug("====>receive queryOsAccountById data: " + JSON.stringify(data));
expect().assertFail();
done();
}
osAccountManager.queryOsAccountById(localIdStr, funcQueryById);
setTimeout(()=>{
console.debug("====>ActsOsAccountQuery_0700 end====");
done();
})
}, TIMEOUT);
});
/*
......@@ -163,14 +183,12 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>ActsOsAccountQuery_0800 start====");
var osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
try{
await osAccountManager.queryOsAccountById("100");
}catch(err){
console.debug("====>queryOsAccountById err:" + JSON.stringify(err));
expect(err.code != 0).assertEqual(true);
console.debug("====>ActsOsAccountQuery_0800 end====");
done();
}
var localIdStr = "100";
var osAccountInfo = await osAccountManager.queryOsAccountById(localIdStr);
console.debug("====>get os accountInfo is: " + osAccountInfo);
expect(osAccountInfo).assertEqual(null);
console.debug("====>ActsOsAccountQuery_0800 end====");
done();
});
/*
......@@ -182,12 +200,18 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>ActsOsAccountQuery_0900 start====");
var osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
osAccountManager.queryOsAccountById(undefined, (err)=>{
console.debug("====>queryOsAccountById err:" + JSON.stringify(err));
expect(err.code != 0).assertEqual(true);
function funcQueryById(err, data){
console.debug("====>error received callback====");
console.debug("====>receive queryOsAccountById err: " + JSON.stringify(err));
console.debug("====>receive queryOsAccountById data: " + JSON.stringify(data));
expect().assertFail();
done();
}
osAccountManager.queryOsAccountById(undefined, funcQueryById);
setTimeout(()=>{
console.debug("====>ActsOsAccountQuery_0900 end====");
done();
})
}, TIMEOUT);
});
/*
......@@ -199,14 +223,11 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>ActsOsAccountQuery_1000 start====");
var osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
try{
await osAccountManager.queryOsAccountById(undefined);
}catch(err){
console.debug("====>queryOsAccountById err:" + JSON.stringify(err));
expect(err.code != 0).assertEqual(true);
console.debug("====>ActsOsAccountQuery_1000 end====");
done();
}
var osAccountInfo = await osAccountManager.queryOsAccountById(undefined);
console.debug("====>get os accountInfo is: " + osAccountInfo);
expect(osAccountInfo).assertEqual(null);
console.debug("====>ActsOsAccountQuery_1000 end====");
done();
});
/*
......@@ -223,10 +244,12 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>queryAllCreatedOsAccounts err:" + JSON.stringify(err));
console.debug("====>queryAllCreatedOsAccounts data:" + JSON.stringify(data));
expect(err.code).assertEqual(0);
console.debug("====>data.length:" + data.length);
for (let i = 0, len = data.length; i < len; i++) {
dataMap.set(data[i].localId, data[i].localName)
console.debug("====>contain localId:" + data[i].localId);
dataMap.set(data[i].localId.toString(), data[i].localName)
}
expect(dataMap.has(100)).assertTrue();
expect(dataMap.has("100")).assertTrue();
console.debug("====>ActsOsAccountQuery_1100 end====");
done();
})
......@@ -245,9 +268,10 @@ describe('ActsOsAccountSystemTest', function () {
var osAccountCreated = await osAccountManager.queryAllCreatedOsAccounts();
console.debug("====>queryAllCreatedOsAccounts:" + JSON.stringify(osAccountCreated));
for (let i = 0, len = osAccountCreated.length; i < len; i++) {
dataMap.set(osAccountCreated[i].localId, osAccountCreated[i].localName)
console.debug("====>contain localId:" + osAccountCreated[i].localId);
dataMap.set(osAccountCreated[i].localId.toString(), osAccountCreated[i].localName)
}
expect(dataMap.has(100)).assertTrue();
expect(dataMap.has("100")).assertTrue();
console.debug("====>ActsOsAccountQuery_1200 end====");
done();
});
......@@ -262,11 +286,13 @@ describe('ActsOsAccountSystemTest', function () {
var osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
var createIocalId;
var createIdStr;
let dataMap = new Map();
osAccountManager.createOsAccount("osAccountNameQueryA", 1, (err, osAccountInfo)=>{
console.debug("====>createOsAccount err:" + JSON.stringify(err));
console.debug("====>createOsAccount osAccountInfo:" + JSON.stringify(osAccountInfo));
createIocalId = osAccountInfo.localId;
createIdStr = createIocalId.toString();
expect(err.code).assertEqual(0);
expect(osAccountInfo.localName).assertEqual("osAccountNameQueryA");
osAccountManager.queryAllCreatedOsAccounts((err, data)=>{
......@@ -274,12 +300,13 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>queryAllCreatedOsAccounts data:" + JSON.stringify(data));
expect(err.code).assertEqual(0);
for (let i = 0, len = data.length; i < len; i++) {
dataMap.set(data[i].localId, data[i].localName)
console.debug("====>contain localId:" + data[i].localId);
dataMap.set(data[i].localId.toString(), data[i].localName)
}
expect(dataMap.has(100)).assertTrue();
expect(dataMap.has(createIocalId)).assertTrue();
if (dataMap.has(createIocalId)) {
let createdlocalName = dataMap.get(createIocalId);
expect(dataMap.has("100")).assertTrue();
expect(dataMap.has(createIdStr)).assertTrue();
if (dataMap.has(createIdStr)) {
let createdlocalName = dataMap.get(createIdStr);
console.debug("====>query all local users containing localId: " + createIocalId);
console.debug("====>created localName" + createdlocalName);
expect(createdlocalName).assertEqual("osAccountNameQueryA");
......@@ -304,20 +331,23 @@ describe('ActsOsAccountSystemTest', function () {
var osAccountManager = osaccount.getAccountManager();
console.debug("====>get AccountManager finish====");
var createIocalId;
var createIdStr;
let dataMap = new Map();
var osAccountInfo = await osAccountManager.createOsAccount("osAccountNameQueryB", 1);
console.debug("====>createOsAccount osAccountInfo:" + JSON.stringify(osAccountInfo));
createIocalId = osAccountInfo.localId;
createIdStr = createIocalId.toString();
expect(osAccountInfo.localName).assertEqual("osAccountNameQueryB");
var data = await osAccountManager.queryAllCreatedOsAccounts();
console.debug("====>queryAllCreatedOsAccounts data:" + JSON.stringify(data));
for (let i = 0, len = data.length; i < len; i++) {
dataMap.set(data[i].localId, data[i].localName)
console.debug("====>contain localId:" + data[i].localId);
dataMap.set(data[i].localId.toString(), data[i].localName)
}
expect(dataMap.has(100)).assertTrue();
expect(dataMap.has(createIocalId)).assertTrue();
if (dataMap.has(createIocalId)) {
let createdlocalName = dataMap.get(createIocalId);
expect(dataMap.has("100")).assertTrue();
expect(dataMap.has(createIdStr)).assertTrue();
if (dataMap.has(createIdStr)) {
let createdlocalName = dataMap.get(createIdStr);
console.debug("====>query all local users containing localId: " + createIocalId);
expect(createdlocalName).assertEqual("osAccountNameQueryB");
}
......@@ -362,12 +392,118 @@ describe('ActsOsAccountSystemTest', function () {
});
/*
* @tc.number : ActsOsAccountIsVerified_0100
* @tc.name : isOsAccountVerified callback
* @tc.desc : create a os account and check whether the initial state of the os account is verified
* @tc.number : ActsOsAccountQuery_1700
* @tc.name : queryCurrentOsAccount callback
* @tc.desc : Get the os account information to which the application belongs
*/
it('ActsOsAccountQuery_1700', 0, async function(done){
console.debug("====>ActsOsAccountQuery_1700 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.code).assertEqual(0);
expect(data.localId).assertEqual(0);
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("00000000");
expect(data.isCreateCompleted).assertTrue();
console.debug("====>ActsOsAccountQuery_1700 end====");
done();
})
})
/*
* @tc.number : ActsOsAccountQuery_1800
* @tc.name : queryCurrentOsAccount promise
* @tc.desc : Get the os account information to which the application belongs
*/
it('ActsOsAccountQuery_1800', 0, async function(done){
console.debug("====>ActsOsAccountQuery_1800 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(0);
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("00000000");
expect(data.isCreateCompleted).assertTrue();
console.debug("====>ActsOsAccountQuery_1800 end====");
done();
})
/*
* @tc.number : ActsOsAccountQuery_1900
* @tc.name : queryCurrentOsAccount callback
* @tc.desc : Get the local user to which the application belongs when creating and switching a local user
*/
it('ActsOsAccountQuery_1900', 0, async function(done){
console.debug("====>ActsOsAccountQuery_1900 start====");
var AccountManager = osaccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
var createLocalId;
AccountManager.createOsAccount("OsAccountNameA", 1, (err,data)=>{
console.debug("====>createOsAccount err:" + JSON.stringify(err));
console.debug("====>createOsAccount data:" + JSON.stringify(data));
expect(err.code).assertEqual(0);
createLocalId = data.localId;
expect(data.localName).assertEqual("OsAccountNameA");
AccountManager.activateOsAccount(createLocalId, (err)=>{
console.debug("====>activateOsAccount err:" + JSON.stringify(err));
expect(err.code).assertEqual(0);
AccountManager.queryCurrentOsAccount((err, currentOsInfo)=>{
console.debug("====>queryCurrentOsAccount err:" + JSON.stringify(err));
console.debug("====>queryCurrentOsAccount data:" + JSON.stringify(currentOsInfo));
expect(err.code).assertEqual(0);
expect(currentOsInfo.localId).assertEqual(0);
AccountManager.removeOsAccount(createLocalId, (err)=>{
console.debug("====>remove localId: " + createLocalId + " err:" + JSON.stringify(err));
expect(err.code).assertEqual(0);
console.debug("====>ActsOsAccountQuery_1900 end====");
done();
})
})
})
})
})
/*
* @tc.number : ActsOsAccountQuery_2000
* @tc.name : queryCurrentOsAccount promise
* @tc.desc : Get the local user to which the application belongs when creating and switching a local user
*/
it('ActsOsAccountQuery_2000', 0, async function(done){
console.debug("====>ActsOsAccountQuery_2000 start====");
var AccountManager = osaccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
var createLocalId;
var data = await AccountManager.createOsAccount("OsAccountNameB", 1);
console.debug("====>createOsAccount data:" + JSON.stringify(data));
createLocalId = data.localId;
expect(data.localName).assertEqual("OsAccountNameB");
await AccountManager.activateOsAccount(createLocalId);
var currentOsInfo = await AccountManager.queryCurrentOsAccount();
console.debug("====>queryCurrentOsAccount:" + JSON.stringify(currentOsInfo));
expect(currentOsInfo.localId).assertEqual(0);
await AccountManager.removeOsAccount(createLocalId);
console.debug("====>ActsOsAccountQuery_2000 end====");
done();
})
/*
* @tc.number : ActsOsAccountIsVerified_1100
* @tc.name : isOsAccountVerified callback
* @tc.desc : create a os account and check whether the initial state of the os account is verified
*/
it('ActsOsAccountIsVerified_0100', 0, async function(done){
console.debug("====>ActsOsAccountIsVerified_0100 start====");
it('ActsOsAccountIsVerified_1100', 0, async function(done){
console.debug("====>ActsOsAccountIsVerified_1100 start====");
var AccountManager = osaccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
var osLocalId;
......@@ -385,7 +521,7 @@ describe('ActsOsAccountSystemTest', function () {
AccountManager.removeOsAccount(osLocalId, (err)=>{
console.debug("====>removeOsAccount err:" +JSON.stringify(err));
expect(err.code).assertEqual(0);
console.debug("====>ActsOsAccountIsVerified_0100 end====");
console.debug("====>ActsOsAccountIsVerified_1100 end====");
done();
})
})
......@@ -393,12 +529,12 @@ describe('ActsOsAccountSystemTest', function () {
})
/*
* @tc.number : ActsOsAccountIsVerified_0200
* @tc.name : isOsAccountVerified promise
* @tc.desc : create a os account and check whether the initial state of the os account is verified
* @tc.number : ActsOsAccountIsVerified_1200
* @tc.name : isOsAccountVerified promise
* @tc.desc : create a os account and check whether the initial state of the os account is verified
*/
it('ActsOsAccountIsVerified_0200', 0, async function(done){
console.debug("====>ActsOsAccountIsVerified_0200 start====");
it('ActsOsAccountIsVerified_1200', 0, async function(done){
console.debug("====>ActsOsAccountIsVerified_1200 start====");
var AccountManager = osaccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
var data = await AccountManager.createOsAccount("OsAccountNameVerfiedB", 1);
......@@ -416,7 +552,7 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>isOsAccountVerified data:" + data);
expect(data).assertEqual(false);
await AccountManager.removeOsAccount(osAccountLocalId);
console.debug("====>ActsOsAccountIsVerified_0200 end====");
console.debug("====>ActsOsAccountIsVerified_1200 end====");
done();
})
})
\ No newline at end of file
......@@ -15,13 +15,15 @@
import osAccount from '@ohos.account.osAccount'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
const TIMEOUT = 1000;
const ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR = 4587543;
const ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR = 4587546;
describe('ActsOsAccountThirdPartyTest', function () {
/*
* @tc.number : ActsOsAccountDeviceId_0100
* @tc.name : getDistributedVirtualDeviceId callback
* @tc.desc : get distributed virtual device ID
* @tc.number : ActsOsAccountDeviceId_0100
* @tc.name : getDistributedVirtualDeviceId callback
* @tc.desc : get distributed virtual device ID
*/
it('ActsOsAccountDeviceId_0100', 0, async function(done){
console.debug("====>ActsOsAccountDeviceId_0100 start====");
......@@ -38,9 +40,9 @@ describe('ActsOsAccountThirdPartyTest', function () {
})
/*
* @tc.number : ActsOsAccountDeviceId_0200
* @tc.name : getDistributedVirtualDeviceId promise
* @tc.desc : get distributed virtual device ID
* @tc.number : ActsOsAccountDeviceId_0200
* @tc.name : getDistributedVirtualDeviceId promise
* @tc.desc : get distributed virtual device ID
*/
it('ActsOsAccountDeviceId_0200', 0, async function(done){
console.debug("====>ActsOsAccountDeviceId_0200 start====");
......@@ -61,15 +63,15 @@ describe('ActsOsAccountThirdPartyTest', function () {
})
/*
* @tc.number : ActsOsAccountIsActived_0100
* @tc.name : isOsAccountActived callback
* @tc.desc : Verify that users are not switched and query 100 users as active
* @tc.number : ActsOsAccountIsActived_0100
* @tc.name : isOsAccountActived callback
* @tc.desc : Verify query 0 user status is true
*/
it('ActsOsAccountIsActived_0100', 0, async function(done){
console.debug("====>ActsOsAccountIsActived_0100 start====");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
AccountManager.isOsAccountActived(100, (err, isActived)=>{
AccountManager.isOsAccountActived(0, (err, isActived)=>{
console.debug("====>isOsAccountActived err:" + JSON.stringify(err));
console.debug("====>isOsAccountActived isActived:" + isActived);
expect(err.code).assertEqual(0);
......@@ -80,16 +82,16 @@ describe('ActsOsAccountThirdPartyTest', function () {
})
/*
* @tc.number : ActsOsAccountIsActived_0200
* @tc.name : isOsAccountActived promise
* @tc.desc : Verify that users are not switched and query 100 users as active
* @tc.number : ActsOsAccountIsActived_0200
* @tc.name : isOsAccountActived promise
* @tc.desc : Verify query 0 user status is true
*/
it('ActsOsAccountIsActived_0200', 0, async function(done){
console.debug("====>ActsOsAccountIsActived_0200 start====");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
try{
var isActived = await AccountManager.isOsAccountActived(100);
var isActived = await AccountManager.isOsAccountActived(0);
}
catch(err){
console.debug("====>catch isOsAccountActived err:" + JSON.stringify(err));
......@@ -103,84 +105,128 @@ describe('ActsOsAccountThirdPartyTest', function () {
})
/*
* @tc.number : ActsOsAccountIsActived_0300
* @tc.name : isOsAccountActived callback
* @tc.desc : Authentication query 0 user active status failed
* @tc.number : ActsOsAccountIsActived_0300
* @tc.name : isOsAccountActived callback
* @tc.desc : Authentication failed to query the active status of the user that does not exist
*/
it('ActsOsAccountIsActived_0300', 0, async function(done){
console.debug("====>ActsOsAccountIsActived_0300 start");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
AccountManager.isOsAccountActived(0, (err)=>{
var nonExistLocalId = 1000;
AccountManager.isOsAccountActived(nonExistLocalId, (err)=>{
console.debug("====>isOsAccountActived err:" + JSON.stringify(err));
expect(err.code !=0 ).assertEqual(true);
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR);
console.debug("====>ActsOsAccountIsActived_0300 end");
done();
})
})
/*
* @tc.number : ActsOsAccountIsActived_0400
* @tc.name : isOsAccountActived promise
* @tc.desc : Authentication query 0 user active status failed
* @tc.number : ActsOsAccountIsActived_0400
* @tc.name : isOsAccountActived promise
* @tc.desc : Authentication failed to query the active status of the user that does not exist
*/
it('ActsOsAccountIsActived_0400', 0, async function(done){
console.debug("====>isOsAccountActived_0400 start====");
console.debug("====>ActsOsAccountIsActived_0400 start====");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
var nonExistLocalId = 1000;
try{
await AccountManager.isOsAccountActived(0);
await AccountManager.isOsAccountActived(nonExistLocalId);
}
catch(err){
console.debug("====>isOsAccountActived err:" + JSON.stringify(err));
expect(err.code !=0 ).assertTrue();
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR);
console.debug("====>ActsOsAccountIsActived_0400 end");
done();
}
})
/*
* @tc.number : ActsOsAccountIsActived_0500
* @tc.name : isOsAccountActived callback
* @tc.desc : Authentication failed to query the active status of the user that does not exist
* @tc.number : ActsOsAccountIsActived_0500
* @tc.name : isOsAccountActived callback
* @tc.desc : Verify that the query active state is not received with parameter type mismatch
*/
it('ActsOsAccountIsActived_0500', 0, async function(done){
console.debug("====>ActsOsAccountIsActived_0500 start");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
var nonExistLocalId = 1000;
AccountManager.isOsAccountActived(nonExistLocalId, (err)=>{
console.debug("====>isOsAccountActived err:" + JSON.stringify(err));
expect(err.code !=0).assertEqual(true);
console.debug("====>ActsOsAccountIsActived_0500 end");
var localIdStr = "100";
function funcIsActived(err, data){
console.debug("====>error received callback====");
console.debug("====>receive isOsAccountActived err: " + JSON.stringify(err));
console.debug("====>receive isOsAccountActived data: " + JSON.stringify(data));
expect().assertFail();
done();
})
}
AccountManager.isOsAccountActived(localIdStr, funcIsActived);
setTimeout(()=>{
console.debug("====>ActsOsAccountIsActived_0500 end====");
done();
}, TIMEOUT);
})
/*
* @tc.number : ActsOsAccountIsActived_0600
* @tc.name : isOsAccountActived promise
* @tc.desc : Authentication failed to query the active status of the user that does not exist
* @tc.number : ActsOsAccountIsActived_0600
* @tc.name : isOsAccountActived promise
* @tc.desc : Verify that the query active state is not received with parameter type mismatch
*/
it('ActsOsAccountIsActived_0600', 0, async function(done){
console.debug("====>ActsOsAccountIsActived_0600 start====");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
var nonExistLocalId = 1000;
try{
await AccountManager.isOsAccountActived(nonExistLocalId);
}
catch(err){
console.debug("====>isOsAccountActived err:" + JSON.stringify(err));
expect(err.code !=0 ).assertTrue();
console.debug("====>ActsOsAccountIsActived_0600 end");
var localIdStr = "100";
var isActived = await AccountManager.isOsAccountActived(localIdStr);
console.debug("====>get active status is: " + isActived);
expect(isActived).assertEqual(null);
console.debug("====>ActsOsAccountIsActived_0600 end====");
done();
})
/*
* @tc.number : ActsOsAccountIsActived_0700
* @tc.name : isOsAccountActived callback
* @tc.desc : Verify that the query active state is not received with parameter undefined
*/
it('ActsOsAccountIsActived_0700', 0, async function(done){
console.debug("====>ActsOsAccountIsActived_0700 start");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
function funcIsActived(err, data){
console.debug("====>error received callback====");
console.debug("====>receive isOsAccountActived err: " + JSON.stringify(err));
console.debug("====>receive isOsAccountActived data: " + JSON.stringify(data));
expect().assertFail();
done();
}
AccountManager.isOsAccountActived(undefined, funcIsActived);
setTimeout(()=>{
console.debug("====>ActsOsAccountIsActived_0700 end====");
done();
}, TIMEOUT);
})
/*
* @tc.number : ActsOsAccountIsMulty_0100
* @tc.name : isMultiOsAccountEnable callback
* @tc.desc : Check whether the function of supporting multiple os account is enabled
* @tc.number : ActsOsAccountIsActived_0800
* @tc.name : isOsAccountActived promise
* @tc.desc : Verify that the query active state is not received with parameter undefined
*/
it('ActsOsAccountIsActived_0800', 0, async function(done){
console.debug("====>ActsOsAccountIsActived_0800 start====");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
var isActived = await AccountManager.isOsAccountActived(undefined);
console.debug("====>get active status is: " + isActived);
expect(isActived).assertEqual(null);
console.debug("====>ActsOsAccountIsActived_0800 end====");
done();
})
/*
* @tc.number : ActsOsAccountIsMulty_0100
* @tc.name : isMultiOsAccountEnable callback
* @tc.desc : Check whether the function of supporting multiple os account is enabled
*/
it('ActsOsAccountIsMulty_0100', 0, async function(done){
console.debug("====>ActsOsAccountIsMulty_0100 start====");
......@@ -197,9 +243,9 @@ describe('ActsOsAccountThirdPartyTest', function () {
})
/*
* @tc.number : ActsOsAccountIsMulty_0200
* @tc.name : isMultiOsAccountEnable promise
* @tc.desc : Check whether the function of supporting multiple os account is enabled
* @tc.number : ActsOsAccountIsMulty_0200
* @tc.name : isMultiOsAccountEnable promise
* @tc.desc : Check whether the function of supporting multiple os account is enabled
*/
it('ActsOsAccountIsMulty_0200', 0, async function(done){
console.debug("====>ActsOsAccountIsMulty_0200 start====");
......@@ -220,120 +266,159 @@ describe('ActsOsAccountThirdPartyTest', function () {
})
/*
* @tc.number : ActsOsAccountIsVerified_0300
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify query 0 user is unlocked failed
* @tc.number : ActsOsAccountVerified_0100
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify that the initial state query is unlocked to false
*/
it('ActsOsAccountVerified_0100', 0, async function(done){
console.debug("====>isOsAccountVerified_0100 start====");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
AccountManager.isOsAccountVerified((err, data)=>{
console.debug("====>isOsAccountVerified err:" + JSON.stringify(err));
console.debug("====>isOsAccountVerified data:" + data);
expect(err.code).assertEqual(0);
expect(data).assertEqual(false);
console.debug("====>ActsOsAccountVerified_0100 end====");
done();
})
})
/*
* @tc.number : ActsOsAccountVerified_0200
* @tc.name : isOsAccountVerified promise
* @tc.desc : Verify that the initial state query is unlocked to false
*/
it('ActsOsAccountVerified_0200', 0, async function(done){
console.debug("====>isOsAccountVerified_0200 start====");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
var isVerified = await AccountManager.isOsAccountVerified();
console.debug("====>isOsAccountVerified data:" + isVerified);
expect(isVerified).assertEqual(false);
console.debug("====>ActsOsAccountVerified_0200 end====");
done();
})
/*
* @tc.number : ActsOsAccountIsVerified_0300
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify that the initial state query 0 user is unlocked to false
*/
it('ActsOsAccountIsVerified_0300', 0, async function(done){
console.debug("====>ActsOsAccountIsVerified_0300 start====");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
AccountManager.isOsAccountVerified(0, (err)=>{
AccountManager.isOsAccountVerified(0, (err, data)=>{
console.debug("====>isOsAccountVerified err:" + JSON.stringify(err));
expect(err.code !=0 ).assertEqual(true);
expect(err.code).assertEqual(0);
expect(data).assertFalse();
console.debug("====>ActsOsAccountIsVerified_0300 end====");
done();
})
})
/*
* @tc.number : ActsOsAccountIsVerified_0400
* @tc.name : isOsAccountVerified promise
* @tc.desc : Verify query 0 user is unlocked failed
* @tc.number : ActsOsAccountIsVerified_0400
* @tc.name : isOsAccountVerified promise
* @tc.desc : Verify that the initial state query 0 user is unlocked to false
*/
it('ActsOsAccountIsVerified_0400', 0, async function(done){
console.debug("====>ActsOsAccountIsVerified_0400 start====");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
try{
await AccountManager.isOsAccountVerified(0);
}
catch(err){
console.debug("====>isOsAccountVerified err:" + JSON.stringify(err));
expect(err.code !=0 ).assertTrue();
console.debug("====>ActsOsAccountIsVerified_0400 end====");
done();
}
var isVerified = await AccountManager.isOsAccountVerified(0);
expect(isVerified).assertFalse();
console.debug("====>ActsOsAccountIsVerified_0400 end====");
done();
})
/*
* @tc.number : ActsOsAccountIsVerified_0500
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify query "100" user is unlocked failed
* @tc.number : ActsOsAccountIsVerified_0500
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify query "100" user is unlocked failed
*/
it('ActsOsAccountIsVerified_0500', 0, async function(done){
console.debug("====>ActsOsAccountIsVerified_0500 start====");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
AccountManager.isOsAccountVerified("100", (err)=>{
console.debug("====>isOsAccountVerified err:" + JSON.stringify(err));
expect(err.code !=0 ).assertEqual(true);
var localIdStr = "100";
function funcIsVerified(err, data){
console.debug("====>error received callback====");
console.debug("====>receive isOsAccountVerified err: " + JSON.stringify(err));
console.debug("====>receive isOsAccountVerified data: " + JSON.stringify(data));
expect().assertFail();
done();
}
AccountManager.isOsAccountVerified(localIdStr, funcIsVerified);
setTimeout(()=>{
console.debug("====>ActsOsAccountIsVerified_0500 end====");
done();
})
}, TIMEOUT);
})
/*
* @tc.number : ActsOsAccountIsVerified_0600
* @tc.name : isOsAccountVerified promise
* @tc.desc : Verify query "100" user is unlocked failed
* @tc.number : ActsOsAccountIsVerified_0600
* @tc.name : isOsAccountVerified promise
* @tc.desc : Verify query "100" user is unlocked failed
*/
it('ActsOsAccountIsVerified_0600', 0, async function(done){
console.debug("====>ActsOsAccountIsVerified_0600 start====");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
try{
await AccountManager.isOsAccountVerified("100");
}
catch(err){
console.debug("====>isOsAccountVerified err:" + JSON.stringify(err));
expect(err.code !=0 ).assertTrue();
console.debug("====>ActsOsAccountIsVerified_0600 end====");
done();
}
var localIdStr = "100";
var isVerified = await AccountManager.isOsAccountVerified(localIdStr);
console.debug("====>get verified status is: " + isVerified);
expect(isVerified).assertEqual(null);
console.debug("====>ActsOsAccountIsVerified_0600 end====");
done();
})
/*
* @tc.number : ActsOsAccountIsVerified_0700
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify query undefined user is unlocked failed
* @tc.number : ActsOsAccountIsVerified_0700
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify query undefined user is unlocked failed
*/
it('ActsOsAccountIsVerified_0700', 0, async function(done){
console.debug("====>ActsOsAccountIsVerified_0700 start====");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
AccountManager.isOsAccountVerified(undefined, (err)=>{
console.debug("====>isOsAccountVerified err:" + JSON.stringify(err));
expect(err.code !=0 ).assertEqual(true);
var localIdUndefined = undefined;
function funcIsVerified(err, data){
console.debug("====>error received callback====");
console.debug("====>receive isOsAccountVerified err: " + JSON.stringify(err));
console.debug("====>receive isOsAccountVerified data: " + JSON.stringify(data));
expect().assertFail();
done();
}
AccountManager.isOsAccountVerified(localIdUndefined, funcIsVerified);
setTimeout(()=>{
console.debug("====>ActsOsAccountIsVerified_0700 end====");
done();
})
}, TIMEOUT);
})
/*
* @tc.number : ActsOsAccountIsVerified_0800
* @tc.name : isOsAccountVerified promise
* @tc.desc : Verify query undefined user is unlocked failed
* @tc.number : ActsOsAccountIsVerified_0800
* @tc.name : isOsAccountVerified promise
* @tc.desc : Verify query undefined user is unlocked failed
*/
it('ActsOsAccountIsVerified_0800', 0, async function(done){
console.debug("====>ActsOsAccountIsVerified_0800 start====");
var AccountManager = osAccount.getAccountManager();
console.debug("====>get os AccountManager finish====");
try{
await AccountManager.isOsAccountVerified(undefined);
}
catch(err){
console.debug("====>ActsOsAccountIsVerified_0800 err:" + JSON.stringify(err));
expect(err.code !=0 ).assertTrue();
console.debug("====>ActsOsAccountIsVerified_0800 end====");
done();
}
var localIdUndefined = undefined;
var isVerified = await AccountManager.isOsAccountVerified(localIdUndefined);
console.debug("====>get verified status is: " + isVerified);
expect(isVerified).assertEqual(null);
console.debug("====>ActsOsAccountIsVerified_0800 end====");
done();
})
/*
* @tc.number : ActsOsAccountIsVerified_0900
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify query does not exist user unlock failed
* @tc.number : ActsOsAccountIsVerified_0900
* @tc.name : isOsAccountVerified callback
* @tc.desc : Verify query does not exist user unlock failed
*/
it('ActsOsAccountIsVerified_0900', 0, async function(done){
console.debug("====>ActsOsAccountIsVerified_0900 start====");
......@@ -342,16 +427,16 @@ describe('ActsOsAccountThirdPartyTest', function () {
var osAccountLocalId = 1000;
AccountManager.isOsAccountVerified(osAccountLocalId, (err)=>{
console.debug("====>isOsAccountVerified err:" + JSON.stringify(err));
expect(err.code !=0 ).assertEqual(true);
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR);
console.debug("====>ActsOsAccountIsVerified_0900 end====");
done();
})
})
/*
* @tc.number : ActsOsAccountIsVerified_1000
* @tc.name : isOsAccountVerified promise
* @tc.desc : Verify query does not exist user unlock failed
* @tc.number : ActsOsAccountIsVerified_1000
* @tc.name : isOsAccountVerified promise
* @tc.desc : Verify query does not exist user unlock failed
*/
it('ActsOsAccountIsVerified_1000', 0, async function(done){
console.debug("====>ActsOsAccountIsVerified_1000 start====");
......@@ -363,16 +448,16 @@ describe('ActsOsAccountThirdPartyTest', function () {
}
catch(err){
console.debug("====>isOsAccountVerified err:" + JSON.stringify(err));
expect(err.code !=0 ).assertTrue();
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR);
console.debug("====>ActsOsAccountIsVerified_1000 end====");
done();
}
})
/*
* @tc.number : ActsOsAccountIsTest_0100
* @tc.name : isTestOsAccount callback
* @tc.desc : check whether this OS account is a test OS account
* @tc.number : ActsOsAccountIsTest_0100
* @tc.name : isTestOsAccount callback
* @tc.desc : check whether this OS account is a test OS account
*/
it('ActsOsAccountIsTest_0100', 0, async function(done){
console.debug("====>ActsOsAccountIsTest_0100 start====");
......@@ -389,9 +474,9 @@ describe('ActsOsAccountThirdPartyTest', function () {
})
/*
* @tc.number : ActsOsAccountIsTest_0200
* @tc.name : isTestOsAccount promise
* @tc.desc : check whether this OS account is a test OS account
* @tc.number : ActsOsAccountIsTest_0200
* @tc.name : isTestOsAccount promise
* @tc.desc : check whether this OS account is a test OS account
*/
it('ActsOsAccountIsTest_0200', 0, async function(done){
console.debug("====>ActsOsAccountIsTest_0200 start====");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册