Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
56c27ee0
提交
56c27ee0
authored
5月 26, 2017
作者:
James Stanley
提交者:
Steven Allen
1月 24, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update unit tests to verify PUT API semantics
License: MIT Signed-off-by:
James Stanley
<
james@incoherency.co.uk
>
上级
1afb88c8
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
32 行增加
和
6 行删除
+32
-6
t0111-gateway-writeable.sh
test/sharness/t0111-gateway-writeable.sh
+32
-6
没有找到文件。
test/sharness/t0111-gateway-writeable.sh
浏览文件 @
56c27ee0
...
...
@@ -54,14 +54,12 @@ test_expect_success "We can HTTP GET file just created" '
test_cmp infile outfile
'
test_expect_success
"HTTP PUT empty directory"
'
test_expect_success
"HTTP PUT empty directory
fails
"
'
URL="http://localhost:$port/ipfs/$HASH_EMPTY_DIR/" &&
echo "PUT $URL" &&
curl -svX PUT "$URL" 2>curl_putEmpty.out &&
cat curl_putEmpty.out &&
grep "Ipfs-Hash: $HASH_EMPTY_DIR" curl_putEmpty.out &&
grep "Location: /ipfs/$HASH_EMPTY_DIR" curl_putEmpty.out &&
grep "HTTP/1.1 201 Created" curl_putEmpty.out
grep "HTTP/1.1 400 Bad Request" curl_putEmpty.out
'
test_expect_success
"HTTP GET empty directory"
'
...
...
@@ -97,7 +95,6 @@ test_expect_success "HTTP PUT file to append to existing hierarchy" '
HASH=$(expr "$LOCATION" : "< Location: /ipfs/\(.*\)/test/test.txt")
'
test_expect_success
"We can HTTP GET file just updated"
'
URL="http://localhost:$port/ipfs/$HASH/test/test.txt" &&
echo "GET $URL" &&
...
...
@@ -112,7 +109,11 @@ test_expect_success "Replacing a file with PUT gives us the hash of the new tree
curl -svX PUT --data-binary @infile3 "$URL" 2>curl_putExisting.out &&
grep "HTTP/1.1 201 Created" curl_putExisting.out &&
LOCATION=$(grep Location curl_putExisting.out) &&
HASH=$(expr "$LOCATION" : "< Location: /ipfs/\(.*\)/test/test.txt")
IPFS_HASH=$(grep Ipfs-Hash curl_putExisting.out) &&
HASH=$(expr "$LOCATION" : "< Location: /ipfs/\(.*\)/test/test.txt") &&
IPFS_HASH=$(expr "$IPFS_HASH" : "< Ipfs-Hash: \(\w*\)") &&
echo "$HASH -vs- $IPFS_HASH" > /home/jes/foo.log &&
[ "$HASH" = "$IPFS_HASH" ]
'
test_expect_success
"We can HTTP GET file just replaced"
'
...
...
@@ -122,6 +123,31 @@ test_expect_success "We can HTTP GET file just replaced" '
test_cmp infile3 outfile3
'
test_expect_success
"We can't PUT to a path ending with /"
'
URL="http://localhost:$port/ipfs/$HASH/test/" &&
echo "PUT $URL" &&
curl -svX PUT "$URL" 2>curl_putDirectoryFail.out &&
cat curl_putDirectoryFail.out &&
grep "HTTP/1.1 400 Bad Request" curl_putDirectoryFail.out
'
test_expect_success
"PUT to a directory replaces it with a file"
'
echo "$RANDOM" >infile4 &&
URL="http://localhost:$port/ipfs/$HASH/test" &&
echo "PUT $URL" &&
curl -svX PUT --data-binary @infile4 "$URL" 2>curl_putDirectory.out &&
grep "HTTP/1.1 201 Created" curl_putDirectory.out &&
LOCATION=$(grep Location curl_putDirectory.out) &&
HASH=$(expr "$LOCATION" : "< Location: /ipfs/\(.*\)/test")
'
test_expect_success
"We can HTTP GET directory just replaced"
'
URL="http://localhost:$port/ipfs/$HASH/test" &&
echo "GET $URL" &&
curl -svo outfile4 "$URL" 2>curl_getDirectory.out &&
test_cmp infile4 outfile4
'
test_kill_ipfs_daemon
test_done
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论