未验证 提交 4b0a743c 编写于 作者: O openharmony_ci 提交者: Gitee

!4254 fail case update

Merge pull request !4254 from 高曦/master
......@@ -2,7 +2,7 @@
"description": "Function test of sim manager interface",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1800000",
"test-timeout": "900000",
"package": "com.ohos.dns",
"shell-timeout": "60000"
},
......
......@@ -2,7 +2,7 @@
"description": "Function test of sim manager interface",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1800000",
"test-timeout": "900000",
"package": "com.ohos.jshttp",
"shell-timeout": "60000"
},
......
......@@ -42,6 +42,7 @@ describe('Telephony_NETSTACK_HTTPTest',function(){
let http = netHttp.createHttp()
http.request("https://httpbin.org/user-agent").then(function(data){
expect(data.responseCode === netHttp.ResponseCode.OK).assertTrue();
console.info(JSON.stringify(data));
expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue();
done();
})
......
......@@ -2,7 +2,7 @@
"description": "Function test of sim manager interface",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1800000",
"test-timeout": "900000",
"package": "com.ohos.network_nopermission",
"shell-timeout": "60000"
},
......
......@@ -2,7 +2,7 @@
"description": "Function test of sim manager interface",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1800000",
"test-timeout": "900000",
"package": "com.ohos.network_wifi",
"shell-timeout": "60000"
},
......
......@@ -40,6 +40,9 @@
function sleepOther(timeout) {
for (var t = Date.now(); Date.now() - t <= timeout;) ;
}
function sleep(time) {
return new Promise((resolve)=>setTimeout(resolve,time));
}
/**
*@tc.number Telephony_NetworkManager_register_Async_0100
......@@ -229,13 +232,13 @@
console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId);
}
});
netConn.on('netBlockStatusChange', (error, value) => {
netConn.on('netCapabilitiesChange', (error, value) => {
if (error) {
console.info(`${caseName} register fail: ${error}`);
expect().assertFail();
done();
} else {
console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId);
console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId);
}
});
netConn.on('netConnectionPropertiesChange', (error, value) => {
......@@ -2497,7 +2500,7 @@
expect().assertFail();
done();
}
await sleep(1000);
done();
});
done();
......
......@@ -227,6 +227,14 @@ describe('Telephony_NETSTACK_SocketTest', function () {
it('Telephony_NetStack_UDPTest1200', 0, function (done) {
let udp = netSocket.constructUDPSocketInstance()
udp.on('message', function () {
})
udp.on('listening', function () {
})
udp.on('close', function () {
})
udp.on('error', function () {
})
udp.off('message', function () {
expect().assertFail()
done()
......@@ -246,9 +254,6 @@ describe('Telephony_NETSTACK_SocketTest', function () {
done()
});
/**
* @tc.number Telephony_NetStack_TCPTest0100
* @tc.name TCP bind,callback方式,预计无异常,错误码为undefined
......@@ -423,7 +428,7 @@ describe('Telephony_NETSTACK_SocketTest', function () {
expect().assertFail()
done()
})
tcp.on('listening', function () {
tcp.on('connect', function () {
expect().assertFail()
done()
})
......@@ -446,11 +451,19 @@ describe('Telephony_NETSTACK_SocketTest', function () {
it('Telephony_NetStack_TCPTest1200', 0, function (done) {
let tcp = netSocket.constructTCPSocketInstance()
tcp.on('message', function () {
})
tcp.on('connect', function () {
})
tcp.on('close', function () {
})
tcp.on('error', function () {
})
tcp.off('message', function () {
expect().assertFail()
done()
})
tcp.off('listening', function () {
tcp.off('connect', function () {
expect().assertFail()
done()
})
......
......@@ -2,7 +2,7 @@
"description": "Function test of sim manager interface",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1800000",
"test-timeout": "900000",
"package": "com.ohos.system_fetch",
"shell-timeout": "60000"
},
......
......@@ -18,7 +18,7 @@ import NetHttp from '@ohos.net.http';
import fetch from '@system.fetch';
import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index';
describe("Telephony_NetStack_HttpTest", function () {
describe("Telephony_NetStack_HttpFetchTest", function () {
/**
* @tc.number Telephony_NetStack_HttpTestBasicGet_0100
......@@ -44,7 +44,7 @@ describe("Telephony_NetStack_HttpTest", function () {
http.request("https://httpbin.org/user-agent").then(function(data){
console.info("NetStack "+ JSON.stringify(data));
expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue()
expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue()
expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue();
done();
})
});
......@@ -174,7 +174,7 @@ describe("Telephony_NetStack_HttpTest", function () {
success : function(data){
console.info("NetStack fetch success "+ JSON.stringify(data))
expect(data.code === 200).assertTrue()
expect(JSON.parse(data.data)["user-agent"] === "libcurl-agent/1.0").assertTrue()
expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue();
done();
},
fail : function(){
......@@ -200,7 +200,7 @@ describe("Telephony_NetStack_HttpTest", function () {
success : function(data){
console.info("NetStack fetch success "+ JSON.stringify(data))
expect(data.code === 200).assertTrue()
expect(data.data["user-agent"] === "libcurl-agent/1.0").assertTrue()
expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue();
done();
},
fail : function(){
......
......@@ -172,7 +172,7 @@ describe('ActsNetworkSearchTest', function () {
radio.getISOCountryCodeForNetwork(SLOT_2, (err, data) => {
if (err) {
console.info(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400 fail err: ${err}`);
expect(err.code).assertEqual("-1");
expect(err.code).assertEqual("202");
done();
return;
}
......@@ -196,7 +196,7 @@ describe('ActsNetworkSearchTest', function () {
expect(data.length === 0).assertTrue();
} catch (err) {
console.info(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400 fail err: ${err}`);
expect(err.code).assertEqual("-1");
expect(err.code).assertEqual("202");
done();
return;
}
......
......@@ -268,7 +268,7 @@ describe('SimManagerTest', function () {
const CASE_NAME = 'Telephony_Sim_isSimActive_Async_0700';
sim.isSimActive(env.SLOTID2, (err, data) => {
console.info("isSimActive async err info :" + JSON.stringify(err) + "data:" + JSON.stringify(data));
expect(err.code).assertEqual("-1");
expect(err.code).assertEqual("202");
done();
});
});
......@@ -288,7 +288,7 @@ describe('SimManagerTest', function () {
done();
}).catch(err => {
console.info("isSimActive promise err info :" + JSON.stringify(err));
expect(err.code).assertEqual("-1");
expect(err.code).assertEqual("202");
done();
});
});
......@@ -303,7 +303,7 @@ describe('SimManagerTest', function () {
const CASE_NAME = 'Telephony_Sim_hasSimCard_Async_0600';
sim.hasSimCard(env.SLOTID2, (err, data) => {
if (err) {
expect(err.code).assertEqual("-1");
expect(err.code).assertEqual("202");
console.info(`${CASE_NAME} fail, err: ${err.message}`);
done();
return;
......@@ -323,7 +323,7 @@ describe('SimManagerTest', function () {
try {
let data = await sim.hasSimCard(env.SLOTID2);
} catch (err) {
expect(err.code).assertEqual("-1");
expect(err.code).assertEqual("202");
console.info(`${CASE_NAME} fail, err: ${err.message}`);
done();
return;
......@@ -355,7 +355,7 @@ describe('SimManagerTest', function () {
sim.getCardType(env.SLOTID2, (err, cardType) => {
if (err) {
console.info(`${CASE_NAME} GetCardType error: ${err.message}`);
expect(err.code).assertEqual("-1");
expect(err.code).assertEqual("202");
done();
return;
}
......@@ -376,7 +376,7 @@ describe('SimManagerTest', function () {
console.info(`${CASE_NAME} test finish.`);
} catch (err) {
console.info(`${CASE_NAME} GetCardType error: ${err.message}`);
expect(err.code).assertEqual("-1");
expect(err.code).assertEqual("202");
}
done();
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册