提交 03aeaed7 编写于 作者: F fangyun

update xts because of interface changing

Signed-off-by: Nfangyun <fangyun2@huawei.com>
上级 9a844530
...@@ -31,17 +31,16 @@ export default function edmCallbackTest() { ...@@ -31,17 +31,16 @@ export default function edmCallbackTest() {
it('enableAdmin_test_002', 0, async function (done) { it('enableAdmin_test_002', 0, async function (done) {
await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, OnReceiveEvent); enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, OnReceiveEvent);
async function OnReceiveEvent(err, datainfo) { async function OnReceiveEvent(err) {
console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.');
expect(datainfo).assertTrue(); expect(err == null).assertTrue();
var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1);
console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled);
expect(isEnabled).assertTrue(); expect(isEnabled).assertTrue();
var retValue = await enterpriseDeviceManager.disableAdmin(WANT1); await enterpriseDeviceManager.disableAdmin(WANT1);
console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1);
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
...@@ -58,17 +57,16 @@ export default function edmCallbackTest() { ...@@ -58,17 +57,16 @@ export default function edmCallbackTest() {
it('enableAdmin_test_004', 0, async function (done) { it('enableAdmin_test_004', 0, async function (done) {
await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, OnReceiveEvent); enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, OnReceiveEvent);
async function OnReceiveEvent(err, datainfo) { async function OnReceiveEvent(err) {
console.log('enterpriseDeviceManager.enableAdmin : ' + retValue); console.log('enterpriseDeviceManager.enableAdmin.');
expect(datainfo).assertTrue(); expect(err == null).assertTrue();
var isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); var isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.isSuperAdmin :' + isEnabled); console.log('enterpriseDeviceManager.isSuperAdmin :' + isEnabled);
expect(isEnabled).assertTrue(); expect(isEnabled).assertTrue();
var retValue = await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.disableSuperAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableSuperAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.isSuperAdmin : ' + isEnabled); console.log('enterpriseDeviceManager.isSuperAdmin : ' + isEnabled);
...@@ -85,17 +83,16 @@ export default function edmCallbackTest() { ...@@ -85,17 +83,16 @@ export default function edmCallbackTest() {
it('enableAdmin_test_008', 0, async function (done) { it('enableAdmin_test_008', 0, async function (done) {
await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID, OnReceiveEvent); enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID, OnReceiveEvent);
async function OnReceiveEvent(err, datainfo) { async function OnReceiveEvent(err) {
console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.');
expect(datainfo).assertTrue(); expect(err == null).assertTrue();
var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled);
expect(isEnabled).assertTrue(); expect(isEnabled).assertTrue();
var retValue = await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID);
console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
...@@ -112,17 +109,16 @@ export default function edmCallbackTest() { ...@@ -112,17 +109,16 @@ export default function edmCallbackTest() {
it('enableAdmin_test_012', 0, async function (done) { it('enableAdmin_test_012', 0, async function (done) {
await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID, OnReceiveEvent); enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID, OnReceiveEvent);
async function OnReceiveEvent(err, datainfo) { async function OnReceiveEvent(err) {
console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.');
expect(datainfo).assertTrue(); expect(err == null).assertTrue();
var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled);
expect(isEnabled).assertTrue(); expect(isEnabled).assertTrue();
var retValue = await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID);
console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
...@@ -139,17 +135,16 @@ export default function edmCallbackTest() { ...@@ -139,17 +135,16 @@ export default function edmCallbackTest() {
it('enableAdmin_test_013', 0, async function (done) { it('enableAdmin_test_013', 0, async function (done) {
await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID, OnReceiveEvent); enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID, OnReceiveEvent);
async function OnReceiveEvent(err, datainfo) { async function OnReceiveEvent(err) {
console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.');
expect(datainfo).assertTrue(); expect(err == null).assertTrue();
var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled);
expect(isEnabled).assertFalse(); expect(isEnabled).assertFalse();
var retValue = await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID);
console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
...@@ -166,9 +161,9 @@ export default function edmCallbackTest() { ...@@ -166,9 +161,9 @@ export default function edmCallbackTest() {
it('enableAdmin_test_014', 0, async function (done) { it('enableAdmin_test_014', 0, async function (done) {
await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID, OnReceiveEvent); enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID, OnReceiveEvent);
async function OnReceiveEvent(err, datainfo) { async function OnReceiveEvent(err) {
console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.');
expect(datainfo).assertTrue(); expect(err == null).assertTrue();
var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled);
...@@ -186,9 +181,8 @@ export default function edmCallbackTest() { ...@@ -186,9 +181,8 @@ export default function edmCallbackTest() {
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
expect(isEnabled).assertTrue(); expect(isEnabled).assertTrue();
retValue = await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID);
console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
...@@ -203,26 +197,24 @@ export default function edmCallbackTest() { ...@@ -203,26 +197,24 @@ export default function edmCallbackTest() {
* @tc.desc set enterprise info in callback mode * @tc.desc set enterprise info in callback mode
*/ */
it('setEnterpriseInfo_test_002', 0, async function (done) { it('setEnterpriseInfo_test_002', 0, async function (done) {
var retValue = await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL); enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL);
console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL : ' + retValue); console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.');
expect(retValue).assertTrue();
var isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT);
expect(isEnabled).assertTrue(); expect(isEnabled).assertTrue();
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
await enterpriseDeviceManager.setEnterpriseInfo(SELFWANT, ENTINFO2, OnReceiveEvent); await enterpriseDeviceManager.setEnterpriseInfo(SELFWANT, ENTINFO2, OnReceiveEvent);
async function OnReceiveEvent(err, datainfo) { async function OnReceiveEvent(err) {
console.log('enterpriseDeviceManager.setEnterpriseInfo : ' + datainfo); console.log('enterpriseDeviceManager.setEnterpriseInfo.');
expect(datainfo).assertTrue(); expect(err == null).assertTrue();
var entInfo = await enterpriseDeviceManager.getEnterpriseInfo(SELFWANT); var entInfo = await enterpriseDeviceManager.getEnterpriseInfo(SELFWANT);
expect(entInfo.name).assertEqual(COMPANYNAME2); expect(entInfo.name).assertEqual(COMPANYNAME2);
expect(entInfo.description).assertEqual(DESCRIPTION2); expect(entInfo.description).assertEqual(DESCRIPTION2);
retValue = await enterpriseDeviceManager.disableAdmin(SELFWANT); await enterpriseDeviceManager.disableAdmin(SELFWANT);
console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT); isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT);
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
......
...@@ -27,18 +27,16 @@ export default function edmPromiseTest() { ...@@ -27,18 +27,16 @@ export default function edmPromiseTest() {
* @tc.desc enable admin in promise mode * @tc.desc enable admin in promise mode
*/ */
it('enableAdmin_test_001', 0, async function (done) { it('enableAdmin_test_001', 0, async function (done) {
var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL); enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL);
console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL : ' + retValue); console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.');
expect(retValue).assertTrue();
var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1);
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
expect(isEnabled).assertTrue(); expect(isEnabled).assertTrue();
retValue = await enterpriseDeviceManager.disableAdmin(WANT1); await enterpriseDeviceManager.disableAdmin(WANT1);
console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1);
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
...@@ -53,18 +51,16 @@ export default function edmPromiseTest() { ...@@ -53,18 +51,16 @@ export default function edmPromiseTest() {
*/ */
it('enableAdmin_test_003', 0, async function (done) { it('enableAdmin_test_003', 0, async function (done) {
console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER'); console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER');
var retValue = await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER); enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER);
console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER : ' + retValue); console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER.');
expect(retValue).assertTrue();
var isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); var isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.isSuperAdmin :' + isEnabled); console.log('enterpriseDeviceManager.isSuperAdmin :' + isEnabled);
expect(isEnabled).assertTrue(); expect(isEnabled).assertTrue();
retValue = await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.disableSuperAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableSuperAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.isSuperAdmin : ' + isEnabled); console.log('enterpriseDeviceManager.isSuperAdmin : ' + isEnabled);
...@@ -78,19 +74,17 @@ export default function edmPromiseTest() { ...@@ -78,19 +74,17 @@ export default function edmPromiseTest() {
* @tc.desc enable admin in multi-user * @tc.desc enable admin in multi-user
*/ */
it('enableAdmin_test_007', 0, async function (done) { it('enableAdmin_test_007', 0, async function (done) {
var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID);
console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL : ' + retValue); console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.');
expect(retValue).assertTrue();
var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
expect(isEnabled).assertTrue(); expect(isEnabled).assertTrue();
retValue = await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID);
console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
...@@ -104,9 +98,9 @@ export default function edmPromiseTest() { ...@@ -104,9 +98,9 @@ export default function edmPromiseTest() {
* @tc.desc enable admin in multi-user * @tc.desc enable admin in multi-user
*/ */
it('enableAdmin_test_009', 0, async function (done) { it('enableAdmin_test_009', 0, async function (done) {
var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, TEST_USER_ID, OnReceiveEvent); enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, TEST_USER_ID, OnReceiveEvent);
async function OnReceiveEvent(err, datainfo) { async function OnReceiveEvent(err) {
expect(err != null).assertTrue(); expect(err != null).assertTrue();
if (err) { if (err) {
// user exsit but super admin can only be enabled in user 100 // user exsit but super admin can only be enabled in user 100
...@@ -122,9 +116,9 @@ export default function edmPromiseTest() { ...@@ -122,9 +116,9 @@ export default function edmPromiseTest() {
* @tc.desc enable admin in multi-user * @tc.desc enable admin in multi-user
*/ */
it('enableAdmin_test_010', 0, async function (done) { it('enableAdmin_test_010', 0, async function (done) {
var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, ERR_USER_ID, OnReceiveEvent); enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, ERR_USER_ID, OnReceiveEvent);
async function OnReceiveEvent(err, datainfo) { async function OnReceiveEvent(err) {
expect(err != null).assertTrue(); expect(err != null).assertTrue();
if (err) { if (err) {
// user does not exsit // user does not exsit
...@@ -139,26 +133,24 @@ export default function edmPromiseTest() { ...@@ -139,26 +133,24 @@ export default function edmPromiseTest() {
* @tc.name test enableAdmin method in promise mode with test user id * @tc.name test enableAdmin method in promise mode with test user id
* @tc.desc enable admin in multi-user * @tc.desc enable admin in multi-user
*/ */
it('enableAdmin_test_011', 0, async function (done) { it('enableAdmin_test_011', 0, async function (done) {
var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID); enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID);
console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL : ' + retValue); console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.');
expect(retValue).assertTrue();
var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
expect(isEnabled).assertTrue(); expect(isEnabled).assertTrue();
retValue = await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID);
console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
expect(isEnabled).assertFalse(); expect(isEnabled).assertFalse();
done(); done();
}) })
/** /**
* @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0015 * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0015
...@@ -166,13 +158,13 @@ export default function edmPromiseTest() { ...@@ -166,13 +158,13 @@ export default function edmPromiseTest() {
* @tc.desc enable admin in multi-user * @tc.desc enable admin in multi-user
*/ */
it('enableAdmin_test_015', 0, async function (done) { it('enableAdmin_test_015', 0, async function (done) {
var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID);
await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID, OnReceiveEvent); enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID, OnReceiveEvent);
async function OnReceiveEvent(err, datainfo) { async function OnReceiveEvent(err) {
console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.');
expect(datainfo).assertTrue(); expect(err == null).assertTrue();
var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled);
...@@ -182,9 +174,8 @@ export default function edmPromiseTest() { ...@@ -182,9 +174,8 @@ export default function edmPromiseTest() {
console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled);
expect(isEnabled).assertTrue(); expect(isEnabled).assertTrue();
retValue = await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID);
console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
...@@ -194,9 +185,8 @@ export default function edmPromiseTest() { ...@@ -194,9 +185,8 @@ export default function edmPromiseTest() {
console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled);
expect(isEnabled).assertTrue(); expect(isEnabled).assertTrue();
retValue = await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID);
console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID);
console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled);
...@@ -211,17 +201,16 @@ export default function edmPromiseTest() { ...@@ -211,17 +201,16 @@ export default function edmPromiseTest() {
* @tc.desc enable and disable admin in multi-user * @tc.desc enable and disable admin in multi-user
*/ */
it('enableAdmin_test_0016', 0, async function (done) { it('enableAdmin_test_0016', 0, async function (done) {
var retValue = await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER); enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER);
console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER : ' + retValue); console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER.');
expect(retValue).assertTrue();
var isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); var isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.isSuperAdmin :' + isEnabled); console.log('enterpriseDeviceManager.isSuperAdmin :' + isEnabled);
expect(isEnabled).assertTrue(); expect(isEnabled).assertTrue();
try { try {
retValue = await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID); enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID);
} catch (error) { } catch (error) {
expect(error != null).assertTrue(); expect(error != null).assertTrue();
...@@ -232,9 +221,8 @@ export default function edmPromiseTest() { ...@@ -232,9 +221,8 @@ export default function edmPromiseTest() {
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
expect(isEnabled).assertFalse(); expect(isEnabled).assertFalse();
retValue = await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.disableSuperAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableSuperAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME);
console.log('enterpriseDeviceManager.isSuperAdmin : ' + isEnabled); console.log('enterpriseDeviceManager.isSuperAdmin : ' + isEnabled);
...@@ -248,26 +236,23 @@ export default function edmPromiseTest() { ...@@ -248,26 +236,23 @@ export default function edmPromiseTest() {
* @tc.desc set enterprise info in promise mode * @tc.desc set enterprise info in promise mode
*/ */
it('setEnterpriseInfo_test_001', 0, async function (done) { it('setEnterpriseInfo_test_001', 0, async function (done) {
var retValue = await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1,
enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL); enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL);
console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL : ' + retValue); console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.');
expect(retValue).assertTrue();
var isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT);
expect(isEnabled).assertTrue(); expect(isEnabled).assertTrue();
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
retValue = await enterpriseDeviceManager.setEnterpriseInfo(SELFWANT, ENTINFO2); await enterpriseDeviceManager.setEnterpriseInfo(SELFWANT, ENTINFO2);
console.log('enterpriseDeviceManager.setEnterpriseInfo : ' + retValue); console.log('enterpriseDeviceManager.setEnterpriseInfo.');
expect(retValue).assertTrue();
var entInfo = await enterpriseDeviceManager.getEnterpriseInfo(SELFWANT); var entInfo = await enterpriseDeviceManager.getEnterpriseInfo(SELFWANT);
expect(entInfo.name).assertEqual(COMPANYNAME2); expect(entInfo.name).assertEqual(COMPANYNAME2);
expect(entInfo.description).assertEqual(DESCRIPTION2); expect(entInfo.description).assertEqual(DESCRIPTION2);
retValue = await enterpriseDeviceManager.disableAdmin(SELFWANT); await enterpriseDeviceManager.disableAdmin(SELFWANT);
console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); console.log('enterpriseDeviceManager.disableAdmin.');
expect(retValue).assertTrue();
isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT); isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT);
console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled);
...@@ -299,8 +284,7 @@ export default function edmPromiseTest() { ...@@ -299,8 +284,7 @@ export default function edmPromiseTest() {
let dsmgr = await enterpriseDeviceManager.getDeviceSettingsManager(); let dsmgr = await enterpriseDeviceManager.getDeviceSettingsManager();
expect(dsmgr !== null).assertTrue(); expect(dsmgr !== null).assertTrue();
console.log('before setDateTime'); console.log('before setDateTime');
var setSuccess = await dsmgr.setDateTime(SELFWANT, 1526003846000); await dsmgr.setDateTime(SELFWANT, 1526003846000);
expect(setSuccess).assertTrue();
await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME);
done(); done();
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册