Skip to content

Commit 17258ae

Browse files
committed
test: add test case for --archive-user and --archive-dir-user
1 parent 3385803 commit 17258ae

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/case/025.archive.bash

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cleanup() {
66

77
source "$root"/lib.bash
88

9-
"$ghfs" -l 3003 -r "$fs"/vhost2 --archive /a --archive-dir "$fs"/vhost2/b --archive /c --auth /c/sub &
9+
"$ghfs" -l 3003 -r "$fs"/vhost2 --archive /a --archive-dir "$fs"/vhost2/b --archive /c --auth /c/sub -a :/hello:"$fs"/vhost1/hello -a :/world:"$fs"/vhost1/world --archive-user :/hello:alice --archive-dir-user :"$fs"/vhost1/world:bob --user alice:AliceSecret bob:BobSecret &
1010
sleep 0.05 # wait server ready
1111
cleanup
1212

@@ -32,5 +32,21 @@ curl_get_body 'http://127.0.0.1:3003/c/?tar' > "$archive"
3232
(tar -tf "$archive" | grep -q '^sub/sub1.txt$') && fail "sub/sub1.txt should not in $(basename $archive)"
3333
(tar -tf "$archive" | grep -q '^sub/sub2.txt$') && fail "sub/sub1.txt should not in $(basename $archive)"
3434

35+
assert $(curl_head_status 'http://127.0.0.1:3003/hello/?tar') '400'
36+
assert $(curl_head_status 'http://eve:[email protected]:3003/hello/?tar') '400'
37+
assert $(curl_head_status 'http://alice:[email protected]:3003/hello/?tar') '400'
38+
assert $(curl_head_status 'http://alice:[email protected]:3003/hello/?tar') '200'
39+
archive="$fs"/downloaded/hello.tar.tmp
40+
curl_get_body 'http://alice:[email protected]:3003/hello/?tar' > "$archive"
41+
(tar -tf "$archive" | grep -q '^index.txt$') || fail "index.txt should in $(basename $archive)"
42+
43+
assert $(curl_head_status 'http://127.0.0.1:3003/world/?tar') '400'
44+
assert $(curl_head_status 'http://eve:[email protected]:3003/world/?tar') '400'
45+
assert $(curl_head_status 'http://bob:[email protected]:3003/world/?tar') '400'
46+
assert $(curl_head_status 'http://bob:[email protected]:3003/world/?tar') '200'
47+
archive="$fs"/downloaded/world.tar.tmp
48+
curl_get_body 'http://bob:[email protected]:3003/world/?tar' > "$archive"
49+
(tar -tf "$archive" | grep -q '^index.txt$') || fail "index.txt should in $(basename $archive)"
50+
3551
cleanup
3652
jobs -p | xargs kill &> /dev/null

0 commit comments

Comments
 (0)