mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-02 23:08:07 +08:00
test: use car fixtures in sharness t0400
This commit is contained in:
parent
7f3c0baa5d
commit
3ed8f394e0
@ -10,6 +10,13 @@ test_description="Test API security"
|
||||
|
||||
test_init_ipfs
|
||||
|
||||
# Import test case
|
||||
# See the static fixtures in ./t0400-api-no-gateway/
|
||||
test_expect_success "Add the test directory" '
|
||||
ipfs dag import ../t0400-api-no-gateway/fixtures.car
|
||||
'
|
||||
HASH=QmNYERzV2LfD2kkfahtfv44ocHzEFK1sLBaE7zdcYT2GAZ # a file containing the string "testing"
|
||||
|
||||
# by default, we don't let you load arbitrary ipfs objects through the api,
|
||||
# because this would open up the api to scripting vulnerabilities.
|
||||
# only the webui objects are allowed.
|
||||
@ -17,14 +24,12 @@ test_init_ipfs
|
||||
|
||||
test_launch_ipfs_daemon
|
||||
test_expect_success "Gateway on API unavailable" '
|
||||
HASH=$(echo "testing" | ipfs add -q)
|
||||
test_curl_resp_http_code "http://127.0.0.1:$API_PORT/ipfs/$HASH" "HTTP/1.1 404 Not Found"
|
||||
'
|
||||
test_kill_ipfs_daemon
|
||||
|
||||
test_launch_ipfs_daemon --unrestricted-api
|
||||
test_expect_success "Gateway on --unrestricted-api API available" '
|
||||
HASH=$(echo "testing" | ipfs add -q)
|
||||
test_curl_resp_http_code "http://127.0.0.1:$API_PORT/ipfs/$HASH" "HTTP/1.1 200 OK"
|
||||
'
|
||||
test_kill_ipfs_daemon
|
||||
|
||||
15
test/sharness/t0400-api-no-gateway/README.md
Normal file
15
test/sharness/t0400-api-no-gateway/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Dataset description/sources
|
||||
|
||||
- fixtures.car
|
||||
- raw CARv1
|
||||
|
||||
generated with:
|
||||
|
||||
```sh
|
||||
HASH=$(echo "testing" | ipfs add -q)
|
||||
ipfs dag export $HASH > fixtures.car
|
||||
|
||||
echo HASH=${HASH} # a file containing the string "testing"
|
||||
|
||||
# HASH=QmNYERzV2LfD2kkfahtfv44ocHzEFK1sLBaE7zdcYT2GAZ # a file containing the string "testing"
|
||||
```
|
||||
BIN
test/sharness/t0400-api-no-gateway/fixtures.car
Normal file
BIN
test/sharness/t0400-api-no-gateway/fixtures.car
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user