t0050-block.sh 954 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
#!/bin/sh
#
# Copyright (c) 2014 Christian Couder
# MIT Licensed; see the LICENSE file in this repository.
#

test_description="Test block command"

. lib/test-lib.sh

11
test_init_ipfs
12 13 14 15 16 17 18 19

test_expect_success "'ipfs block put' succeeds" '
	echo "Hello Mars!" >expected_in &&
	ipfs block put <expected_in >actual_out
'

test_expect_success "'ipfs block put' output looks good" '
	HASH="QmRKqGMAM6EZngbpjSqrvYzq5Qd8b1bSWymjSUY9zQSNDk" &&
20
	echo "$HASH" >expected_out &&
21 22 23 24 25 26 27 28 29 30 31
	test_cmp expected_out actual_out
'

test_expect_success "'ipfs block get' succeeds" '
	ipfs block get $HASH >actual_in
'

test_expect_success "'ipfs block get' output looks good" '
	test_cmp expected_in actual_in
'

Juan Batiz-Benet's avatar
Juan Batiz-Benet committed
32 33 34 35 36 37 38 39 40 41
test_expect_success "'ipfs block stat' succeeds" '
  ipfs block stat $HASH >actual_stat
'

test_expect_success "'ipfs block get' output looks good" '
  echo "Key: $HASH" >expected_stat &&
  echo "Size: 12" >>expected_stat &&
  test_cmp expected_stat actual_stat
'

42
test_done