@cryptotaxi247 / kubo / commits / fc1a35e35

Add test script for block command

License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>

Christian Couder committed Nov 9, 2014 at 17:55 UTC fc1a35e35aa213e81532e7105b5e5dc4a2606cf3
1 file changed +35
test/t0050-block.sh new
+35
@@ -0,0 +1,35 @@
1 +#!/bin/sh
2 +#
3 +# Copyright (c) 2014 Christian Couder
4 +# MIT Licensed; see the LICENSE file in this repository.
5 +#
6 +
7 +test_description="Test block command"
8 +
9 +. lib/test-lib.sh
10 +
11 +test_expect_success "ipfs init succeeds" '
12 + export IPFS_DIR="$(pwd)/.go-ipfs" &&
13 + ipfs init
14 +'
15 +
16 +test_expect_success "'ipfs block put' succeeds" '
17 + echo "Hello Mars!" >expected_in &&
18 + ipfs block put <expected_in >actual_out
19 +'
20 +
21 +test_expect_success "'ipfs block put' output looks good" '
22 + HASH="QmRKqGMAM6EZngbpjSqrvYzq5Qd8b1bSWymjSUY9zQSNDk" &&
23 + echo "added as '\''$HASH'\''" >expected_out &&
24 + test_cmp expected_out actual_out
25 +'
26 +
27 +test_expect_success "'ipfs block get' succeeds" '
28 + ipfs block get $HASH >actual_in
29 +'
30 +
31 +test_expect_success "'ipfs block get' output looks good" '
32 + test_cmp expected_in actual_in
33 +'
34 +
35 +test_done