未验证 提交 237e7187 编写于 作者: O openharmony_ci 提交者: Gitee

!7239 用例修改错误码

Merge pull request !7239 from zhangfuzhi/master
/** /**
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2022-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License") * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import network from '@system.network'; import network from '@system.network';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function Telephony_NetManager_NetWorkTest() { export default function Telephony_NetManager_NetWorkTest() {
describe("Telephony_NetManager_NetWorkTest", function () { describe("Telephony_NetManager_NetWorkTest", function () {
...@@ -31,13 +31,13 @@ describe("Telephony_NetManager_NetWorkTest", function () { ...@@ -31,13 +31,13 @@ describe("Telephony_NetManager_NetWorkTest", function () {
done(); done();
}, },
fail : function(data,code){ fail : function(data,code){
console.info("NetManager code "+ code) console.info("NetManager code "+ code);
expect(code == 602).assertTrue() expect(code == 201).assertTrue();
done(); done();
}, },
complete : function(){ complete : function(){
} }
}) });
}); });
/** /**
...@@ -48,17 +48,17 @@ describe("Telephony_NetManager_NetWorkTest", function () { ...@@ -48,17 +48,17 @@ describe("Telephony_NetManager_NetWorkTest", function () {
it("Telephony_NetManager_NetWorkTest_GetType_NoPermission_0200", 0, function (done) { it("Telephony_NetManager_NetWorkTest_GetType_NoPermission_0200", 0, function (done) {
network.getType({ network.getType({
success : function(data){ success : function(data){
expect().assertFail() expect().assertFail();
done(); done();
}, },
fail : function(data,code){ fail : function(data,code){
console.info("NetManager code "+ code) console.info("NetManager code "+ code);
expect(code == 602).assertTrue() expect(code == 201).assertTrue();
done(); done();
}, },
complete : function(){ complete : function(){
} }
}) });
}); });
/** /**
...@@ -69,16 +69,16 @@ describe("Telephony_NetManager_NetWorkTest", function () { ...@@ -69,16 +69,16 @@ describe("Telephony_NetManager_NetWorkTest", function () {
it("Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0100", 0, function (done) { it("Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0100", 0, function (done) {
network.subscribe({ network.subscribe({
success : function(data){ success : function(data){
expect().assertFail() expect().assertFail();
done(); done();
}, },
fail : function(data,code){ fail : function(data,code){
console.info("NetManager code "+ code) console.info("NetManager code "+ code);
expect(code == 602).assertTrue() expect(code == 201).assertTrue();
done(); done();
} }
}) });
}) });
/** /**
* @tc.number Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0200 * @tc.number Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0200
...@@ -88,16 +88,16 @@ describe("Telephony_NetManager_NetWorkTest", function () { ...@@ -88,16 +88,16 @@ describe("Telephony_NetManager_NetWorkTest", function () {
it("Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0200", 0, function (done) { it("Telephony_NetManager_NetWorkTest_Subscribe_NoPermission_0200", 0, function (done) {
network.subscribe({ network.subscribe({
success : function(data){ success : function(data){
expect().assertFail() expect().assertFail();
done(); done();
}, },
fail : function(data,code){ fail : function(data,code){
console.info("NetManager code "+ code) console.info("NetManager code "+ code);
expect(code == 602).assertTrue() expect(code == 201).assertTrue();
done(); done();
} }
}) });
}) });
}); });
} }
/** /**
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -268,7 +268,6 @@ describe('SimManagerTest', function () { ...@@ -268,7 +268,6 @@ describe('SimManagerTest', function () {
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_Sim_isSimActive_Async_0700', 0, async function (done) { it('Telephony_Sim_isSimActive_Async_0700', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_isSimActive_Async_0700';
sim.isSimActive(env.SLOTID2, (err, data) => { sim.isSimActive(env.SLOTID2, (err, data) => {
console.info("isSimActive async err info :" + JSON.stringify(err) + "data:" + JSON.stringify(data)); console.info("isSimActive async err info :" + JSON.stringify(err) + "data:" + JSON.stringify(data));
expect(err.code).assertEqual(202); expect(err.code).assertEqual(202);
...@@ -283,7 +282,6 @@ describe('SimManagerTest', function () { ...@@ -283,7 +282,6 @@ describe('SimManagerTest', function () {
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_Sim_isSimActive_Promise_0700', 0, async function (done) { it('Telephony_Sim_isSimActive_Promise_0700', 0, async function (done) {
const CASE_NAME = 'Telephony_Sim_isSimActive_Promise_0700';
let promise = sim.isSimActive(env.SLOTID2); let promise = sim.isSimActive(env.SLOTID2);
promise.then(data => { promise.then(data => {
console.log(`isSimActive success, promise: data->${JSON.stringify(data)}`); console.log(`isSimActive success, promise: data->${JSON.stringify(data)}`);
...@@ -306,12 +304,12 @@ describe('SimManagerTest', function () { ...@@ -306,12 +304,12 @@ describe('SimManagerTest', function () {
const CASE_NAME = 'Telephony_Sim_hasSimCard_Async_0600'; const CASE_NAME = 'Telephony_Sim_hasSimCard_Async_0600';
sim.hasSimCard(env.SLOTID2, (err, data) => { sim.hasSimCard(env.SLOTID2, (err, data) => {
if (err) { if (err) {
expect(err.code).assertEqual(202); expect(err.code).assertEqual(8300001);
console.info(`${CASE_NAME} fail, err: ${err.message}`); console.info(CASE_NAME +' fail, err: ' + JSON.stringify(err));
done(); done();
return; return;
} }
console.info(`${CASE_NAME} finish`); console.info(CASE_NAME + ' finish' + JSON.stringify(data));
}); });
}); });
...@@ -326,12 +324,12 @@ describe('SimManagerTest', function () { ...@@ -326,12 +324,12 @@ describe('SimManagerTest', function () {
try { try {
let data = await sim.hasSimCard(env.SLOTID2); let data = await sim.hasSimCard(env.SLOTID2);
} catch (err) { } catch (err) {
expect(err.code).assertEqual(202); expect(err.code).assertEqual(8300001);
console.info(`${CASE_NAME} fail, err: ${err.message}`); console.info(CASE_NAME +' fail, err: ' + JSON.stringify(err));
done(); done();
return; return;
} }
console.info(`${CASE_NAME} finish`); console.info(CASE_NAME + ' finish');
}); });
/** /**
...@@ -357,12 +355,14 @@ describe('SimManagerTest', function () { ...@@ -357,12 +355,14 @@ describe('SimManagerTest', function () {
const CASE_NAME = 'Telephony_Sim_GetCardType_Async_0400'; const CASE_NAME = 'Telephony_Sim_GetCardType_Async_0400';
sim.getCardType(env.SLOTID2, (err, cardType) => { sim.getCardType(env.SLOTID2, (err, cardType) => {
if (err) { if (err) {
console.info(`${CASE_NAME} GetCardType error: ${err.message}`); console.info(CASE_NAME + ' GetCardType error: ' + JSON.stringify(err));
expect(err.code).assertEqual(202); expect(err.code).assertEqual(8300001);
done(); done();
return; return;
} }
console.info(`${CASE_NAME} test finish.`); console.info(CASE_NAME + ' finish' + JSON.stringify(cardType));
expect().assertFail();
done();
}); });
}); });
...@@ -376,10 +376,10 @@ describe('SimManagerTest', function () { ...@@ -376,10 +376,10 @@ describe('SimManagerTest', function () {
const CASE_NAME = 'Telephony_Sim_GetCardType_Promise_0400'; const CASE_NAME = 'Telephony_Sim_GetCardType_Promise_0400';
try { try {
const cardType = await sim.getCardType(env.SLOTID2); const cardType = await sim.getCardType(env.SLOTID2);
console.info(`${CASE_NAME} test finish.`); console.info(CASE_NAME + ' finish');
} catch (err) { } catch (err) {
console.info(`${CASE_NAME} GetCardType error: ${err.message}`); console.info(CASE_NAME + ' GetCardType error: ' + JSON.stringify(err));
expect(err.code).assertEqual(202); expect(err.code).assertEqual(8300001);
} }
done(); done();
}); });
...@@ -394,13 +394,13 @@ describe('SimManagerTest', function () { ...@@ -394,13 +394,13 @@ describe('SimManagerTest', function () {
const CASE_NAME = 'Telephony_Sim_hasOperatorPrivileges_Async_0400'; const CASE_NAME = 'Telephony_Sim_hasOperatorPrivileges_Async_0400';
sim.hasOperatorPrivileges(env.SLOTID2, (error, result) => { sim.hasOperatorPrivileges(env.SLOTID2, (error, result) => {
if (error) { if (error) {
console.info(`${CASE_NAME} hasOperatorPrivileges error: ${error.message}`); console.info(CASE_NAME + 'hasOperatorPrivileges error: ' + JSON.stringify(error));
expect(error.code).assertEqual(202); expect(error.code).assertEqual(8300001);
done(); done();
return; return;
} }
expect(result).assertFalse(); console.info(CASE_NAME + ' finish' + JSON.stringify(result));
console.info(`${CASE_NAME} test finish.`); expect().assertFail();
done(); done();
}); });
}); });
...@@ -415,11 +415,12 @@ describe('SimManagerTest', function () { ...@@ -415,11 +415,12 @@ describe('SimManagerTest', function () {
const CASE_NAME = 'Telephony_Sim_hasOperatorPrivileges_Promise_0400'; const CASE_NAME = 'Telephony_Sim_hasOperatorPrivileges_Promise_0400';
try { try {
const result = await sim.hasOperatorPrivileges(env.SLOTID2); const result = await sim.hasOperatorPrivileges(env.SLOTID2);
expect(result).assertFalse(); console.info(CASE_NAME + ' finish' + JSON.stringify(result));
console.info(`${CASE_NAME} test finish.`); expect().assertFail();
done();
} catch (error) { } catch (error) {
console.info(`${CASE_NAME} hasOperatorPrivileges error: ${error.message}`); console.info(CASE_NAME + 'hasOperatorPrivileges error: ' + JSON.stringify(error));
expect(error.code).assertEqual(202); expect(error.code).assertEqual(8300001);
} }
done(); done();
}); });
......
...@@ -677,17 +677,17 @@ export default function ActsBaseCallManagerTest() { ...@@ -677,17 +677,17 @@ export default function ActsBaseCallManagerTest() {
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_CallManager_isEmergencyPhoneNumber_Async_0200', 0, async function (done) { it('Telephony_CallManager_isEmergencyPhoneNumber_Async_0200', 0, async function (done) {
let CASE_NAME = 'Telephony_CallManager_isEmergencyPhoneNumber_Async_0200';
call.isEmergencyPhoneNumber(INVALID_NUMBER, { call.isEmergencyPhoneNumber(INVALID_NUMBER, {
slotId: SLOT_0 slotId: SLOT_0
}, (err, data) => { }, (err, data) => {
if (err) { if (err) {
console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_0200 fail'); console.log(CASE_NAME + ' fail' + JSON.stringify(err));
expect().assertFail(); expect(err.code).assertEqual(8300001);
done(); done();
return; return;
} }
expect(data === false).assertTrue(); console.log(CASE_NAME +' finish data = '+ JSON.stringify(data));
console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_0200 finish data = ${data}`);
done(); done();
}); });
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册