1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-29 09:20:02 +08:00

t0081: use 'ipfs pin ls <arg>' in test_pin_flagi()

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
This commit is contained in:
Christian Couder
2016-01-16 13:12:10 +01:00
parent f5f923a7a8
commit 893ab6dc83

View File

@ -8,30 +8,23 @@ test_description="Test ipfs repo pinning"
. lib/test-lib.sh
test_pin_flag() {
object=$1
ptype=$2
expect=$3
echo "test_pin_flag" $@
echo "test_pin_flag" "$@"
ipfs-pin-stat "$object" | egrep "\b$ptype\b"
actual=$?
if [ "$expect" = "true" ]; then
if [ "$actual" != "0" ]; then
echo "$object should be pinned $ptype ($actual)"
return 1
fi
if ipfs pin ls --type="$ptype" "$object" >actual
then
test "$expect" = "true" && return
test_fsh cat actual
return
else
if [ "$actual" != "1" ]; then
echo "$object should NOT be pinned $ptype ($actual)"
return 1
fi
test "$expect" = "false" && return
test_fsh cat actual
return
fi
return 0
}
test_pin() {