Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9a3f96c7
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看板
未验证
提交
9a3f96c7
编写于
6月 27, 2023
作者:
O
openharmony_ci
提交者:
Gitee
6月 27, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9095 增加用例兼容性
Merge pull request !9095 from 姜欢欢/OpenHarmony-3.2-Release
上级
94f11e98
cf67902e
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
95 addition
and
75 deletion
+95
-75
telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/test/Http.fetch.test.js
...ger_base/system_fetch/src/main/js/test/Http.fetch.test.js
+95
-75
未找到文件。
telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/test/Http.fetch.test.js
浏览文件 @
9a3f96c7
...
...
@@ -29,17 +29,17 @@ export default function Telephony_NetStack_HttpFetchTest() {
fetch
.
fetch
({
url
:
"
https://httpbin.org/anything
"
,
success
:
function
(
data
){
console
.
info
(
"
NetStack fetch success
"
+
JSON
.
stringify
(
data
))
expect
(
data
.
code
===
200
).
assertTrue
()
console
.
info
(
"
NetStack fetch success
"
+
JSON
.
stringify
(
data
))
;
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
done
();
},
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
expect
().
assertFail
()
done
()
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
;
done
()
;
},
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
})
});
...
...
@@ -53,18 +53,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
fetch
.
fetch
({
url
:
"
https://httpbin.org/user-agent
"
,
success
:
function
(
data
){
console
.
info
(
"
NetStack fetch success
"
+
JSON
.
stringify
(
data
))
expect
(
data
.
code
===
200
).
assertTrue
()
console
.
info
(
"
NetStack fetch success
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
if
(
data
.
code
===
200
)
{
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
user-agent
"
]
==
"
libcurl-agent/1.0
"
).
assertTrue
();
}
done
();
},
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
expect
().
assertFail
()
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
;
done
();
},
complete
:
function
(){
console
.
info
(
"
NetStack fetch complete
"
)
console
.
info
(
"
NetStack fetch complete
"
)
;
}
})
});
...
...
@@ -79,18 +81,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
url
:
"
https://httpbin.org/user-agent
"
,
responseType
:
"
json
"
,
success
:
function
(
data
){
console
.
info
(
"
NetStack fetch success
"
+
JSON
.
stringify
(
data
))
expect
(
data
.
code
===
200
).
assertTrue
()
console
.
info
(
"
NetStack fetch success
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
if
(
data
.
code
===
200
)
{
expect
(
data
.
data
[
"
user-agent
"
]
==
"
libcurl-agent/1.0
"
).
assertTrue
();
}
done
();
},
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
expect
().
assertFail
()
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
;
done
();
},
complete
:
function
(){
console
.
info
(
"
NetStack fetch complete
"
)
console
.
info
(
"
NetStack fetch complete
"
)
;
}
})
});
...
...
@@ -104,18 +108,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
fetch
.
fetch
({
url
:
"
https://httpbin.org/headers
"
,
success
:
function
(
data
){
console
.
info
(
"
NetStack Fetch Success
"
+
JSON
.
stringify
(
data
))
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
headers
"
][
"
Content-Type
"
]
===
"
application/json
"
).
assertTrue
()
console
.
info
(
"
NetStack Fetch Success
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
if
(
data
.
code
===
200
)
{
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
headers
"
][
"
Content-Type
"
]
===
"
application/json
"
).
assertTrue
();
}
done
();
},
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
expect
().
assertFail
()
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
;
done
();
},
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
})
});
...
...
@@ -130,18 +136,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
url
:
"
https://httpbin.org/headers
"
,
responseType
:
"
json
"
,
success
:
function
(
data
){
console
.
info
(
"
NetStack Fetch Success
"
+
JSON
.
stringify
(
data
))
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
data
.
data
[
"
headers
"
][
"
Content-Type
"
]
===
"
application/json
"
).
assertTrue
()
console
.
info
(
"
NetStack Fetch Success
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
if
(
data
.
code
===
200
)
{
expect
(
data
.
data
[
"
headers
"
][
"
Content-Type
"
]
===
"
application/json
"
).
assertTrue
();
}
done
();
},
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
expect
().
assertFail
()
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
;
done
();
},
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
})
});
...
...
@@ -157,18 +165,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
method
:
"
POST
"
,
data
:
"
MineMine
"
,
success
:
function
(
data
){
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
))
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
data
"
]
===
"
MineMine
"
).
assertTrue
()
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
if
(
data
.
code
===
200
)
{
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
data
"
]
===
"
MineMine
"
).
assertTrue
();
}
done
();
},
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
expect
().
assertFail
()
done
()
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
;
done
()
;
},
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
})
});
...
...
@@ -185,18 +195,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
data
:
"
MineMine
"
,
responseType
:
"
json
"
,
success
:
function
(
data
){
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
))
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
data
.
data
[
"
data
"
]
===
"
MineMine
"
).
assertTrue
()
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
if
(
data
.
code
===
200
)
{
expect
(
data
.
data
[
"
data
"
]
===
"
MineMine
"
).
assertTrue
();
}
done
();
},
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
expect
().
assertFail
()
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
;
done
();
},
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
})
});
...
...
@@ -212,18 +224,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
method
:
"
PUT
"
,
data
:
"
MineMine
"
,
success
:
function
(
data
){
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
))
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
data
"
]
===
"
MineMine
"
).
assertTrue
()
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
if
(
data
.
code
===
200
)
{
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
data
"
]
===
"
MineMine
"
).
assertTrue
();
}
done
();
},
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
expect
().
assertFail
()
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
;
done
();
},
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
})
});
...
...
@@ -240,18 +254,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
data
:
"
MineMine
"
,
responseType
:
"
json
"
,
success
:
function
(
data
){
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
))
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
data
.
data
[
"
data
"
]
===
"
MineMine
"
).
assertTrue
()
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
));
if
(
data
.
code
===
200
)
{
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
expect
(
data
.
data
[
"
data
"
]
===
"
MineMine
"
).
assertTrue
();
}
done
();
},
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
expect
().
assertFail
()
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
;
done
();
},
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
})
});
...
...
@@ -269,21 +285,23 @@ export default function Telephony_NetStack_HttpFetchTest() {
"
name2
"
:
"
mine2
"
,
},
success
:
function
(
data
){
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
))
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
key1
"
]
===
"
val1
"
).
assertTrue
()
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
key2
"
]
===
"
val2
"
).
assertTrue
()
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
name1
"
]
===
"
mine1
"
).
assertTrue
()
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
name2
"
]
===
"
mine2
"
).
assertTrue
()
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
if
(
data
.
code
===
200
)
{
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
key1
"
]
===
"
val1
"
).
assertTrue
();
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
key2
"
]
===
"
val2
"
).
assertTrue
();
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
name1
"
]
===
"
mine1
"
).
assertTrue
();
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
name2
"
]
===
"
mine2
"
).
assertTrue
();
}
done
();
},
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
expect
().
assertFail
()
done
()
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
;
done
()
;
},
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
})
});
...
...
@@ -302,21 +320,23 @@ export default function Telephony_NetStack_HttpFetchTest() {
},
responseType
:
"
json
"
,
success
:
function
(
data
){
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
))
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
data
.
data
[
"
key1
"
]
===
"
val1
"
).
assertTrue
()
expect
(
data
.
data
[
"
key2
"
]
===
"
val2
"
).
assertTrue
()
expect
(
data
.
data
[
"
name1
"
]
===
"
mine1
"
).
assertTrue
()
expect
(
data
.
data
[
"
name2
"
]
===
"
mine2
"
).
assertTrue
()
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
if
(
data
.
code
===
200
)
{
expect
(
data
.
data
[
"
key1
"
]
===
"
val1
"
).
assertTrue
();
expect
(
data
.
data
[
"
key2
"
]
===
"
val2
"
).
assertTrue
();
expect
(
data
.
data
[
"
name1
"
]
===
"
mine1
"
).
assertTrue
();
expect
(
data
.
data
[
"
name2
"
]
===
"
mine2
"
).
assertTrue
();
}
done
();
},
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
expect
().
assertFail
()
done
()
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
;
done
()
;
},
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
})
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录