提交 9dc0c5c3 编写于 作者: G gaoxi785

Change signture and add limit test

Signed-off-by: Ngaoxi785 <gaoxi785@huawei.com>
上级 9e4101ba
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
core.init() core.init()
const configService = core.getDefaultService('config') const configService = core.getDefaultService('config')
this.timeout = 8000; this.timeout = 30000;
configService.setConfig(this) configService.setConfig(this)
require('../../../test/List.test') require('../../../test/List.test')
......
...@@ -16,7 +16,7 @@ import osaccount from '@ohos.account.osAccount' ...@@ -16,7 +16,7 @@ import osaccount from '@ohos.account.osAccount'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
const TIMEOUT = 1000; const TIMEOUT = 1000;
const ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR = 4587574; const ERR_OSACCOUNT_KIT_ACTIVATE_OS_ACCOUNT_ERROR = 4587571;
describe('ActsOsAccountSystemTest', function () { describe('ActsOsAccountSystemTest', function () {
/* /*
...@@ -161,7 +161,6 @@ describe('ActsOsAccountSystemTest', function () { ...@@ -161,7 +161,6 @@ describe('ActsOsAccountSystemTest', function () {
var isActiveHandred = await osAccountManager.isOsAccountActived(100); var isActiveHandred = await osAccountManager.isOsAccountActived(100);
console.debug("====>localId: 100 isOsAccountActived:" + isActiveHandred); console.debug("====>localId: 100 isOsAccountActived:" + isActiveHandred);
expect(isActiveHandred).assertFalse(); expect(isActiveHandred).assertFalse();
await osAccountManager.activateOsAccount(100);
await osAccountManager.removeOsAccount(osLocalId); await osAccountManager.removeOsAccount(osLocalId);
console.debug("====>ActsOsAccountActivate_0400 end===="); console.debug("====>ActsOsAccountActivate_0400 end====");
done(); done();
......
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
import osaccount from '@ohos.account.osaccount' import osaccount from '@ohos.account.osaccount'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
const ERR_OS_ACCOUNT_KIT_CREATE_OS_ACCOUNT_ERROR = 4587526; const ERR_OS_ACCOUNT_KIT_CREATE_OS_ACCOUNT_ERROR = 4587523;
const ERR_OSACCOUNT_KIT_REMOVE_OSACCOUNT_ERROR = 4587532; const ERR_OSACCOUNT_KIT_REMOVE_OSACCOUNT_ERROR = 4587529;
const ERR_OSACCOUNT_KIT_LOCAL_NAME_EMPTY_ERROR = 4587581; const ERR_OSACCOUNT_KIT_LOCAL_NAME_EMPTY_ERROR = 4587578;
const ERR_OSACCOUNT_KIT_CANNOT_DELETE_ID_ERROR = 4587584; const ERR_OSACCOUNT_KIT_CANNOT_DELETE_ID_ERROR = 4587581;
describe('ActsOsAccountSystemTest', function () { describe('ActsOsAccountSystemTest', function () {
/* /*
...@@ -605,6 +605,7 @@ describe('ActsOsAccountSystemTest', function () { ...@@ -605,6 +605,7 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>second createOsAccount OsAccountInfo:" + JSON.stringify(accountInfoSec)); console.debug("====>second createOsAccount OsAccountInfo:" + JSON.stringify(accountInfoSec));
var localIdSec = accountInfoSec.localId; var localIdSec = accountInfoSec.localId;
var serialNumSec = accountInfoSec.serialNumber; var serialNumSec = accountInfoSec.serialNumber;
await osAccountManager.removeOsAccount(localIdSec);
console.debug("====>first create localId: " + localIdFir + " second create localId: " + localIdSec); console.debug("====>first create localId: " + localIdFir + " second create localId: " + localIdSec);
console.debug("====>first create serialNumber: " + serialNumFir + " second serialNumber: " + serialNumSec); console.debug("====>first create serialNumber: " + serialNumFir + " second serialNumber: " + serialNumSec);
expect(localIdFir).assertEqual(localIdSec); expect(localIdFir).assertEqual(localIdSec);
......
...@@ -18,4 +18,5 @@ require('./OnOff.test.js') ...@@ -18,4 +18,5 @@ require('./OnOff.test.js')
require('./Set.test.js') require('./Set.test.js')
require('./Constraints.test.js') require('./Constraints.test.js')
require('./Photo.test.js') require('./Photo.test.js')
require('./Create.test.js') require('./Create.test.js')
\ No newline at end of file require('./Limit.test.js')
\ No newline at end of file
...@@ -16,7 +16,7 @@ import osaccount from '@ohos.account.osaccount' ...@@ -16,7 +16,7 @@ import osaccount from '@ohos.account.osaccount'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
const TIMEOUT = 1000; const TIMEOUT = 1000;
const ERR_OSACCOUNT_KIT_GET_OS_ACCOUNT_PROFILE_PHOTO_ERROR = 4587558; const ERR_OSACCOUNT_KIT_GET_OS_ACCOUNT_PROFILE_PHOTO_ERROR = 4587555;
describe('ActsOsAccountSystemTest', function () { describe('ActsOsAccountSystemTest', function () {
/* /*
......
...@@ -17,7 +17,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from ' ...@@ -17,7 +17,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
const TIMEOUT = 1000; const TIMEOUT = 1000;
const OSACCOUNTMAXNUMBER = 999; const OSACCOUNTMAXNUMBER = 999;
const ERR_OSACCOUNT_KIT_QUERY_OS_ACCOUNT_BY_ID_ERROR = 4587556; const ERR_OSACCOUNT_KIT_QUERY_OS_ACCOUNT_BY_ID_ERROR = 4587553;
describe('ActsOsAccountSystemTest', function () { describe('ActsOsAccountSystemTest', function () {
/* /*
...@@ -377,7 +377,7 @@ describe('ActsOsAccountSystemTest', function () { ...@@ -377,7 +377,7 @@ describe('ActsOsAccountSystemTest', function () {
/* /*
* @tc.number : ActsOsAccountQuery_1600 * @tc.number : ActsOsAccountQuery_1600
* @tc.name : queryMaxOsAccountNumber callback * @tc.name : queryMaxOsAccountNumber promise
* @tc.desc : Query the maximum number of users that can be created on the device * @tc.desc : Query the maximum number of users that can be created on the device
*/ */
it('ActsOsAccountQuery_1600', 0, async function (done) { it('ActsOsAccountQuery_1600', 0, async function (done) {
...@@ -404,12 +404,12 @@ describe('ActsOsAccountSystemTest', function () { ...@@ -404,12 +404,12 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>queryCurrentOsAccount err:" + JSON.stringify(err)); console.debug("====>queryCurrentOsAccount err:" + JSON.stringify(err));
console.debug("====>queryCurrentOsAccount data:" + JSON.stringify(data)); console.debug("====>queryCurrentOsAccount data:" + JSON.stringify(data));
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(data.localId).assertEqual(0); expect(data.localId).assertEqual(100);
expect(data.type.ADMIN).assertEqual(0); expect(data.type.ADMIN).assertEqual(0);
var serialNumberStr = data.serialNumber.toString(); var serialNumberStr = data.serialNumber.toString();
var serialIntercept = serialNumberStr.substring(8); var serialIntercept = serialNumberStr.substring(8);
console.debug("====>truncate the last eight characters: " + serialIntercept); console.debug("====>truncate the last eight characters: " + serialIntercept);
expect(serialIntercept).assertEqual("00000000"); expect(serialIntercept).assertEqual("00000001");
expect(data.isCreateCompleted).assertTrue(); expect(data.isCreateCompleted).assertTrue();
console.debug("====>ActsOsAccountQuery_1700 end===="); console.debug("====>ActsOsAccountQuery_1700 end====");
done(); done();
...@@ -427,12 +427,12 @@ describe('ActsOsAccountSystemTest', function () { ...@@ -427,12 +427,12 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>get os AccountManager finish===="); console.debug("====>get os AccountManager finish====");
var data = await AccountManager.queryCurrentOsAccount(); var data = await AccountManager.queryCurrentOsAccount();
console.debug("====>queryCurrentOsAccount data:" + JSON.stringify(data)); console.debug("====>queryCurrentOsAccount data:" + JSON.stringify(data));
expect(data.localId).assertEqual(0); expect(data.localId).assertEqual(100);
expect(data.type.ADMIN).assertEqual(0); expect(data.type.ADMIN).assertEqual(0);
var serialNumberStr = data.serialNumber.toString(); var serialNumberStr = data.serialNumber.toString();
var serialIntercept = serialNumberStr.substring(8); var serialIntercept = serialNumberStr.substring(8);
console.debug("====>truncate the last eight characters: " + serialIntercept); console.debug("====>truncate the last eight characters: " + serialIntercept);
expect(serialIntercept).assertEqual("00000000"); expect(serialIntercept).assertEqual("00000001");
expect(data.isCreateCompleted).assertTrue(); expect(data.isCreateCompleted).assertTrue();
console.debug("====>ActsOsAccountQuery_1800 end===="); console.debug("====>ActsOsAccountQuery_1800 end====");
done(); done();
...@@ -462,7 +462,7 @@ describe('ActsOsAccountSystemTest', function () { ...@@ -462,7 +462,7 @@ describe('ActsOsAccountSystemTest', function () {
console.debug("====>queryCurrentOsAccount err:" + JSON.stringify(err)); console.debug("====>queryCurrentOsAccount err:" + JSON.stringify(err));
console.debug("====>queryCurrentOsAccount data:" + JSON.stringify(currentOsInfo)); console.debug("====>queryCurrentOsAccount data:" + JSON.stringify(currentOsInfo));
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(currentOsInfo.localId).assertEqual(0); expect(currentOsInfo.localId).assertEqual(100);
AccountManager.removeOsAccount(createLocalId, (err)=>{ AccountManager.removeOsAccount(createLocalId, (err)=>{
console.debug("====>remove localId: " + createLocalId + " err:" + JSON.stringify(err)); console.debug("====>remove localId: " + createLocalId + " err:" + JSON.stringify(err));
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
...@@ -491,7 +491,7 @@ describe('ActsOsAccountSystemTest', function () { ...@@ -491,7 +491,7 @@ describe('ActsOsAccountSystemTest', function () {
await AccountManager.activateOsAccount(createLocalId); await AccountManager.activateOsAccount(createLocalId);
var currentOsInfo = await AccountManager.queryCurrentOsAccount(); var currentOsInfo = await AccountManager.queryCurrentOsAccount();
console.debug("====>queryCurrentOsAccount:" + JSON.stringify(currentOsInfo)); console.debug("====>queryCurrentOsAccount:" + JSON.stringify(currentOsInfo));
expect(currentOsInfo.localId).assertEqual(0); expect(currentOsInfo.localId).assertEqual(100);
await AccountManager.removeOsAccount(createLocalId); await AccountManager.removeOsAccount(createLocalId);
console.debug("====>ActsOsAccountQuery_2000 end===="); console.debug("====>ActsOsAccountQuery_2000 end====");
done(); done();
......
...@@ -16,8 +16,8 @@ import osAccount from '@ohos.account.osAccount' ...@@ -16,8 +16,8 @@ import osAccount from '@ohos.account.osAccount'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
const TIMEOUT = 1000; const TIMEOUT = 1000;
const ERR_OSACCOUNT_KIT_SET_OS_ACCOUNT_NAME_ERROR = 4587564; const ERR_OSACCOUNT_KIT_SET_OS_ACCOUNT_NAME_ERROR = 4587561;
const ERR_OSACCOUNT_KIT_SET_OS_ACCOUNT_PROFILE_PHOTO_ERROR = 4587566; const ERR_OSACCOUNT_KIT_SET_OS_ACCOUNT_PROFILE_PHOTO_ERROR = 4587563;
describe('ActsOsAccountSystemTest', function () { describe('ActsOsAccountSystemTest', function () {
/* /*
......
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
core.init() core.init()
const configService = core.getDefaultService('config') const configService = core.getDefaultService('config')
this.timeout = 8000; this.timeout = 15000;
configService.setConfig(this) configService.setConfig(this)
require('../../../test/List.test') require('../../../test/List.test')
......
...@@ -16,7 +16,7 @@ import osaccount from '@ohos.account.osAccount' ...@@ -16,7 +16,7 @@ import osaccount from '@ohos.account.osAccount'
import bundle from '@ohos.bundle' import bundle from '@ohos.bundle'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
const ERR_OSACCOUNT_KIT_GET_OS_ACCOUNT_LOCAL_ID_FROM_UID_ERROR = 4587551; const ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR = 4653057;
describe('ActsOsAccountThirdPartyTest', function () { describe('ActsOsAccountThirdPartyTest', function () {
/* /*
...@@ -36,7 +36,7 @@ describe('ActsOsAccountThirdPartyTest', function () { ...@@ -36,7 +36,7 @@ describe('ActsOsAccountThirdPartyTest', function () {
console.debug("====>get localId err: " + JSON.stringify(err)); console.debug("====>get localId err: " + JSON.stringify(err));
console.debug("====>localId obtained by uid:" + localId); console.debug("====>localId obtained by uid:" + localId);
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(localId).assertEqual(0); expect(localId).assertEqual(100);
console.debug("====>ActsOsAccountGetIdFormUid_0100 end===="); console.debug("====>ActsOsAccountGetIdFormUid_0100 end====");
done(); done();
}); });
...@@ -57,7 +57,7 @@ describe('ActsOsAccountThirdPartyTest', function () { ...@@ -57,7 +57,7 @@ describe('ActsOsAccountThirdPartyTest', function () {
console.debug("====>obtained uid:" + uid); console.debug("====>obtained uid:" + uid);
var localId = await osAccountManager.getOsAccountLocalIdFromUid(uid); var localId = await osAccountManager.getOsAccountLocalIdFromUid(uid);
console.debug("====>localId obtained by uid:" + localId); console.debug("====>localId obtained by uid:" + localId);
expect(localId).assertEqual(0); expect(localId).assertEqual(100);
console.debug("====>ActsOsAccountGetIdFormUid_0200 end===="); console.debug("====>ActsOsAccountGetIdFormUid_0200 end====");
done(); done();
}); });
...@@ -75,7 +75,7 @@ describe('ActsOsAccountThirdPartyTest', function () { ...@@ -75,7 +75,7 @@ describe('ActsOsAccountThirdPartyTest', function () {
osAccountManager.getOsAccountLocalIdFromUid(incorrectUid, (err, localId)=>{ osAccountManager.getOsAccountLocalIdFromUid(incorrectUid, (err, localId)=>{
console.debug("====>get localId err: " + JSON.stringify(err)); console.debug("====>get localId err: " + JSON.stringify(err));
console.debug("====>localId obtained by uid:" + localId); console.debug("====>localId obtained by uid:" + localId);
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_GET_OS_ACCOUNT_LOCAL_ID_FROM_UID_ERROR); expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR);
expect(localId).assertEqual(0); expect(localId).assertEqual(0);
console.debug("====>ActsOsAccountGetIdFormUid_0300 end===="); console.debug("====>ActsOsAccountGetIdFormUid_0300 end====");
done(); done();
...@@ -96,7 +96,7 @@ describe('ActsOsAccountThirdPartyTest', function () { ...@@ -96,7 +96,7 @@ describe('ActsOsAccountThirdPartyTest', function () {
await osAccountManager.getOsAccountLocalIdFromUid(incorrectUid); await osAccountManager.getOsAccountLocalIdFromUid(incorrectUid);
}catch(err){ }catch(err){
console.debug("====>get localId by uid err:" +JSON.stringify(err)); console.debug("====>get localId by uid err:" +JSON.stringify(err));
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_GET_OS_ACCOUNT_LOCAL_ID_FROM_UID_ERROR); expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR);
console.debug("====>ActsOsAccountGetIdFormUid_0400 end===="); console.debug("====>ActsOsAccountGetIdFormUid_0400 end====");
done(); done();
} }
...@@ -115,7 +115,7 @@ describe('ActsOsAccountThirdPartyTest', function () { ...@@ -115,7 +115,7 @@ describe('ActsOsAccountThirdPartyTest', function () {
osAccountManager.getOsAccountLocalIdFromUid(incorrectUid, (err, localId)=>{ osAccountManager.getOsAccountLocalIdFromUid(incorrectUid, (err, localId)=>{
console.debug("====>get localId err: " + JSON.stringify(err)); console.debug("====>get localId err: " + JSON.stringify(err));
console.debug("====>localId obtained by uid:" + localId); console.debug("====>localId obtained by uid:" + localId);
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_GET_OS_ACCOUNT_LOCAL_ID_FROM_UID_ERROR); expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR);
expect(localId).assertEqual(0); expect(localId).assertEqual(0);
console.debug("====>ActsOsAccountGetIdFormUid_0500 end===="); console.debug("====>ActsOsAccountGetIdFormUid_0500 end====");
done(); done();
...@@ -136,7 +136,7 @@ describe('ActsOsAccountThirdPartyTest', function () { ...@@ -136,7 +136,7 @@ describe('ActsOsAccountThirdPartyTest', function () {
await osAccountManager.getOsAccountLocalIdFromUid(incorrectUid); await osAccountManager.getOsAccountLocalIdFromUid(incorrectUid);
}catch(err){ }catch(err){
console.debug("====>get localId by uid err:" +JSON.stringify(err)); console.debug("====>get localId by uid err:" +JSON.stringify(err));
expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_GET_OS_ACCOUNT_LOCAL_ID_FROM_UID_ERROR); expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR);
console.debug("====>ActsOsAccountGetIdFormUid_0600 end===="); console.debug("====>ActsOsAccountGetIdFormUid_0600 end====");
done(); done();
} }
...@@ -155,7 +155,7 @@ describe('ActsOsAccountThirdPartyTest', function () { ...@@ -155,7 +155,7 @@ describe('ActsOsAccountThirdPartyTest', function () {
console.debug("====>get localId err: " + JSON.stringify(err)); console.debug("====>get localId err: " + JSON.stringify(err));
console.debug("====>localId obtained by process:" + localId); console.debug("====>localId obtained by process:" + localId);
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(localId).assertEqual(0); expect(localId).assertEqual(100);
console.debug("====>ActsOsAccountGetIdFormProcess_0100 end===="); console.debug("====>ActsOsAccountGetIdFormProcess_0100 end====");
done(); done();
}); });
...@@ -172,7 +172,7 @@ describe('ActsOsAccountThirdPartyTest', function () { ...@@ -172,7 +172,7 @@ describe('ActsOsAccountThirdPartyTest', function () {
console.debug("====>get AccountManager finish===="); console.debug("====>get AccountManager finish====");
var localId = await osAccountManager.getOsAccountLocalIdFromProcess(); var localId = await osAccountManager.getOsAccountLocalIdFromProcess();
console.debug("====>localId obtained by process:" + localId); console.debug("====>localId obtained by process:" + localId);
expect(localId).assertEqual(0); expect(localId).assertEqual(100);
console.debug("====>ActsOsAccountGetIdFormProcess_0200 end===="); console.debug("====>ActsOsAccountGetIdFormProcess_0200 end====");
done(); done();
}); });
......
...@@ -16,8 +16,8 @@ import osAccount from '@ohos.account.osAccount' ...@@ -16,8 +16,8 @@ import osAccount from '@ohos.account.osAccount'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
const TIMEOUT = 1000; const TIMEOUT = 1000;
const ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR = 4587545; const ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR = 4587542;
const ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR = 4587548; const ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR = 4587545;
describe('ActsOsAccountThirdPartyTest', function () { describe('ActsOsAccountThirdPartyTest', function () {
/* /*
...@@ -33,7 +33,7 @@ describe('ActsOsAccountThirdPartyTest', function () { ...@@ -33,7 +33,7 @@ describe('ActsOsAccountThirdPartyTest', function () {
console.debug("====>getDistributedVirtualDeviceId err:" + JSON.stringify(err)); console.debug("====>getDistributedVirtualDeviceId err:" + JSON.stringify(err));
console.debug("====>getDistributedVirtualDeviceId deviceId:" + deviceId); console.debug("====>getDistributedVirtualDeviceId deviceId:" + deviceId);
expect(err.code).assertEqual(0); expect(err.code).assertEqual(0);
expect(deviceId).assertEqual("0"); expect(deviceId).assertEqual("");
console.debug("====>ActsOsAccountDeviceId_0100 end===="); console.debug("====>ActsOsAccountDeviceId_0100 end====");
done(); done();
}) })
...@@ -57,7 +57,7 @@ describe('ActsOsAccountThirdPartyTest', function () { ...@@ -57,7 +57,7 @@ describe('ActsOsAccountThirdPartyTest', function () {
done(); done();
} }
console.debug("====>getDistributedVirtualDeviceId:" + deviceId); console.debug("====>getDistributedVirtualDeviceId:" + deviceId);
expect(deviceId).assertEqual("0"); expect(deviceId).assertEqual("");
console.debug("====>ActsOsAccountDeviceId_0200 end===="); console.debug("====>ActsOsAccountDeviceId_0200 end====");
done(); done();
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册