Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a2e46e9f
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a2e46e9f
编写于
11月 09, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6440 【杂散】【上传下载】新增4个未覆盖用例
Merge pull request !6440 from 张育帅/master
上级
1b859b2f
1f143934
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
149 addition
and
1 deletion
+149
-1
request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets
...st_Stage/entry/src/main/ets/test/requestDownload.test.ets
+88
-1
request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets
...Test_Stage/entry/src/main/ets/test/requestUpload.test.ets
+61
-0
未找到文件。
request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets
浏览文件 @
a2e46e9f
...
...
@@ -115,6 +115,93 @@ export default function requestDownloadJSUnit() {
console.info("====>------------------SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 end-----------------------");
done();
},5000)
});
});
/**
* @tc.number SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001
* @tc.desc Starts a download session.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001 is starting-----------------------");
let downloadFilePath = `${globalThis.abilityContext.tempDir}/test.txt`
console.debug("downloadFileConfig:" + `${globalThis.abilityContext.tempDir}/test.txt`)
let downloadFileConfig = {
url: 'http://download.ci.openharmony.cn/version/Daily_Version/',
header: {
headers: 'http'
},
enableMetered: false,
enableRoaming: false,
description: 'XTS download test!',
networkType: request.NETWORK_WIFI,
filePath: downloadFilePath,
title: 'XTS download test!',
background: true
}
try {
request.downloadFile(globalThis.abilityContext, downloadFileConfig, (err, data)=>{
downloadTask = data;
console.info("SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001 downloadTask: " + downloadTask);
try{
expect(true).assertEqual(downloadTask != undefined);
}catch(e){
console.info("SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001 except error: " + e);
}
});
} catch (err) {
console.error("SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001 error: " + err);
expect().assertFail();
}
console.info("-----------------------SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001 end-----------------------");
done();
});
/**
* @tc.number SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001
* @tc.desc Starts a download session.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001 is starting-----------------------");
let downloadFilePath = `${globalThis.abilityContext.tempDir}/test.txt`
console.debug("downloadFileConfig:" + `${globalThis.abilityContext.tempDir}/test.txt`)
let downloadFileConfig = {
url: 'http://download.ci.openharmony.cn/version/Daily_Version/',
header: {
headers: 'http'
},
enableMetered: false,
enableRoaming: false,
description: 'XTS download test!',
networkType: request.NETWORK_WIFI,
filePath: downloadFilePath,
title: 'XTS download test!',
background: true
}
try{
request.downloadFile(globalThis.abilityContext, downloadFileConfig).then(data => {
downloadTask = data;
console.info("SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001 downloadTask: " + downloadTask);
try{
expect(true).assertEqual(downloadTask != undefined);
}catch(e){
console.info("SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001 except error: " + e);
}
}).catch(err => {
console.error("SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001 error: " + err);
expect().assertFail();
})
}catch(err){
console.error("SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001 catch error: " + err);
}
console.info("-----------------------SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001 end-----------------------");
done();
});
});
}
\ No newline at end of file
request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets
浏览文件 @
a2e46e9f
...
...
@@ -268,5 +268,66 @@ export default function requestUploadJSUnit() {
done();
}, 10000)
});
/**
* @tc.number SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001
* @tc.desc Starts a upload task.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 is starting-----------------------");
try {
request.uploadFile(globalThis.abilityContext, uploadConfig, (err, data)=>{
uploadTask = data;
console.info("SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 uploadFile: " + uploadTask);
try{
expect(true).assertEqual(uploadTask != undefined);
}catch(e){
console.info("SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 except error: " + e);
}
});
} catch (err) {
console.error("SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 error: " + err);
expect().assertFail();
};
setTimeout(()=>{
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 end-----------------------");
done();
}, 10000);
});
/**
* @tc.number SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001
* @tc.desc Starts a upload task.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 is starting-----------------------");
try{
request.uploadFile(globalThis.abilityContext, uploadConfig).then(data => {
uploadTask = data;
console.info("SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 uploadFile: " + uploadTask);
try{
expect(true).assertEqual(uploadTask != undefined);
}catch(e){
console.info("SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 except error: " + e);
}
}).catch(err => {
console.error("SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 error: " + err);
expect().assertFail();
})
}catch(err){
console.error("SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 catch error: " + err);
}
setTimeout(()=>{
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 end-----------------------");
done();
}, 10000);
});
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录