未验证 提交 9b361d5a 编写于 作者: O openharmony_ci 提交者: Gitee

!5515 电话子系统测试用例新增

Merge pull request !5515 from 李昊/master
...@@ -287,7 +287,7 @@ describe('SimManagerTest', function () { ...@@ -287,7 +287,7 @@ describe('SimManagerTest', function () {
const CASE_NAME = 'Telephony_Sim_isSimActive_Async_0700'; 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);
done(); done();
}); });
}); });
...@@ -307,7 +307,7 @@ describe('SimManagerTest', function () { ...@@ -307,7 +307,7 @@ describe('SimManagerTest', function () {
done(); done();
}).catch(err => { }).catch(err => {
console.info("isSimActive promise err info :" + JSON.stringify(err)); console.info("isSimActive promise err info :" + JSON.stringify(err));
expect(err.code).assertEqual("202"); expect(err.code).assertEqual(202);
done(); done();
}); });
}); });
...@@ -322,7 +322,7 @@ describe('SimManagerTest', function () { ...@@ -322,7 +322,7 @@ 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(202);
console.info(`${CASE_NAME} fail, err: ${err.message}`); console.info(`${CASE_NAME} fail, err: ${err.message}`);
done(); done();
return; return;
...@@ -342,7 +342,7 @@ describe('SimManagerTest', function () { ...@@ -342,7 +342,7 @@ 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(202);
console.info(`${CASE_NAME} fail, err: ${err.message}`); console.info(`${CASE_NAME} fail, err: ${err.message}`);
done(); done();
return; return;
...@@ -374,7 +374,7 @@ describe('SimManagerTest', function () { ...@@ -374,7 +374,7 @@ describe('SimManagerTest', function () {
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: ${err.message}`);
expect(err.code).assertEqual("202"); expect(err.code).assertEqual(202);
done(); done();
return; return;
} }
...@@ -395,7 +395,7 @@ describe('SimManagerTest', function () { ...@@ -395,7 +395,7 @@ describe('SimManagerTest', function () {
console.info(`${CASE_NAME} test finish.`); console.info(`${CASE_NAME} test finish.`);
} catch (err) { } catch (err) {
console.info(`${CASE_NAME} GetCardType error: ${err.message}`); console.info(`${CASE_NAME} GetCardType error: ${err.message}`);
expect(err.code).assertEqual("202"); expect(err.code).assertEqual(202);
} }
done(); done();
}); });
...@@ -411,7 +411,7 @@ describe('SimManagerTest', function () { ...@@ -411,7 +411,7 @@ describe('SimManagerTest', function () {
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: ${error.message}`);
expect().assertFail(); expect(error.code).assertEqual(202);
done(); done();
return; return;
} }
...@@ -435,10 +435,81 @@ describe('SimManagerTest', function () { ...@@ -435,10 +435,81 @@ describe('SimManagerTest', function () {
console.info(`${CASE_NAME} test finish.`); console.info(`${CASE_NAME} test finish.`);
} catch (error) { } catch (error) {
console.info(`${CASE_NAME} hasOperatorPrivileges error: ${error.message}`); console.info(`${CASE_NAME} hasOperatorPrivileges error: ${error.message}`);
expect().assertFail(); expect(error.code).assertEqual(202);
} }
done(); done();
}); });
/**
* @tc.number Telephony_Sim_getOpKey_CallBack_0100
* @tc.name Test getOpKey interface
* @tc.desc Obtains the opkey of the SIM card in a specified slot.Returns the opkey;
* returns "-1" if no SIM card is inserted or no opkey matched.
*/
it('Telephony_Sim_getOpKey_CallBack_0100', 0, async function (done) {
sim.getOpKey(0, (err, data) => {
console.info("Telephony_Sim_getOpKey_CallBack_0100 err = " + JSON.stringify(err) + " data = " + JSON.stringify(data));
if(err){
expect(err.code).assertEqual(-1);
done();
return;
}
done();
});
});
/**
* @tc.number Telephony_Sim_getOpKey_Promise_0100
* @tc.name Test getOpKey interface
* @tc.desc Obtains the opkey of the SIM card in a specified slot.Returns the opkey;
* returns "-1" if no SIM card is inserted or no opkey matched.
*/
it('Telephony_Sim_getOpKey_Promise_0100', 0, async function (done) {
let promise = sim.getOpKey(0);
promise.then(data => {
console.info("Telephony_Sim_getOpKey_Promise_0100 data = " + JSON.stringify(data));
done();
}).catch(err => {
console.info("Telephony_Sim_getOpKey_Promise_0100 err = " + JSON.stringify(err));
expect(err.code).assertEqual(-1);
done();
});
});
/**
* @tc.number Telephony_Sim_getOpName_CallBack_0100
* @tc.name Test getOpName interface
* @tc.desc Obtains the opname of the SIM card in a specified slot.
* returns null if no SIM card is inserted or no opname matched.
*/
it('Telephony_Sim_getOpName_CallBack_0100', 0, async function (done) {
sim.getOpName(0, (err, data) => {
console.info("Telephony_Sim_getOpName_CallBack_0100 err = " + JSON.stringify(err) + " data = " + JSON.stringify(data));
if(err){
expect(err.code).assertEqual(-1);
done();
return;
}
done();
});
});
/**
* @tc.number Telephony_Sim_getOpName_Promise_0100
* @tc.name Test getOpName interface
* @tc.desc Obtains the opname of the SIM card in a specified slot.
* returns null if no SIM card is inserted or no opname matched.
*/
it('Telephony_Sim_getOpName_Promise_0100', 0, async function (done) {
let promise = sim.getOpName(0);
promise.then(data => {
console.info("Telephony_Sim_getOpName_Promise_0100 data = " + JSON.stringify(data));
done();
}).catch(err => {
console.info("Telephony_Sim_getOpName_Promise_0100 err = " + JSON.stringify(err));
expect(err.code).assertEqual(-1);
done();
});
});
}) })
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册