sharness: add test for 'ipfs config replace'
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Jakub Sztandera committed
Aug 11, 2016 at 13:39 UTC
077948ab38f70efeab4314e391e1a48d9c3798f3
1 file changed
+13
-2
test/sharness/t0021-config.sh
+13
-2
@@ -72,6 +72,19 @@ test_config_cmd() {
72
grep "\"beep3\": false," actual
73
'
74
75
+ test_expect_success "'ipfs config replace' works" '
76
+ cp "$IPFS_PATH/config" newconfig.json &&
77
+ sed -i -e /PrivKey/d -e s/10GB/11GB/ newconfig.json &&
78
+ sed -i '"'"'/PeerID/ { s/,$// } '"'"' newconfig.json &&
79
+ ipfs config replace - < newconfig.json &&
80
+ sed -e /PrivKey/d "$IPFS_PATH/config" > replconfig.json &&
81
+ sed -i -e'"'"'/PeerID/ { s/,$// } '"'"' replconfig.json &&
82
+ test_cmp replconfig.json newconfig.json
83
+ '
84
+
85
+ # SECURITY
86
+ # Those tests are here to prevent exposing the PrivKey on the network
87
+
88
test_expect_success "'ipfs config Identity' fails" '
89
test_expect_code 1 ipfs config Identity 2> ident_out
90
'
@@ -81,8 +94,6 @@ test_config_cmd() {
94
test_cmp ident_exp ident_out
95
'
96
84
- # SECURITY
85
- # Those tests are here to prevent exposing the PrivKey on the network
97
test_expect_success "'ipfs config Identity.PrivKey' fails" '
98
test_expect_code 1 ipfs config Identity.PrivKey 2> ident_out
99
'