Commit 727aea1f authored by Kevin Atkinson's avatar Kevin Atkinson

Enhance ipfs add --cid-base32 tests.

License: MIT
Signed-off-by: default avatarKevin Atkinson <k@kevina.org>
parent 57457af7
......@@ -276,32 +276,55 @@ test_add_cat_file() {
# --cid-base=base32
test_expect_success "ipfs add --cid-base=base32 succeeds" '
echo "Hello Worlds!" >mountdir/hello.txt &&
ipfs add --cid-base=base32 mountdir/hello.txt >actual
echo "base32 test" >mountdir/base32-test.txt &&
ipfs add --cid-base=base32 mountdir/base32-test.txt >actual
'
test_expect_success "ipfs add output looks good" '
HASH="bafybeidpq7lcjx4w5c6yr4vuthzvlav54hgxsremwk73to5ferdc2rxhai" &&
echo "added $HASH hello.txt" >expected &&
test_expect_success "ipfs add --cid-base=base32 output looks good" '
HASHb32="bafybeibyosqxljd2eptb4ebbtvk7pb4aoxzqa6ttdsflty6rsslz5y6i34" &&
echo "added $HASHb32 base32-test.txt" >expected &&
test_cmp expected actual
'
test_expect_success "ipfs add --cid-base=base32 --only-hash succeeds" '
ipfs add --cid-base=base32 --only-hash mountdir/hello.txt > oh_actual
ipfs add --cid-base=base32 --only-hash mountdir/base32-test.txt > oh_actual
'
test_expect_success "ipfs add --cid-base=base32 --only-hash output looks good" '
test_cmp expected oh_actual
'
test_expect_success "ipfs add --only-hash output looks good" '
test_expect_success "ipfs add --cid-base=base32 --force-cid-base=false succeeds" '
echo "base32 test" >mountdir/base32-test.txt &&
ipfs add --cid-base=base32 --force-cid-base=false mountdir/base32-test.txt >actual
'
test_expect_success "ipfs add --cid-base=base32 --force-cid-base=false output looks good" '
HASHv0=$(cid-fmt -v 0 -b z %s "$HASHb32") &&
echo "added $HASHv0 base32-test.txt" >expected &&
test_cmp expected actual
'
test_expect_success "ipfs add --cid-base=base32 --force-cid-base=false --only-hash succeeds" '
ipfs add --cid-base=base32 --force-cid-base=false --only-hash mountdir/base32-test.txt > oh_actual
'
test_expect_success "ipfs add --cid-base=base32 --force-cid-base=false --only-hash output looks good" '
test_cmp expected oh_actual
'
test_expect_success "ipfs cat succeeds" '
ipfs cat "$HASH" >actual
test_expect_success "ipfs cat with base32 hash succeeds" '
ipfs cat "$HASHb32" >actual
'
test_expect_success "ipfs cat with base32 hash output looks good" '
echo "base32 test" >expected &&
test_cmp expected actual
'
test_expect_success "ipfs cat output looks good" '
echo "Hello Worlds!" >expected &&
test_expect_success "ipfs cat using CIDv0 hash succeeds" '
ipfs cat "$HASHv0" >actual
'
test_expect_success "ipfs cat using CIDv0 hash looks good" '
echo "base32 test" >expected &&
test_cmp expected actual
'
}
test_add_cat_5MB() {
......@@ -343,6 +366,11 @@ test_add_cat_5MB() {
test_cmp mountdir/bigfile actual
'
test_expect_success "remove hash" '
ipfs pin rm "$EXP_HASH" &&
ipfs block rm "$EXP_HASH"
'
test_expect_success "get base32 version of CID" '
ipfs cid base32 $EXP_HASH > base32_cid &&
BASE32_HASH=`cat base32_cid`
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment