add a basic test for unwant
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
Sep 14, 2015 at 15:26 UTC
6c02259a5fd2c4d622674ba39f018f8122878a04
1 file changed
+32
test/sharness/t0220-bitswap.sh
new
+32
@@ -0,0 +1,32 @@
1
+#!/bin/sh
2
+#
3
+# Copyright (c) 2015 Jeromy Johnson
4
+# MIT Licensed; see the LICENSE file in this repository.
5
+#
6
+
7
+test_description="test bitswap commands"
8
+
9
+. lib/test-lib.sh
10
+
11
+test_init_ipfs
12
+test_launch_ipfs_daemon
13
+
14
+test_expect_success "'ipfs block get' adds hash to wantlist" '
15
+ export NONEXIST=QmeXxaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
16
+ test_expect_code 1 ipfs block get $NONEXIST --timeout=10ms &&
17
+ ipfs bitswap wantlist | grep $NONEXIST
18
+'
19
+
20
+test_expect_success "'ipfs bitswap unwant' succeeds" '
21
+ ipfs bitswap unwant $NONEXIST
22
+'
23
+
24
+test_expect_success "hash was removed from wantlist" '
25
+ ipfs bitswap wantlist > wantlist_out &&
26
+ printf "" > wantlist_exp &&
27
+ test_cmp wantlist_out wantlist_exp
28
+'
29
+
30
+test_kill_ipfs_daemon
31
+
32
+test_done